diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-14 22:28:12 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-14 22:28:12 +0000 |
commit | 3e08799bb8167e74988e84ccf17eaa922c66ff95 (patch) | |
tree | d5408e3945c69033a567bf71b68b17686fa3b300 /chrome | |
parent | e06375ed7728a9d8f4725aa8ff0253b97c0de63d (diff) | |
download | chromium_src-3e08799bb8167e74988e84ccf17eaa922c66ff95.zip chromium_src-3e08799bb8167e74988e84ccf17eaa922c66ff95.tar.gz chromium_src-3e08799bb8167e74988e84ccf17eaa922c66ff95.tar.bz2 |
first-run: Eliminate the ifdefs in upgrade_util.h
BUG=79203
TEST=None
R=jhawkins@chromium.org
Review URL: http://codereview.chromium.org/6853022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81659 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/app/chrome_exe_main_gtk.cc | 3 | ||||
-rw-r--r-- | chrome/browser/browser_main.cc | 30 | ||||
-rw-r--r-- | chrome/browser/browser_main_win.cc | 2 | ||||
-rw-r--r-- | chrome/browser/browser_shutdown.cc | 1 | ||||
-rw-r--r-- | chrome/browser/first_run/upgrade_util.h | 34 | ||||
-rw-r--r-- | chrome/browser/first_run/upgrade_util_linux.cc | 1 | ||||
-rw-r--r-- | chrome/browser/first_run/upgrade_util_linux.h | 19 | ||||
-rw-r--r-- | chrome/browser/first_run/upgrade_util_win.cc | 3 | ||||
-rw-r--r-- | chrome/browser/first_run/upgrade_util_win.h | 34 |
9 files changed, 73 insertions, 54 deletions
diff --git a/chrome/app/chrome_exe_main_gtk.cc b/chrome/app/chrome_exe_main_gtk.cc index 1e3fa0e..d240fad 100644 --- a/chrome/app/chrome_exe_main_gtk.cc +++ b/chrome/app/chrome_exe_main_gtk.cc @@ -4,10 +4,7 @@ #include "base/process_util.h" #include "build/build_config.h" - -#if defined(OS_LINUX) && !defined(OS_CHROMEOS) #include "chrome/browser/first_run/upgrade_util.h" -#endif // The entry point for all invocations of Chromium, browser and renderer. On // windows, this does nothing but load chrome.dll and invoke its entry point in diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index 560dcc4..faa2335 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -124,11 +124,26 @@ #include "chrome/browser/ui/gtk/gtk_util.h" #endif +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) +#include "chrome/browser/first_run/upgrade_util_linux.h" +#endif + #if defined(OS_CHROMEOS) #include "chrome/browser/chromeos/boot_times_loader.h" #include "chrome/browser/chromeos/brightness_observer.h" #include "chrome/browser/chromeos/system_key_event_listener.h" +#include "chrome/browser/chromeos/cros/cros_library.h" +#include "chrome/browser/chromeos/cros/screen_lock_library.h" +#include "chrome/browser/chromeos/customization_document.h" +#include "chrome/browser/chromeos/external_metrics.h" +#include "chrome/browser/chromeos/login/authenticator.h" +#include "chrome/browser/chromeos/login/login_utils.h" +#include "chrome/browser/chromeos/login/ownership_service.h" +#include "chrome/browser/chromeos/login/screen_locker.h" +#include "chrome/browser/chromeos/login/user_manager.h" +#include "chrome/browser/chromeos/metrics_cros_settings_provider.h" #include "chrome/browser/oom_priority_manager.h" +#include "chrome/browser/ui/views/browser_dialogs.h" #endif // TODO(port): several win-only methods have been pulled out of this, but @@ -145,6 +160,7 @@ #include "base/win/windows_version.h" #include "chrome/browser/browser_trial.h" #include "chrome/browser/first_run/try_chrome_dialog_view.h" +#include "chrome/browser/first_run/upgrade_util_win.h" #include "chrome/browser/metrics/user_metrics.h" #include "chrome/browser/net/url_fixer_upper.h" #include "chrome/browser/rlz/rlz.h" @@ -174,20 +190,6 @@ #endif #endif -#if defined(OS_CHROMEOS) -#include "chrome/browser/chromeos/cros/cros_library.h" -#include "chrome/browser/chromeos/cros/screen_lock_library.h" -#include "chrome/browser/chromeos/customization_document.h" -#include "chrome/browser/chromeos/external_metrics.h" -#include "chrome/browser/chromeos/login/authenticator.h" -#include "chrome/browser/chromeos/login/login_utils.h" -#include "chrome/browser/chromeos/login/ownership_service.h" -#include "chrome/browser/chromeos/login/screen_locker.h" -#include "chrome/browser/chromeos/login/user_manager.h" -#include "chrome/browser/chromeos/metrics_cros_settings_provider.h" -#include "chrome/browser/ui/views/browser_dialogs.h" -#endif - #if defined(TOOLKIT_USES_GTK) #include "ui/gfx/gtk_util.h" #endif diff --git a/chrome/browser/browser_main_win.cc b/chrome/browser/browser_main_win.cc index 0a5ded4..d8b8cdd 100644 --- a/chrome/browser/browser_main_win.cc +++ b/chrome/browser/browser_main_win.cc @@ -21,7 +21,7 @@ #include "base/win/wrapped_window_proc.h" #include "crypto/nss_util.h" #include "chrome/browser/first_run/first_run.h" -#include "chrome/browser/first_run/upgrade_util.h" +#include "chrome/browser/first_run/upgrade_util_win.h" #include "chrome/browser/metrics/metrics_service.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/views/uninstall_view.h" diff --git a/chrome/browser/browser_shutdown.cc b/chrome/browser/browser_shutdown.cc index f5b5906..374e37c 100644 --- a/chrome/browser/browser_shutdown.cc +++ b/chrome/browser/browser_shutdown.cc @@ -43,6 +43,7 @@ #include "ui/base/resource/resource_bundle.h" #if defined(OS_WIN) +#include "chrome/browser/first_run/upgrade_util_win.h" #include "chrome/browser/rlz/rlz.h" #endif diff --git a/chrome/browser/first_run/upgrade_util.h b/chrome/browser/first_run/upgrade_util.h index 322073c..89302b2 100644 --- a/chrome/browser/first_run/upgrade_util.h +++ b/chrome/browser/first_run/upgrade_util.h @@ -6,14 +6,8 @@ #define CHROME_BROWSER_FIRST_RUN_UPGRADE_UTIL_H_ #pragma once -#include "build/build_config.h" - class CommandLine; -#if defined(OS_WIN) -class ProcessSingleton; -#endif - namespace upgrade_util { void SetNewCommandLine(CommandLine* new_command_line); @@ -33,34 +27,6 @@ bool RelaunchChromeBrowser(const CommandLine& command_line); // running instance. bool IsUpdatePendingRestart(); -#if defined(OS_WIN) -// Check if current chrome.exe is already running as a browser process by -// trying to create a Global event with name same as full path of chrome.exe. -// This method caches the handle to this event so on subsequent calls also -// it can first close the handle and check for any other process holding the -// handle to the event. -bool IsBrowserAlreadyRunning(); - -// If the new_chrome.exe exists (placed by the installer then is swapped -// to chrome.exe and the old chrome is renamed to old_chrome.exe. If there -// is no new_chrome.exe or the swap fails the return is false; -bool SwapNewChromeExeIfPresent(); - -// Combines the two methods, RelaunchChromeBrowser and -// SwapNewChromeExeIfPresent, to perform the rename and relaunch of -// the browser. Note that relaunch does NOT exit the existing browser process. -// If this is called before message loop is executed, simply exit the main -// function. If browser is already running, you will need to exit it. -bool DoUpgradeTasks(const CommandLine& command_line); - -#endif // OS_WIN - -#if defined(OS_LINUX) && !defined(OS_CHROMEOS) -void SaveLastModifiedTimeOfExe(); - -double GetLastModifiedTimeOfExe(); -#endif - } // namespace upgrade_util #endif // CHROME_BROWSER_FIRST_RUN_UPGRADE_UTIL_H_ diff --git a/chrome/browser/first_run/upgrade_util_linux.cc b/chrome/browser/first_run/upgrade_util_linux.cc index 6c3fb88..6384c38 100644 --- a/chrome/browser/first_run/upgrade_util_linux.cc +++ b/chrome/browser/first_run/upgrade_util_linux.cc @@ -12,6 +12,7 @@ #include "base/path_service.h" #include "base/platform_file.h" #include "base/process_util.h" +#include "chrome/browser/first_run/upgrade_util_linux.h" namespace { diff --git a/chrome/browser/first_run/upgrade_util_linux.h b/chrome/browser/first_run/upgrade_util_linux.h new file mode 100644 index 0000000..8afff07 --- /dev/null +++ b/chrome/browser/first_run/upgrade_util_linux.h @@ -0,0 +1,19 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_FIRST_RUN_UPGRADE_UTIL_LINUX_H_ +#define CHROME_BROWSER_FIRST_RUN_UPGRADE_UTIL_LINUX_H_ +#pragma once + +namespace upgrade_util { + +// Saves the last modified time of the chrome executable file. +void SaveLastModifiedTimeOfExe(); + +// Returns the last modified time of the chrome executable file. +double GetLastModifiedTimeOfExe(); + +} // namespace upgrade_util + +#endif // CHROME_BROWSER_FIRST_RUN_UPGRADE_UTIL_LINUX_H_ diff --git a/chrome/browser/first_run/upgrade_util_win.cc b/chrome/browser/first_run/upgrade_util_win.cc index 316eecc..7789a2e 100644 --- a/chrome/browser/first_run/upgrade_util_win.cc +++ b/chrome/browser/first_run/upgrade_util_win.cc @@ -17,8 +17,7 @@ #include "base/process_util.h" #include "base/win/registry.h" #include "base/win/scoped_comptr.h" -#include "chrome/browser/first_run/try_chrome_dialog_view.h" -#include "chrome/browser/process_singleton.h" +#include "chrome/browser/first_run/upgrade_util_win.h" #include "chrome/common/chrome_constants.h" #include "chrome/installer/util/browser_distribution.h" #include "chrome/installer/util/google_update_constants.h" diff --git a/chrome/browser/first_run/upgrade_util_win.h b/chrome/browser/first_run/upgrade_util_win.h new file mode 100644 index 0000000..da63aaa --- /dev/null +++ b/chrome/browser/first_run/upgrade_util_win.h @@ -0,0 +1,34 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_FIRST_RUN_UPGRADE_UTIL_WIN_H_ +#define CHROME_BROWSER_FIRST_RUN_UPGRADE_UTIL_WIN_H_ +#pragma once + +class CommandLine; + +namespace upgrade_util { + +// Check if current chrome.exe is already running as a browser process by +// trying to create a Global event with name same as full path of chrome.exe. +// This method caches the handle to this event so on subsequent calls also +// it can first close the handle and check for any other process holding the +// handle to the event. +bool IsBrowserAlreadyRunning(); + +// If the new_chrome.exe exists (placed by the installer then is swapped +// to chrome.exe and the old chrome is renamed to old_chrome.exe. If there +// is no new_chrome.exe or the swap fails the return is false; +bool SwapNewChromeExeIfPresent(); + +// Combines the two methods, RelaunchChromeBrowser and +// SwapNewChromeExeIfPresent, to perform the rename and relaunch of +// the browser. Note that relaunch does NOT exit the existing browser process. +// If this is called before message loop is executed, simply exit the main +// function. If browser is already running, you will need to exit it. +bool DoUpgradeTasks(const CommandLine& command_line); + +} // namespace upgrade_util + +#endif // CHROME_BROWSER_FIRST_RUN_UPGRADE_UTIL_WIN_H_ |