diff options
Diffstat (limited to 'chrome/browser')
21 files changed, 385 insertions, 275 deletions
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc index 10a0a1f..2fb3af6 100644 --- a/chrome/browser/chrome_browser_main.cc +++ b/chrome/browser/chrome_browser_main.cc @@ -33,8 +33,6 @@ #include "chrome/browser/background/background_mode_manager.h" #include "chrome/browser/browser_process_impl.h" #include "chrome/browser/browser_shutdown.h" -#include "chrome/browser/chrome_browser_main_gtk.h" -#include "chrome/browser/chrome_browser_main_win.h" #include "chrome/browser/defaults.h" #include "chrome/browser/extensions/default_apps_trial.h" #include "chrome/browser/extensions/extension_protocols.h" @@ -121,10 +119,6 @@ #include "chrome/app/breakpad_linux.h" #endif -#if defined(TOOLKIT_USES_GTK) -#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 @@ -161,6 +155,7 @@ #include "base/win/windows_version.h" #include "chrome/browser/browser_trial.h" #include "chrome/browser/browser_util_win.h" +#include "chrome/browser/chrome_browser_main_win.h" #include "chrome/browser/first_run/try_chrome_dialog_view.h" #include "chrome/browser/first_run/upgrade_util_win.h" #include "chrome/browser/fragmentation_checker_win.h" @@ -195,6 +190,7 @@ #endif #if defined(TOOLKIT_USES_GTK) +#include "chrome/browser/ui/gtk/gtk_util.h" #include "ui/gfx/gtk_util.h" #endif @@ -202,6 +198,10 @@ #include "ui/base/touch/touch_factory.h" #endif +#if defined(USE_X11) +#include "chrome/browser/chrome_browser_main_x11.h" +#endif + #if defined(USE_AURA) #include "chrome/browser/ui/views/aura/chrome_shell_delegate.h" #include "ui/aura/desktop.h" @@ -681,7 +681,9 @@ const char kMissingLocaleDataMessage[] = ChromeBrowserMainParts::ChromeBrowserMainParts( const MainFunctionParams& parameters) - : BrowserMainParts(parameters), + : parameters_(parameters), + parsed_command_line_(parameters.command_line_), + result_code_(content::RESULT_CODE_NORMAL_EXIT), shutdown_watcher_(new ShutdownWatcherHelper()), record_search_engine_(false), translate_manager_(NULL), @@ -698,12 +700,12 @@ ChromeBrowserMainParts::~ChromeBrowserMainParts() { // This will be called after the command-line has been mutated by about:flags MetricsService* ChromeBrowserMainParts::SetupMetricsAndFieldTrials( - const CommandLine& parsed_command_line, PrefService* local_state) { // Must initialize metrics after labs have been converted into switches, // but before field trials are set up (so that client ID is available for // one-time randomized field trials). - MetricsService* metrics = InitializeMetrics(parsed_command_line, local_state); + MetricsService* metrics = InitializeMetrics( + parsed_command_line_, local_state); // Initialize FieldTrialList to support FieldTrials that use one-time // randomization. The client ID will be empty if the user has not opted @@ -1176,10 +1178,10 @@ DLLEXPORT void __cdecl RelaunchChromeBrowserWithNewCommandLineIfNeeded() { #endif void ChromeBrowserMainParts::PreMainMessageLoopRun() { - set_result_code(PreMainMessageLoopRunInternal()); + result_code_ = PreMainMessageLoopRunImpl(); } -int ChromeBrowserMainParts::PreMainMessageLoopRunInternal() { +int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { run_message_loop_ = false; FilePath user_data_dir; #if defined(OS_WIN) @@ -1382,8 +1384,7 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunInternal() { // Now the command line has been mutated based on about:flags, we can // set up metrics and initialize field trials. - MetricsService* metrics = - SetupMetricsAndFieldTrials(parsed_command_line(), local_state); + MetricsService* metrics = SetupMetricsAndFieldTrials(local_state); #if defined(USE_WEBKIT_COMPOSITOR) // We need to ensure WebKit has been initialized before we start the WebKit @@ -1472,12 +1473,14 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunInternal() { if (parsed_command_line().HasSwitch(switches::kUninstall)) { return DoUninstallTasks(already_running); } -#endif if (parsed_command_line().HasSwitch(switches::kHideIcons) || parsed_command_line().HasSwitch(switches::kShowIcons)) { - return HandleIconsCommands(parsed_command_line()); + return ChromeBrowserMainPartsWin::HandleIconsCommands( + parsed_command_line_); } +#endif + if (parsed_command_line().HasSwitch(switches::kMakeDefaultBrowser)) { return ShellIntegration::SetAsDefaultBrowser() ? static_cast<int>(content::RESULT_CODE_NORMAL_EXIT) : @@ -1630,7 +1633,6 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunInternal() { // Do the tasks if chrome has been upgraded while it was last running. if (!already_running && upgrade_util::DoUpgradeTasks(parsed_command_line())) return content::RESULT_CODE_NORMAL_EXIT; -#endif // Check if there is any machine level Chrome installed on the current // machine. If yes and the current Chrome process is user level, we do not @@ -1641,9 +1643,10 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunInternal() { // processes etc). // Do not allow this to occur for Chrome Frame user-to-system handoffs. if (!parsed_command_line().HasSwitch(switches::kChromeFrame) && - CheckMachineLevelInstall()) { + ChromeBrowserMainPartsWin::CheckMachineLevelInstall()) { return chrome::RESULT_CODE_MACHINE_LEVEL_INSTALL_EXISTS; } +#endif // Create the TranslateManager singleton. translate_manager_ = TranslateManager::GetInstance(); @@ -1691,26 +1694,24 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunInternal() { g_browser_process->profile_manager()->OnImportFinished(profile_); } // if (is_first_run) +#if defined(OS_WIN) // Sets things up so that if we crash from this point on, a dialog will // popup asking the user to restart chrome. It is done this late to avoid // testing against a bunch of special cases that are taken care early on. - PrepareRestartOnCrashEnviroment(parsed_command_line()); + ChromeBrowserMainPartsWin::PrepareRestartOnCrashEnviroment( + parsed_command_line()); - // Start watching for hangs during startup. We disarm this hang detector when - // ThreadWatcher takes over or when browser is shutdown. - StartupTimeBomb::Arm(base::TimeDelta::FromSeconds(300)); - -#if defined(OS_WIN) // Registers Chrome with the Windows Restart Manager, which will restore the // Chrome session when the computer is restarted after a system update. // This could be run as late as WM_QUERYENDSESSION for system update reboots, // but should run on startup if extended to handle crashes/hangs/patches. // Also, better to run once here than once for each HWND's WM_QUERYENDSESSION. - if (base::win::GetVersion() >= base::win::VERSION_VISTA) - RegisterApplicationRestart(parsed_command_line()); -#endif // OS_WIN + if (base::win::GetVersion() >= base::win::VERSION_VISTA) { + ChromeBrowserMainPartsWin::RegisterApplicationRestart( + parsed_command_line()); + } -#if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD) +#if defined(GOOGLE_CHROME_BUILD) // Init the RLZ library. This just binds the dll and schedules a task on the // file thread to be run sometime later. If this is the first run we record // the installation event. @@ -1743,7 +1744,12 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunInternal() { // for the startup page if needed (i.e., when the startup page is set to // the home page). RLZTracker::GetAccessPointRlz(rlz_lib::CHROME_HOME_PAGE, NULL); -#endif // GOOGLE_CHROME_BUILD && OS_WIN +#endif // GOOGLE_CHROME_BUILD +#endif // OS_WIN + + // Start watching for hangs during startup. We disarm this hang detector when + // ThreadWatcher takes over or when browser is shutdown. + StartupTimeBomb::Arm(base::TimeDelta::FromSeconds(300)); // Configure modules that need access to resources. net::NetModule::SetResourceProvider(chrome_common_net::NetResourceProvider); @@ -1948,9 +1954,12 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunInternal() { return result_code; } -void ChromeBrowserMainParts::MainMessageLoopRun() { +bool ChromeBrowserMainParts::MainMessageLoopRun(int* result_code) { + // Set the result code set in PreMainMessageLoopRun. + *result_code = result_code_; + if (!run_message_loop_) - return; + return true; // Don't run the default message loop. // This should be invoked as close to the start of the browser's // UI thread message loop as possible to get a stable measurement @@ -1971,6 +1980,8 @@ void ChromeBrowserMainParts::MainMessageLoopRun() { chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("UIMessageLoopEnded", true); #endif + + return true; } void ChromeBrowserMainParts::PostMainMessageLoopRun() { diff --git a/chrome/browser/chrome_browser_main.h b/chrome/browser/chrome_browser_main.h index 95f2fea..817e8de 100644 --- a/chrome/browser/chrome_browser_main.h +++ b/chrome/browser/chrome_browser_main.h @@ -8,11 +8,12 @@ #include "base/basictypes.h" #include "base/gtest_prod_util.h" +#include "base/memory/scoped_ptr.h" #include "base/metrics/field_trial.h" #include "base/tracked_objects.h" #include "chrome/browser/first_run/first_run.h" #include "chrome/browser/process_singleton.h" -#include "content/browser/browser_main.h" +#include "content/public/browser/browser_main_parts.h" class BrowserProcessImpl; class FieldTrialSynchronizer; @@ -22,6 +23,7 @@ class PrefService; class Profile; class ShutdownWatcherHelper; class TranslateManager; +struct MainFunctionParams; namespace chrome_browser { // For use by ShowMissingLocaleMessageBox. @@ -36,18 +38,30 @@ class ChromeBrowserMainParts : public content::BrowserMainParts { // Constructs metrics service and does related initialization, including // creation of field trials. Call only after labs have been converted to // switches. - MetricsService* SetupMetricsAndFieldTrials( - const CommandLine& parsed_command_line, - PrefService* local_state); + MetricsService* SetupMetricsAndFieldTrials(PrefService* local_state); + + const MainFunctionParams& parameters() const { + return parameters_; + } + const CommandLine& parsed_command_line() const { + return parsed_command_line_; + } protected: explicit ChromeBrowserMainParts(const MainFunctionParams& parameters); - virtual void PreMainMessageLoopRun() OVERRIDE; - int PreMainMessageLoopRunInternal(); - virtual void MainMessageLoopRun() OVERRIDE; - virtual void PostMainMessageLoopRun() OVERRIDE; + // content::BrowserParts overrides + virtual void PreEarlyInitialization() OVERRIDE {} + virtual void PostEarlyInitialization() OVERRIDE {} + virtual void PreMainMessageLoopStart() OVERRIDE {} virtual void ToolkitInitialized() OVERRIDE; + virtual void PostMainMessageLoopStart() OVERRIDE {} + virtual void PreMainMessageLoopRun() OVERRIDE; + virtual bool MainMessageLoopRun(int* result_code) OVERRIDE; + virtual void PostMainMessageLoopRun(); + + // Displays a warning message that we can't find any locale data files. + virtual void ShowMissingLocaleMessageBox() = 0; private: // Methods for |EarlyInitialization()| --------------------------------------- @@ -89,8 +103,16 @@ class ChromeBrowserMainParts : public content::BrowserMainParts { void SetupFieldTrials(bool metrics_recording_enabled, bool proxy_policy_is_set); + // Methods for Main Message Loop ------------------------------------------- + + int PreMainMessageLoopRunImpl(); + // Members initialized on construction --------------------------------------- + const MainFunctionParams& parameters_; + const CommandLine& parsed_command_line_; + int result_code_; + // Create ShutdownWatcherHelper object for watching jank during shutdown. // Please keep |shutdown_watcher| as the first object constructed, and hence // it is destroyed last. @@ -138,9 +160,6 @@ void RecordBreakpadStatusUMA(MetricsService* metrics); // present on the current platform. void WarnAboutMinimumSystemRequirements(); -// Displays a warning message that we can't find any locale data files. -void ShowMissingLocaleMessageBox(); - // Records the time from our process' startup to the present time in // the UMA histogram |metric_name|. void RecordBrowserStartupTime(); diff --git a/chrome/browser/chrome_browser_main_aura.cc b/chrome/browser/chrome_browser_main_aura.cc deleted file mode 100644 index e795b38..0000000 --- a/chrome/browser/chrome_browser_main_aura.cc +++ /dev/null @@ -1,25 +0,0 @@ -// 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/chrome_browser_main_aura.h" - -#include "base/logging.h" - -ChromeBrowserMainPartsAura::ChromeBrowserMainPartsAura( - const MainFunctionParams& parameters) - : ChromeBrowserMainParts(parameters) { - NOTIMPLEMENTED(); -} - -void ChromeBrowserMainPartsAura::PreEarlyInitialization() { - NOTIMPLEMENTED(); -} - -void ChromeBrowserMainPartsAura::PostMainMessageLoopStart() { - NOTIMPLEMENTED(); -} - -void ShowMissingLocaleMessageBox() { - NOTIMPLEMENTED(); -} diff --git a/chrome/browser/chrome_browser_main_aura.h b/chrome/browser/chrome_browser_main_aura.h deleted file mode 100644 index 3b11d4e..0000000 --- a/chrome/browser/chrome_browser_main_aura.h +++ /dev/null @@ -1,21 +0,0 @@ -// 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_CHROME_BROWSER_MAIN_AURA_H_ -#define CHROME_BROWSER_CHROME_BROWSER_MAIN_AURA_H_ - -#include "chrome/browser/chrome_browser_main.h" - -class ChromeBrowserMainPartsAura : public ChromeBrowserMainParts { - public: - explicit ChromeBrowserMainPartsAura(const MainFunctionParams& parameters); - - virtual void PreEarlyInitialization() OVERRIDE; - virtual void PostMainMessageLoopStart() OVERRIDE; - - private: - DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainPartsAura); -}; - -#endif // CHROME_BROWSER_CHROME_BROWSER_MAIN_AURA_H_ diff --git a/chrome/browser/chrome_browser_main_gtk.h b/chrome/browser/chrome_browser_main_gtk.h deleted file mode 100644 index e55e4fe..0000000 --- a/chrome/browser/chrome_browser_main_gtk.h +++ /dev/null @@ -1,25 +0,0 @@ -// 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. - -// Contains functions used by BrowserMain() that are gtk-specific. - -#ifndef CHROME_BROWSER_CHROME_BROWSER_MAIN_GTK_H_ -#define CHROME_BROWSER_CHROME_BROWSER_MAIN_GTK_H_ -#pragma once - -#include "base/compiler_specific.h" -#include "chrome/browser/chrome_browser_main_posix.h" -#include "chrome/browser/chrome_browser_main_x11.h" - -class ChromeBrowserMainPartsGtk : public ChromeBrowserMainPartsPosix { - public: - explicit ChromeBrowserMainPartsGtk(const MainFunctionParams& parameters); - - virtual void PreEarlyInitialization() OVERRIDE; - - private: - void DetectRunningAsRoot(); -}; - -#endif // CHROME_BROWSER_CHROME_BROWSER_MAIN_GTK_H_ diff --git a/chrome/browser/chrome_browser_main_linux.cc b/chrome/browser/chrome_browser_main_linux.cc new file mode 100644 index 0000000..8e595ee --- /dev/null +++ b/chrome/browser/chrome_browser_main_linux.cc @@ -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. + +#include "chrome/browser/chrome_browser_main_linux.h" + +#if defined(USE_AURA) +#include "chrome/browser/chrome_browser_parts_aura.h" +#endif +#if defined(TOOLKIT_USES_GTK) +#include "chrome/browser/chrome_browser_parts_gtk.h" +#endif + +ChromeBrowserMainPartsLinux::ChromeBrowserMainPartsLinux( + const MainFunctionParams& parameters) + : ChromeBrowserMainPartsPosix(parameters) { +} + +void ChromeBrowserMainPartsLinux::ShowMissingLocaleMessageBox() { +#if defined(USE_AURA) + ChromeBrowserPartsAura::ShowMessageBox( + chrome_browser::kMissingLocaleDataMessage); +#elif defined(TOOLKIT_USES_GTK) + ChromeBrowserPartsGtk::ShowMessageBox( + chrome_browser::kMissingLocaleDataMessage); +#else +#error "Need MessageBox implementation for linux without Aura or Gtk" +#endif +} diff --git a/chrome/browser/chrome_browser_main_linux.h b/chrome/browser/chrome_browser_main_linux.h new file mode 100644 index 0000000..80f3e55 --- /dev/null +++ b/chrome/browser/chrome_browser_main_linux.h @@ -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. + +// Contains functions used by BrowserMain() that are linux-specific. + +#ifndef CHROME_BROWSER_CHROME_BROWSER_MAIN_LINUX_H_ +#define CHROME_BROWSER_CHROME_BROWSER_MAIN_LINUX_H_ +#pragma once + +#include "base/compiler_specific.h" +#include "chrome/browser/chrome_browser_main_posix.h" + +class ChromeBrowserMainPartsLinux : public ChromeBrowserMainPartsPosix { + public: + explicit ChromeBrowserMainPartsLinux(const MainFunctionParams& parameters); + + // ChromeBrowserMainParts overrides. + virtual void ShowMissingLocaleMessageBox() OVERRIDE; +}; + +#endif // CHROME_BROWSER_CHROME_BROWSER_MAIN_LINUX_H_ diff --git a/chrome/browser/chrome_browser_main_mac.h b/chrome/browser/chrome_browser_main_mac.h index cf71045..2ba7e7b 100644 --- a/chrome/browser/chrome_browser_main_mac.h +++ b/chrome/browser/chrome_browser_main_mac.h @@ -12,9 +12,13 @@ class ChromeBrowserMainPartsMac : public ChromeBrowserMainPartsPosix { public: explicit ChromeBrowserMainPartsMac(const MainFunctionParams& parameters); + // BrowserParts overrides. virtual void PreEarlyInitialization() OVERRIDE; virtual void PreMainMessageLoopStart() OVERRIDE; + // ChromeBrowserMainParts overrides. + virtual void ShowMissingLocaleMessageBox() OVERRIDE; + // Perform platform-specific work that needs to be done after the main event // loop has ended. The embedder must be sure to call this. static void DidEndMainMessageLoop(); diff --git a/chrome/browser/chrome_browser_main_mac.mm b/chrome/browser/chrome_browser_main_mac.mm index fe7913d..99428ee 100644 --- a/chrome/browser/chrome_browser_main_mac.mm +++ b/chrome/browser/chrome_browser_main_mac.mm @@ -37,27 +37,12 @@ void WarnAboutMinimumSystemRequirements() { // Nothing to check for on Mac right now. } -void ShowMissingLocaleMessageBox() { - // Not called on Mac because we load the locale files differently. -} - // From browser_main_win.h, stubs until we figure out the right thing... int DoUninstallTasks(bool chrome_still_running) { return content::RESULT_CODE_NORMAL_EXIT; } -int HandleIconsCommands(const CommandLine& parsed_command_line) { - return 0; -} - -bool CheckMachineLevelInstall() { - return false; -} - -void PrepareRestartOnCrashEnviroment(const CommandLine& parsed_command_line) { -} - // ChromeBrowserMainPartsMac --------------------------------------------------- ChromeBrowserMainPartsMac::ChromeBrowserMainPartsMac( @@ -128,6 +113,11 @@ void ChromeBrowserMainPartsMac::PreMainMessageLoopStart() { setObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"]; } +void ChromeBrowserMainPartsMac::ShowMissingLocaleMessageBox() { + // Not called on Mac because we load the locale files differently. + NOTREACHED(); +} + void ChromeBrowserMainPartsMac::DidEndMainMessageLoop() { AppController* appController = [NSApp delegate]; [appController didEndMainMessageLoop]; diff --git a/chrome/browser/chrome_browser_main_unittest.cc b/chrome/browser/chrome_browser_main_unittest.cc index e3c99b7..9bcd07f 100644 --- a/chrome/browser/chrome_browser_main_unittest.cc +++ b/chrome/browser/chrome_browser_main_unittest.cc @@ -6,6 +6,7 @@ #include <vector> #include "base/command_line.h" #include "base/memory/scoped_ptr.h" +#include "base/memory/scoped_vector.h" #include "chrome/browser/chrome_browser_main.h" #include "chrome/browser/chrome_content_browser_client.h" #include "chrome/common/chrome_switches.h" @@ -34,30 +35,37 @@ TEST_F(BrowserMainTest, WarmConnectionFieldTrial_WarmestSocket) { scoped_ptr<MainFunctionParams> params( new MainFunctionParams(command_line_, *sandbox_init_wrapper_, NULL)); - scoped_ptr<content::BrowserMainParts> bw( - content::GetContentClient()->browser()->CreateBrowserMainParts( - *params)); - - ChromeBrowserMainParts* cbw = static_cast<ChromeBrowserMainParts*>(bw.get()); - cbw->WarmConnectionFieldTrial(); - - EXPECT_EQ(0, net::GetSocketReusePolicy()); + ScopedVector<content::BrowserMainParts> bwv; + content::GetContentClient()->browser()->CreateBrowserMainParts( + *params, &(bwv.get())); + ChromeBrowserMainParts* cbw = NULL; + if (bwv.size() >= 1) + cbw = static_cast<ChromeBrowserMainParts*>(bwv[0]); + EXPECT_TRUE(cbw); + if (cbw) { + cbw->WarmConnectionFieldTrial(); + EXPECT_EQ(0, net::GetSocketReusePolicy()); + } } TEST_F(BrowserMainTest, WarmConnectionFieldTrial_Random) { scoped_ptr<MainFunctionParams> params( new MainFunctionParams(command_line_, *sandbox_init_wrapper_, NULL)); - scoped_ptr<content::BrowserMainParts> bw( - content::GetContentClient()->browser()->CreateBrowserMainParts( - *params)); - ChromeBrowserMainParts* cbw = static_cast<ChromeBrowserMainParts*>(bw.get()); - - const int kNumRuns = 1000; - for (int i = 0; i < kNumRuns; i++) { - cbw->WarmConnectionFieldTrial(); - int val = net::GetSocketReusePolicy(); - EXPECT_LE(val, 2); - EXPECT_GE(val, 0); + ScopedVector<content::BrowserMainParts> bwv; + content::GetContentClient()->browser()->CreateBrowserMainParts( + *params, &(bwv.get())); + ChromeBrowserMainParts* cbw = NULL; + if (bwv.size() >= 1) + cbw = static_cast<ChromeBrowserMainParts*>(bwv[0]); + EXPECT_TRUE(cbw); + if (cbw) { + const int kNumRuns = 1000; + for (int i = 0; i < kNumRuns; i++) { + cbw->WarmConnectionFieldTrial(); + int val = net::GetSocketReusePolicy(); + EXPECT_LE(val, 2); + EXPECT_GE(val, 0); + } } } @@ -68,20 +76,25 @@ TEST_F(BrowserMainTest, WarmConnectionFieldTrial_Invalid) { new MainFunctionParams(command_line_, *sandbox_init_wrapper_, NULL)); // This test ends up launching a new process, and that doesn't initialize the // ContentClient interfaces. - scoped_ptr<content::BrowserMainParts> bw; + ScopedVector<content::BrowserMainParts> bwv; if (content::GetContentClient()) { - bw.reset(content::GetContentClient()->browser()->CreateBrowserMainParts( - *params)); + content::GetContentClient()->browser()->CreateBrowserMainParts( + *params, &(bwv.get())); } else { chrome::ChromeContentBrowserClient ccbc; - bw.reset(ccbc.CreateBrowserMainParts(*params)); + ccbc.CreateBrowserMainParts(*params, &(bwv.get())); } - ChromeBrowserMainParts* cbw = static_cast<ChromeBrowserMainParts*>(bw.get()); + ChromeBrowserMainParts* cbw = NULL; + if (bwv.size() >= 1) + cbw = static_cast<ChromeBrowserMainParts*>(bwv[0]); + EXPECT_TRUE(cbw); + if (cbw) { #if defined(NDEBUG) && defined(DCHECK_ALWAYS_ON) - EXPECT_DEATH(cbw->WarmConnectionFieldTrial(), - "Not a valid socket reuse policy group"); + EXPECT_DEATH(cbw->WarmConnectionFieldTrial(), + "Not a valid socket reuse policy group"); #else - EXPECT_DEBUG_DEATH(cbw->WarmConnectionFieldTrial(), - "Not a valid socket reuse policy group"); + EXPECT_DEBUG_DEATH(cbw->WarmConnectionFieldTrial(), + "Not a valid socket reuse policy group"); #endif + } } diff --git a/chrome/browser/chrome_browser_main_win.cc b/chrome/browser/chrome_browser_main_win.cc index f723969..6064a00 100644 --- a/chrome/browser/chrome_browser_main_win.cc +++ b/chrome/browser/chrome_browser_main_win.cc @@ -74,14 +74,6 @@ void WarnAboutMinimumSystemRequirements() { } } -#if !defined(USE_AURA) -void ShowMissingLocaleMessageBox() { - ui::MessageBox(NULL, ASCIIToUTF16(chrome_browser::kMissingLocaleDataMessage), - ASCIIToUTF16(chrome_browser::kMissingLocaleDataTitle), - MB_OK | MB_ICONERROR | MB_TOPMOST); -} -#endif - void RecordBrowserStartupTime() { // Calculate the time that has elapsed from our own process creation. FILETIME creation_time = {}; @@ -141,11 +133,23 @@ int DoUninstallTasks(bool chrome_still_running) { return ret; } -// Prepares the localized strings that are going to be displayed to -// the user if the browser process dies. These strings are stored in the -// environment block so they are accessible in the early stages of the -// chrome executable's lifetime. -void PrepareRestartOnCrashEnviroment(const CommandLine& parsed_command_line) { +// ChromeBrowserMainPartsWin --------------------------------------------------- + +ChromeBrowserMainPartsWin::ChromeBrowserMainPartsWin( + const MainFunctionParams& parameters) + : ChromeBrowserMainParts(parameters) { +} + +void ChromeBrowserMainPartsWin::PreMainMessageLoopStart() { + if (!parameters().ui_task) { + // Make sure that we know how to handle exceptions from the message loop. + InitializeWindowProcExceptions(); + } +} + +// static +void ChromeBrowserMainPartsWin::PrepareRestartOnCrashEnviroment( + const CommandLine& parsed_command_line) { // Clear this var so child processes don't show the dialog by default. scoped_ptr<base::Environment> env(base::Environment::Create()); env->UnSetVar(env_vars::kShowRestart); @@ -177,7 +181,9 @@ void PrepareRestartOnCrashEnviroment(const CommandLine& parsed_command_line) { env->SetVar(env_vars::kRestartInfo, UTF16ToUTF8(dlg_strings)); } -void RegisterApplicationRestart(const CommandLine& parsed_command_line) { +// static +void ChromeBrowserMainPartsWin::RegisterApplicationRestart( + const CommandLine& parsed_command_line) { DCHECK(base::win::GetVersion() >= base::win::VERSION_VISTA); base::ScopedNativeLibrary library(FilePath(L"kernel32.dll")); // Get the function pointer for RegisterApplicationRestart. @@ -207,11 +213,15 @@ void RegisterApplicationRestart(const CommandLine& parsed_command_line) { DCHECK(SUCCEEDED(hr)) << "RegisterApplicationRestart failed."; } -// This method handles the --hide-icons and --show-icons command line options -// for chrome that get triggered by Windows from registry entries -// HideIconsCommand & ShowIconsCommand. Chrome doesn't support hide icons -// functionality so we just ask the users if they want to uninstall Chrome. -int HandleIconsCommands(const CommandLine& parsed_command_line) { +void ChromeBrowserMainPartsWin::ShowMissingLocaleMessageBox() { + ui::MessageBox(NULL, ASCIIToUTF16(chrome_browser::kMissingLocaleDataMessage), + ASCIIToUTF16(chrome_browser::kMissingLocaleDataTitle), + MB_OK | MB_ICONERROR | MB_TOPMOST); +} + +// static +int ChromeBrowserMainPartsWin::HandleIconsCommands( + const CommandLine& parsed_command_line) { if (parsed_command_line.HasSwitch(switches::kHideIcons)) { string16 cp_applet; base::win::Version version = base::win::GetVersion(); @@ -237,11 +247,8 @@ int HandleIconsCommands(const CommandLine& parsed_command_line) { return chrome::RESULT_CODE_UNSUPPORTED_PARAM; } -// Check if there is any machine level Chrome installed on the current -// machine. If yes and the current Chrome process is user level, we do not -// allow the user level Chrome to run. So we notify the user and uninstall -// user level Chrome. -bool CheckMachineLevelInstall() { +// static +bool ChromeBrowserMainPartsWin::CheckMachineLevelInstall() { // TODO(tommi): Check if using the default distribution is always the right // thing to do. BrowserDistribution* dist = BrowserDistribution::GetDistribution(); @@ -270,17 +277,3 @@ bool CheckMachineLevelInstall() { } return false; } - -// ChromeBrowserMainPartsWin --------------------------------------------------- - -ChromeBrowserMainPartsWin::ChromeBrowserMainPartsWin( - const MainFunctionParams& parameters) - : ChromeBrowserMainParts(parameters) { -} - -void ChromeBrowserMainPartsWin::PreMainMessageLoopStart() { - if (!parameters().ui_task) { - // Make sure that we know how to handle exceptions from the message loop. - InitializeWindowProcExceptions(); - } -} diff --git a/chrome/browser/chrome_browser_main_win.h b/chrome/browser/chrome_browser_main_win.h index c866211..f54f557 100644 --- a/chrome/browser/chrome_browser_main_win.h +++ b/chrome/browser/chrome_browser_main_win.h @@ -17,33 +17,39 @@ class CommandLine; // user to close the other chrome instance. int DoUninstallTasks(bool chrome_still_running); -// Prepares the localized strings that are going to be displayed to -// the user if the browser process dies. These strings are stored in the -// environment block so they are accessible in the early stages of the -// chrome executable's lifetime. -void PrepareRestartOnCrashEnviroment(const CommandLine& parsed_command_line); - -// Registers Chrome with the Windows Restart Manager, which will restore the -// Chrome session when the computer is restarted after a system update. -void RegisterApplicationRestart(const CommandLine& parsed_command_line); - -// This method handles the --hide-icons and --show-icons command line options -// for chrome that get triggered by Windows from registry entries -// HideIconsCommand & ShowIconsCommand. Chrome doesn't support hide icons -// functionality so we just ask the users if they want to uninstall Chrome. -int HandleIconsCommands(const CommandLine& parsed_command_line); - -// Check if there is any machine level Chrome installed on the current -// machine. If yes and the current Chrome process is user level, we do not -// allow the user level Chrome to run. So we notify the user and uninstall -// user level Chrome. -bool CheckMachineLevelInstall(); - class ChromeBrowserMainPartsWin : public ChromeBrowserMainParts { public: explicit ChromeBrowserMainPartsWin(const MainFunctionParams& parameters); + // BrowserParts overrides. virtual void PreMainMessageLoopStart() OVERRIDE; + + // ChromeBrowserMainParts overrides. + virtual void ShowMissingLocaleMessageBox() OVERRIDE; + + // Prepares the localized strings that are going to be displayed to + // the user if the browser process dies. These strings are stored in the + // environment block so they are accessible in the early stages of the + // chrome executable's lifetime. + static void PrepareRestartOnCrashEnviroment( + const CommandLine& parsed_command_line); + + // Registers Chrome with the Windows Restart Manager, which will restore the + // Chrome session when the computer is restarted after a system update. + static void RegisterApplicationRestart( + const CommandLine& parsed_command_line); + + // This method handles the --hide-icons and --show-icons command line options + // for chrome that get triggered by Windows from registry entries + // HideIconsCommand & ShowIconsCommand. Chrome doesn't support hide icons + // functionality so we just ask the users if they want to uninstall Chrome. + static int HandleIconsCommands(const CommandLine& parsed_command_line); + + // Check if there is any machine level Chrome installed on the current + // machine. If yes and the current Chrome process is user level, we do not + // allow the user level Chrome to run. So we notify the user and uninstall + // user level Chrome. + static bool CheckMachineLevelInstall(); }; #endif // CHROME_BROWSER_CHROME_BROWSER_MAIN_WIN_H_ diff --git a/chrome/browser/chrome_browser_main_x11.cc b/chrome/browser/chrome_browser_main_x11.cc index adc8ae1..e7986f1 100644 --- a/chrome/browser/chrome_browser_main_x11.cc +++ b/chrome/browser/chrome_browser_main_x11.cc @@ -88,17 +88,6 @@ int DoUninstallTasks(bool chrome_still_running) { return content::RESULT_CODE_NORMAL_EXIT; } -int HandleIconsCommands(const CommandLine &parsed_command_line) { - return 0; -} - -bool CheckMachineLevelInstall() { - return false; -} - -void PrepareRestartOnCrashEnviroment(const CommandLine &parsed_command_line) { -} - void SetBrowserX11ErrorHandlers() { // Set up error handlers to make sure profile gets written if X server // goes away. diff --git a/chrome/browser/chrome_browser_parts_aura.cc b/chrome/browser/chrome_browser_parts_aura.cc new file mode 100644 index 0000000..5ebe45f --- /dev/null +++ b/chrome/browser/chrome_browser_parts_aura.cc @@ -0,0 +1,28 @@ +// 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/chrome_browser_parts_aura.h" + +#include "base/logging.h" + +ChromeBrowserPartsAura::ChromeBrowserPartsAura() + : content::BrowserMainParts() { +} + +void ChromeBrowserPartsAura::PreEarlyInitialization() { + NOTIMPLEMENTED(); +} + +bool ChromeBrowserPartsAura::MainMessageLoopRun(int* result_code) { + return false; +} + +void ChromeBrowserPartsAura::PostMainMessageLoopStart() { + NOTIMPLEMENTED(); +} + +void ChromeBrowserPartsAura::ShowMessageBox(const char* message) { + LOG(ERROR) << "ShowMessageBox (not implemented): " << message; + NOTIMPLEMENTED(); +} diff --git a/chrome/browser/chrome_browser_parts_aura.h b/chrome/browser/chrome_browser_parts_aura.h new file mode 100644 index 0000000..d2fdc70 --- /dev/null +++ b/chrome/browser/chrome_browser_parts_aura.h @@ -0,0 +1,31 @@ +// 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_CHROME_BROWSER_PARTS_AURA_H_ +#define CHROME_BROWSER_CHROME_BROWSER_PARTS_AURA_H_ + +#include "base/basictypes.h" +#include "base/compiler_specific.h" +#include "content/public/browser/browser_main_parts.h" + +class ChromeBrowserPartsAura : public content::BrowserMainParts { + public: + ChromeBrowserPartsAura(); + + virtual void PreEarlyInitialization() OVERRIDE; + virtual void PostEarlyInitialization() OVERRIDE {} + virtual void PreMainMessageLoopStart() OVERRIDE {} + virtual void ToolkitInitialized() OVERRIDE {} + virtual void PostMainMessageLoopStart() OVERRIDE; + virtual void PreMainMessageLoopRun() OVERRIDE {} + virtual bool MainMessageLoopRun(int* result_code) OVERRIDE; + virtual void PostMainMessageLoopRun() {} + + static void ShowMessageBox(const char* message); + + private: + DISALLOW_COPY_AND_ASSIGN(ChromeBrowserPartsAura); +}; + +#endif // CHROME_BROWSER_CHROME_BROWSER_PARTS_AURA_H_ diff --git a/chrome/browser/chrome_browser_main_gtk.cc b/chrome/browser/chrome_browser_parts_gtk.cc index abf3f7a..b51363f 100644 --- a/chrome/browser/chrome_browser_main_gtk.cc +++ b/chrome/browser/chrome_browser_parts_gtk.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chrome_browser_main_gtk.h" +#include "chrome/browser/chrome_browser_parts_gtk.h" #include <gtk/gtk.h> @@ -14,21 +14,22 @@ #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/gtk_util.h" -ChromeBrowserMainPartsGtk::ChromeBrowserMainPartsGtk( - const MainFunctionParams& parameters) - : ChromeBrowserMainPartsPosix(parameters) { +ChromeBrowserPartsGtk::ChromeBrowserPartsGtk() + : content::BrowserMainParts() { } -void ChromeBrowserMainPartsGtk::PreEarlyInitialization() { +void ChromeBrowserPartsGtk::PreEarlyInitialization() { DetectRunningAsRoot(); +} - ChromeBrowserMainPartsPosix::PreEarlyInitialization(); +bool ChromeBrowserPartsGtk::MainMessageLoopRun(int* result_code) { + return false; } -void ChromeBrowserMainPartsGtk::DetectRunningAsRoot() { +void ChromeBrowserPartsGtk::DetectRunningAsRoot() { if (geteuid() == 0) { const CommandLine& command_line = *CommandLine::ForCurrentProcess(); - if (parsed_command_line().HasSwitch(switches::kUserDataDir)) + if (command_line.HasSwitch(switches::kUserDataDir)) return; gfx::GtkInitFromCommandLine(command_line); @@ -66,18 +67,17 @@ void ChromeBrowserMainPartsGtk::DetectRunningAsRoot() { } } -void ShowMissingLocaleMessageBox() { +// static +void ChromeBrowserPartsGtk::ShowMessageBox(const char* message) { GtkWidget* dialog = gtk_message_dialog_new( NULL, static_cast<GtkDialogFlags>(0), GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "%s", - chrome_browser::kMissingLocaleDataMessage); - - gtk_window_set_title(GTK_WINDOW(dialog), - chrome_browser::kMissingLocaleDataTitle); + message); + gtk_window_set_title(GTK_WINDOW(dialog), message); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); } diff --git a/chrome/browser/chrome_browser_parts_gtk.h b/chrome/browser/chrome_browser_parts_gtk.h new file mode 100644 index 0000000..8a19321 --- /dev/null +++ b/chrome/browser/chrome_browser_parts_gtk.h @@ -0,0 +1,33 @@ +// 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. + +// Contains functions used by BrowserMain() that are gtk-specific. + +#ifndef CHROME_BROWSER_CHROME_BROWSER_PARTS_GTK_H_ +#define CHROME_BROWSER_CHROME_BROWSER_PARTS_GTK_H_ +#pragma once + +#include "base/compiler_specific.h" +#include "content/public/browser/browser_main_parts.h" + +class ChromeBrowserPartsGtk : public content::BrowserMainParts { + public: + ChromeBrowserPartsGtk(); + + virtual void PreEarlyInitialization() OVERRIDE; + virtual void PostEarlyInitialization() OVERRIDE {} + virtual void PreMainMessageLoopStart() OVERRIDE {} + virtual void ToolkitInitialized() OVERRIDE {} + virtual void PostMainMessageLoopStart() OVERRIDE {} + virtual void PreMainMessageLoopRun() OVERRIDE {} + virtual bool MainMessageLoopRun(int* result_code) OVERRIDE; + virtual void PostMainMessageLoopRun() {} + + static void ShowMessageBox(const char* message); + + private: + void DetectRunningAsRoot(); +}; + +#endif // CHROME_BROWSER_CHROME_BROWSER_PARTS_GTK_H_ diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 9789afd..d1651a8 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -68,6 +68,7 @@ #include "content/browser/tab_contents/tab_contents_view.h" #include "content/browser/worker_host/worker_process_host.h" #include "content/common/desktop_notification_messages.h" +#include "content/public/browser/browser_main_parts.h" #include "grit/generated_resources.h" #include "grit/ui_resources.h" #include "net/base/cookie_monster.h" @@ -75,16 +76,24 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" -#if defined(OS_CHROMEOS) -#include "chrome/browser/chromeos/chrome_browser_main_chromeos.h" -#elif defined(USE_AURA) -#include "chrome/browser/chrome_browser_main_aura.h" -#elif defined(OS_WIN) +#if defined(OS_WIN) #include "chrome/browser/chrome_browser_main_win.h" #elif defined(OS_MACOSX) #include "chrome/browser/chrome_browser_main_mac.h" -#elif defined(TOOLKIT_USES_GTK) -#include "chrome/browser/chrome_browser_main_gtk.h" +#elif defined(OS_CHROMEOS) +#include "chrome/browser/chromeos/chrome_browser_main_chromeos.h" +#elif defined(OS_LINUX) +#include "chrome/browser/chrome_browser_main_linux.h" +#elif defined(OS_POSIX) +#include "chrome/browser/chrome_browser_main_posix.h" +#endif + +#if defined(USE_AURA) +#include "chrome/browser/chrome_browser_parts_aura.h" +#endif + +#if defined(TOOLKIT_USES_GTK) +#include "chrome/browser/chrome_browser_parts_gtk.h" #endif #if defined(OS_LINUX) @@ -104,7 +113,6 @@ #include "chrome/browser/ui/crypto_module_password_dialog.h" #endif - #if defined(USE_AURA) || defined(TOUCH_UI) #include "chrome/browser/renderer_host/render_widget_host_view_views.h" #elif defined(OS_WIN) @@ -191,20 +199,31 @@ RenderProcessHostPrivilege GetProcessPrivilege( namespace chrome { -content::BrowserMainParts* ChromeContentBrowserClient::CreateBrowserMainParts( - const MainFunctionParams& parameters) { -#if defined(OS_CHROMEOS) - return new ChromeBrowserMainPartsChromeos(parameters); -#elif defined(USE_AURA) - return new ChromeBrowserMainPartsAura(parameters); -#elif defined(OS_WIN) - return new ChromeBrowserMainPartsWin(parameters); +void ChromeContentBrowserClient::CreateBrowserMainParts( + const MainFunctionParams& parameters, + std::vector<content::BrowserMainParts*>* parts_list) { + // Construct the Main browser parts based on the OS type. +#if defined(OS_WIN) + parts_list->push_back(new ChromeBrowserMainPartsWin(parameters)); #elif defined(OS_MACOSX) - return new ChromeBrowserMainPartsMac(parameters); -#elif defined(TOOLKIT_USES_GTK) - return new ChromeBrowserMainPartsGtk(parameters); + parts_list->push_back(new ChromeBrowserMainPartsMac(parameters)); +#elif defined(OS_CHROMEOS) + parts_list->push_back(new ChromeBrowserMainPartsChromeos(parameters)); +#elif defined(OS_LINUX) + parts_list->push_back(new ChromeBrowserMainPartsLinux(parameters)); +#elif defined(OS_POSIX) + parts_list->push_back(new ChromeBrowserMainPartsPosix(parameters)); #else - return NULL; + NOTREACHED(); + parts_list->push_back(new ChromeBrowserMainParts(parameters)); +#endif + + // Construct additional browser parts. +#if defined(USE_AURA) + parts_list->push_back(new ChromeBrowserPartsAura()); +#endif +#if defined(TOOLKIT_USES_GTK) + parts_list->push_back(new ChromeBrowserPartsGtk()); #endif } diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h index d8fb323..bb8d55a 100644 --- a/chrome/browser/chrome_content_browser_client.h +++ b/chrome/browser/chrome_content_browser_client.h @@ -15,8 +15,9 @@ namespace chrome { class ChromeContentBrowserClient : public content::ContentBrowserClient { public: - virtual content::BrowserMainParts* CreateBrowserMainParts( - const MainFunctionParams& parameters) OVERRIDE; + virtual void CreateBrowserMainParts( + const MainFunctionParams& parameters, + std::vector<content::BrowserMainParts*>* parts_list) OVERRIDE; virtual RenderWidgetHostView* CreateViewForWidget( RenderWidgetHost* widget) OVERRIDE; virtual TabContentsView* CreateTabContentsView( diff --git a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc index 6ac1340..88a3535 100644 --- a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc +++ b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc @@ -71,7 +71,7 @@ static base::LazyInstance<MessageLoopObserver> g_message_loop_observer( ChromeBrowserMainPartsChromeos::ChromeBrowserMainPartsChromeos( const MainFunctionParams& parameters) - : ChromeBrowserMainPartsBase(parameters) { + : ChromeBrowserMainPartsLinux(parameters) { } ChromeBrowserMainPartsChromeos::~ChromeBrowserMainPartsChromeos() { @@ -99,7 +99,7 @@ ChromeBrowserMainPartsChromeos::~ChromeBrowserMainPartsChromeos() { } void ChromeBrowserMainPartsChromeos::PreEarlyInitialization() { - ChromeBrowserMainPartsBase::PreEarlyInitialization(); + ChromeBrowserMainPartsLinux::PreEarlyInitialization(); if (parsed_command_line().HasSwitch(switches::kGuestSession)) { // Disable sync and extensions if we're in "browse without sign-in" mode. CommandLine* singleton_command_line = CommandLine::ForCurrentProcess(); @@ -110,7 +110,7 @@ void ChromeBrowserMainPartsChromeos::PreEarlyInitialization() { } void ChromeBrowserMainPartsChromeos::PreMainMessageLoopStart() { - ChromeBrowserMainPartsBase::PreMainMessageLoopStart(); + ChromeBrowserMainPartsLinux::PreMainMessageLoopStart(); // Initialize CrosLibrary only for the browser, unless running tests // (which do their own CrosLibrary setup). if (!parameters().ui_task) { @@ -125,7 +125,7 @@ void ChromeBrowserMainPartsChromeos::PreMainMessageLoopStart() { void ChromeBrowserMainPartsChromeos::PreMainMessageLoopRun() { // FILE thread is created in ChromeBrowserMainParts::PreMainMessageLoopRun(). - ChromeBrowserMainPartsBase::PreMainMessageLoopRun(); + ChromeBrowserMainPartsLinux::PreMainMessageLoopRun(); // Get the statistics provider instance here to start loading statistcs // on the background FILE thread. chromeos::system::StatisticsProvider::GetInstance(); diff --git a/chrome/browser/chromeos/chrome_browser_main_chromeos.h b/chrome/browser/chromeos/chrome_browser_main_chromeos.h index 2786642..790477f 100644 --- a/chrome/browser/chromeos/chrome_browser_main_chromeos.h +++ b/chrome/browser/chromeos/chrome_browser_main_chromeos.h @@ -6,24 +6,16 @@ #define CHROME_BROWSER_CHROMEOS_CHROME_BROWSER_MAIN_CHROMEOS_H_ #include "base/memory/scoped_ptr.h" -#if defined(TOOLKIT_USES_GTK) -#include "chrome/browser/chrome_browser_main_gtk.h" -typedef ChromeBrowserMainPartsGtk ChromeBrowserMainPartsBase; -#else -#include "chrome/browser/chrome_browser_main_posix.h" -#include "chrome/browser/chrome_browser_main_x11.h" -typedef ChromeBrowserMainPartsPosix ChromeBrowserMainPartsBase; -#endif +#include "chrome/browser/chrome_browser_main_linux.h" namespace chromeos { class BrightnessObserver; class SessionManagerObserver; } // namespace chromeos -class ChromeBrowserMainPartsChromeos : public ChromeBrowserMainPartsBase { +class ChromeBrowserMainPartsChromeos : public ChromeBrowserMainPartsLinux { public: explicit ChromeBrowserMainPartsChromeos(const MainFunctionParams& parameters); - virtual ~ChromeBrowserMainPartsChromeos(); virtual void PreEarlyInitialization() OVERRIDE; @@ -34,6 +26,7 @@ class ChromeBrowserMainPartsChromeos : public ChromeBrowserMainPartsBase { private: scoped_ptr<chromeos::BrightnessObserver> brightness_observer_; scoped_ptr<chromeos::SessionManagerObserver> session_manager_observer_; + DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainPartsChromeos); }; |