diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-15 21:42:03 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-15 21:42:03 +0000 |
commit | 1018986a95eac94015707d2966b9200ae6168460 (patch) | |
tree | 31d0da78b4806b5d5448ce9992088f169b7ae4fb /chrome | |
parent | 0b7825364256151b9d63a870e0d995125573cff7 (diff) | |
download | chromium_src-1018986a95eac94015707d2966b9200ae6168460.zip chromium_src-1018986a95eac94015707d2966b9200ae6168460.tar.gz chromium_src-1018986a95eac94015707d2966b9200ae6168460.tar.bz2 |
first-run: Pull out FirstRunBrowserProcess/ImportObserver into their own header files.
This cleanups the first_run.h file a little bit.
BUG=None
TEST=None
R=jhawkins@chromium.org
Review URL: http://codereview.chromium.org/6871002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81810 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/browser_main.cc | 9 | ||||
-rw-r--r-- | chrome/browser/first_run/first_run.cc | 43 | ||||
-rw-r--r-- | chrome/browser/first_run/first_run.h | 44 | ||||
-rw-r--r-- | chrome/browser/first_run/first_run_browser_process.cc | 22 | ||||
-rw-r--r-- | chrome/browser/first_run/first_run_browser_process.h | 29 | ||||
-rw-r--r-- | chrome/browser/first_run/first_run_gtk.cc | 2 | ||||
-rw-r--r-- | chrome/browser/first_run/first_run_import_observer.cc | 30 | ||||
-rw-r--r-- | chrome/browser/first_run/first_run_import_observer.h | 38 | ||||
-rw-r--r-- | chrome/browser/first_run/first_run_win.cc | 3 | ||||
-rw-r--r-- | chrome/browser/importer/importer_list.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/views/accessibility_event_router_views.cc | 1 | ||||
-rw-r--r-- | chrome/chrome_browser.gypi | 4 |
12 files changed, 140 insertions, 87 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index 871c792..1853af7 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -32,15 +32,16 @@ #include "build/build_config.h" #include "chrome/browser/about_flags.h" #include "chrome/browser/browser_main_win.h" -#include "chrome/browser/chrome_content_browser_client.h" -#include "chrome/browser/defaults.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process_impl.h" #include "chrome/browser/browser_shutdown.h" +#include "chrome/browser/chrome_content_browser_client.h" +#include "chrome/browser/defaults.h" #include "chrome/browser/extensions/extension_protocols.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extensions_startup.h" #include "chrome/browser/first_run/first_run.h" +#include "chrome/browser/first_run/first_run_browser_process.h" #include "chrome/browser/first_run/upgrade_util.h" #include "chrome/browser/gpu_data_manager.h" #include "chrome/browser/jankometer.h" @@ -120,6 +121,7 @@ #if defined(OS_POSIX) && !defined(OS_MACOSX) #include <dbus/dbus-glib.h> + #include "chrome/browser/browser_main_gtk.h" #include "chrome/browser/ui/gtk/gtk_util.h" #endif @@ -131,7 +133,6 @@ #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" @@ -142,6 +143,7 @@ #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/chromeos/system_key_event_listener.h" #include "chrome/browser/oom_priority_manager.h" #include "chrome/browser/ui/views/browser_dialogs.h" #endif @@ -180,6 +182,7 @@ #if defined(OS_MACOSX) #include <Security/Security.h> + #include "chrome/browser/cocoa/install_from_dmg.h" #endif diff --git a/chrome/browser/first_run/first_run.cc b/chrome/browser/first_run/first_run.cc index 62e74f2..af3c1a7 100644 --- a/chrome/browser/first_run/first_run.cc +++ b/chrome/browser/first_run/first_run.cc @@ -10,6 +10,8 @@ #include "base/path_service.h" #include "base/utf_string_conversions.h" #include "build/build_config.h" +#include "chrome/browser/browser_process.h" +#include "chrome/browser/first_run/first_run_import_observer.h" #include "chrome/browser/importer/external_process_importer_host.h" #include "chrome/browser/importer/importer_host.h" #include "chrome/browser/importer/importer_list.h" @@ -571,47 +573,6 @@ void FirstRun::AutoImport( FirstRun::CreateSentinel(); } -// FirstRunBrowserProcess ----------------------------------------------------- - -FirstRunBrowserProcess::FirstRunBrowserProcess(const CommandLine& command_line) - : BrowserProcessImpl(command_line) { -} - -FirstRunBrowserProcess::~FirstRunBrowserProcess() {} - -GoogleURLTracker* FirstRunBrowserProcess::google_url_tracker() { - return NULL; -} - -IntranetRedirectDetector* FirstRunBrowserProcess::intranet_redirect_detector() { - return NULL; -} - -// FirstRunImportObserver ----------------------------------------------------- - -FirstRunImportObserver::FirstRunImportObserver() - : loop_running_(false), import_result_(ResultCodes::NORMAL_EXIT) { -} - -int FirstRunImportObserver::import_result() const { - return import_result_; -} - -void FirstRunImportObserver::RunLoop() { - loop_running_ = true; - MessageLoop::current()->Run(); -} - -void FirstRunImportObserver::Finish() { - if (loop_running_) - MessageLoop::current()->Quit(); -} - -void FirstRunImportObserver::ImportCompleted() { - import_result_ = ResultCodes::NORMAL_EXIT; - Finish(); -} - #if defined(OS_POSIX) namespace { diff --git a/chrome/browser/first_run/first_run.h b/chrome/browser/first_run/first_run.h index 25be229..481ce0e 100644 --- a/chrome/browser/first_run/first_run.h +++ b/chrome/browser/first_run/first_run.h @@ -10,9 +10,8 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" -#include "chrome/browser/browser_process_impl.h" -#include "chrome/browser/importer/importer_observer.h" -#include "content/common/result_codes.h" +#include "base/gtest_prod_util.h" +#include "base/memory/ref_counted.h" #include "ui/gfx/native_widget_types.h" class CommandLine; @@ -213,43 +212,4 @@ class FirstRun { DISALLOW_IMPLICIT_CONSTRUCTORS(FirstRun); }; - -// A subclass of BrowserProcessImpl that does not have a GoogleURLTracker or -// IntranetRedirectDetector so we don't do any URL fetches (as we have no IO -// thread to fetch on). -class FirstRunBrowserProcess : public BrowserProcessImpl { - public: - explicit FirstRunBrowserProcess(const CommandLine& command_line); - virtual ~FirstRunBrowserProcess(); - - virtual GoogleURLTracker* google_url_tracker(); - virtual IntranetRedirectDetector* intranet_redirect_detector(); - - private: - DISALLOW_COPY_AND_ASSIGN(FirstRunBrowserProcess); -}; - -// This class is used by FirstRun::ImportNow to get notified of the outcome of -// the import operation. It differs from ImportProcessRunner in that this -// class executes in the context of importing child process. -// The values that it handles are meant to be used as the process exit code. -class FirstRunImportObserver : public ImporterObserver { - public: - FirstRunImportObserver(); - - int import_result() const; - void RunLoop(); - - private: - void Finish(); - - // ImporterObserver: - virtual void ImportCompleted() OVERRIDE; - - bool loop_running_; - int import_result_; - - DISALLOW_COPY_AND_ASSIGN(FirstRunImportObserver); -}; - #endif // CHROME_BROWSER_FIRST_RUN_FIRST_RUN_H_ diff --git a/chrome/browser/first_run/first_run_browser_process.cc b/chrome/browser/first_run/first_run_browser_process.cc new file mode 100644 index 0000000..01a990c --- /dev/null +++ b/chrome/browser/first_run/first_run_browser_process.cc @@ -0,0 +1,22 @@ +// 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. + +#include "chrome/browser/first_run/first_run_browser_process.h" + +#include "base/command_line.h" + +FirstRunBrowserProcess::FirstRunBrowserProcess(const CommandLine& command_line) + : BrowserProcessImpl(command_line) { +} + +FirstRunBrowserProcess::~FirstRunBrowserProcess() { +} + +GoogleURLTracker* FirstRunBrowserProcess::google_url_tracker() { + return NULL; +} + +IntranetRedirectDetector* FirstRunBrowserProcess::intranet_redirect_detector() { + return NULL; +} diff --git a/chrome/browser/first_run/first_run_browser_process.h b/chrome/browser/first_run/first_run_browser_process.h new file mode 100644 index 0000000..f3c31fd --- /dev/null +++ b/chrome/browser/first_run/first_run_browser_process.h @@ -0,0 +1,29 @@ +// 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_FIRST_RUN_BROWSER_PROCESS_H_ +#define CHROME_BROWSER_FIRST_RUN_FIRST_RUN_BROWSER_PROCESS_H_ +#pragma once + +#include "base/basictypes.h" +#include "base/compiler_specific.h" +#include "chrome/browser/browser_process_impl.h" + +// A subclass of BrowserProcessImpl that does not have a GoogleURLTracker or +// IntranetRedirectDetector so we don't do any URL fetches (as we have no IO +// thread to fetch on). +class FirstRunBrowserProcess : public BrowserProcessImpl { + public: + explicit FirstRunBrowserProcess(const CommandLine& command_line); + virtual ~FirstRunBrowserProcess(); + + // BrowserProcessImpl: + virtual GoogleURLTracker* google_url_tracker() OVERRIDE; + virtual IntranetRedirectDetector* intranet_redirect_detector() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(FirstRunBrowserProcess); +}; + +#endif // CHROME_BROWSER_FIRST_RUN_FIRST_RUN_BROWSER_PROCESS_H_ diff --git a/chrome/browser/first_run/first_run_gtk.cc b/chrome/browser/first_run/first_run_gtk.cc index 93dd7f4..031be77 100644 --- a/chrome/browser/first_run/first_run_gtk.cc +++ b/chrome/browser/first_run/first_run_gtk.cc @@ -12,7 +12,7 @@ #include "base/string_piece.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" -#include "base/values.h" +#include "chrome/browser/browser_process.h" #include "chrome/browser/shell_integration.h" #include "chrome/browser/ui/gtk/first_run_dialog.h" #include "chrome/common/chrome_switches.h" diff --git a/chrome/browser/first_run/first_run_import_observer.cc b/chrome/browser/first_run/first_run_import_observer.cc new file mode 100644 index 0000000..b82205c --- /dev/null +++ b/chrome/browser/first_run/first_run_import_observer.cc @@ -0,0 +1,30 @@ +// 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. + +#include "chrome/browser/first_run/first_run_import_observer.h" + +#include "base/message_loop.h" +#include "content/common/result_codes.h" + +FirstRunImportObserver::FirstRunImportObserver() + : loop_running_(false), import_result_(ResultCodes::NORMAL_EXIT) { +} + +FirstRunImportObserver::~FirstRunImportObserver() { +} + +void FirstRunImportObserver::RunLoop() { + loop_running_ = true; + MessageLoop::current()->Run(); +} + +void FirstRunImportObserver::Finish() { + if (loop_running_) + MessageLoop::current()->Quit(); +} + +void FirstRunImportObserver::ImportCompleted() { + import_result_ = ResultCodes::NORMAL_EXIT; + Finish(); +} diff --git a/chrome/browser/first_run/first_run_import_observer.h b/chrome/browser/first_run/first_run_import_observer.h new file mode 100644 index 0000000..50d1d5c --- /dev/null +++ b/chrome/browser/first_run/first_run_import_observer.h @@ -0,0 +1,38 @@ +// 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_FIRST_RUN_IMPORT_OBSERVER_H_ +#define CHROME_BROWSER_FIRST_RUN_FIRST_RUN_IMPORT_OBSERVER_H_ +#pragma once + +#include "base/basictypes.h" +#include "base/compiler_specific.h" +#include "chrome/browser/importer/importer_observer.h" + +// This class is used by FirstRun::ImportNow to get notified of the outcome of +// the import operation. It differs from ImportProcessRunner in that this +// class executes in the context of the importing child process. +// The values that it handles are meant to be used as the process exit code. +class FirstRunImportObserver : public ImporterObserver { + public: + FirstRunImportObserver(); + virtual ~FirstRunImportObserver(); + + void RunLoop(); + + int import_result() const { return import_result_; } + + private: + void Finish(); + + // ImporterObserver: + virtual void ImportCompleted() OVERRIDE; + + bool loop_running_; + int import_result_; + + DISALLOW_COPY_AND_ASSIGN(FirstRunImportObserver); +}; + +#endif // CHROME_BROWSER_FIRST_RUN_FIRST_RUN_IMPORT_OBSERVER_H_ diff --git a/chrome/browser/first_run/first_run_win.cc b/chrome/browser/first_run/first_run_win.cc index 57c94ce..486d868 100644 --- a/chrome/browser/first_run/first_run_win.cc +++ b/chrome/browser/first_run/first_run_win.cc @@ -19,8 +19,10 @@ #include "base/utf_string_conversions.h" #include "base/win/object_watcher.h" #include "base/win/windows_version.h" +#include "chrome/browser/browser_process.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_updater.h" +#include "chrome/browser/first_run/first_run_import_observer.h" #include "chrome/browser/importer/importer_host.h" #include "chrome/browser/importer/importer_list.h" #include "chrome/browser/importer/importer_progress_dialog.h" @@ -38,6 +40,7 @@ #include "chrome/installer/util/shell_util.h" #include "chrome/installer/util/util_constants.h" #include "content/common/notification_service.h" +#include "content/common/result_codes.h" #include "google_update_idl.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" diff --git a/chrome/browser/importer/importer_list.cc b/chrome/browser/importer/importer_list.cc index b1549ea..554094b 100644 --- a/chrome/browser/importer/importer_list.cc +++ b/chrome/browser/importer/importer_list.cc @@ -13,6 +13,8 @@ #include "ui/base/l10n/l10n_util.h" #if defined(OS_MACOSX) +#include <CoreFoundation/CoreFoundation.h> + #include "base/mac/foundation_util.h" #include "chrome/browser/importer/safari_importer.h" #endif diff --git a/chrome/browser/ui/views/accessibility_event_router_views.cc b/chrome/browser/ui/views/accessibility_event_router_views.cc index ca5d4fc..34fb85e 100644 --- a/chrome/browser/ui/views/accessibility_event_router_views.cc +++ b/chrome/browser/ui/views/accessibility_event_router_views.cc @@ -8,6 +8,7 @@ #include "base/callback.h" #include "base/message_loop.h" #include "base/utf_string_conversions.h" +#include "chrome/browser/browser_process.h" #include "chrome/browser/extensions/extension_accessibility_api.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 8929277..82dcc26 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -1069,7 +1069,11 @@ 'browser/file_select_helper.h', 'browser/first_run/first_run.cc', 'browser/first_run/first_run.h', + 'browser/first_run/first_run_browser_process.cc', + 'browser/first_run/first_run_browser_process.h', 'browser/first_run/first_run_gtk.cc', + 'browser/first_run/first_run_import_observer.cc', + 'browser/first_run/first_run_import_observer.h', 'browser/first_run/first_run_mac.mm', 'browser/first_run/first_run_win.cc', 'browser/first_run/upgrade_util.cc', |