Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7666)

Unified Diff: chrome/browser/chrome_browser_main.cc

Issue 8488015: Revert 110327 - Add ChromeBrowserParts for non main parts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chrome_browser_main.h ('k') | chrome/browser/chrome_browser_main_extra_parts.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chrome_browser_main.cc
===================================================================
--- chrome/browser/chrome_browser_main.cc (revision 110349)
+++ chrome/browser/chrome_browser_main.cc (working copy)
@@ -32,7 +32,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_extra_parts.h"
#include "chrome/browser/defaults.h"
#include "chrome/browser/extensions/default_apps_trial.h"
#include "chrome/browser/extensions/extension_protocols.h"
@@ -559,6 +558,13 @@
}
}
+#else
+
+void OptionallyRunChromeOSLoginManager(const CommandLine& parsed_command_line,
+ Profile* profile) {
+ // Dummy empty function for non-ChromeOS builds to avoid extra ifdefs below.
+}
+
#endif // defined(OS_CHROMEOS)
#if defined(OS_MACOSX)
@@ -1160,38 +1166,23 @@
}
#endif
-// content::BrowserMainParts implementation ------------------------------------
-
void ChromeBrowserMainParts::PreEarlyInitialization() {
- for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
- chrome_extra_parts_[i]->PreEarlyInitialization();
}
void ChromeBrowserMainParts::PostEarlyInitialization() {
- for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
- chrome_extra_parts_[i]->PostEarlyInitialization();
}
void ChromeBrowserMainParts::ToolkitInitialized() {
- for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
- chrome_extra_parts_[i]->ToolkitInitialized();
}
void ChromeBrowserMainParts::PreMainMessageLoopStart() {
- for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
- chrome_extra_parts_[i]->PreMainMessageLoopStart();
}
void ChromeBrowserMainParts::PostMainMessageLoopStart() {
- for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
- chrome_extra_parts_[i]->PostMainMessageLoopStart();
}
void ChromeBrowserMainParts::PreMainMessageLoopRun() {
result_code_ = PreMainMessageLoopRunImpl();
-
- for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
- chrome_extra_parts_[i]->PreMainMessageLoopRun();
}
int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
@@ -1514,10 +1505,6 @@
SetBrowserX11ErrorHandlers();
#endif
- // Desktop construction occurs here, (required before profile creation).
- for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
- chrome_extra_parts_[i]->PostBrowserProcessInit();
-
// Profile creation ----------------------------------------------------------
#if defined(OS_CHROMEOS)
@@ -1583,11 +1570,6 @@
g_browser_process->browser_policy_connector()->SetUserPolicyTokenService(
profile_->GetTokenService());
}
-
- // Tests should be able to tune login manager before showing it.
- // Thus only show login manager in normal (non-testing) mode.
- if (!parameters().ui_task)
- OptionallyRunChromeOSLoginManager(parsed_command_line(), profile_);
#endif
#if !defined(OS_MACOSX)
@@ -1636,11 +1618,6 @@
}
#endif
- // TODO(stevenjb): Move ChromeOS login code into PostProfileInitialized().
- // (Requires making ChromeBrowserMainPartsChromeos a non "main" Parts).
- for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
- chrome_extra_parts_[i]->PostProfileInitialized();
-
// Show the First Run UI if this is the first time Chrome has been run on
// this computer, or we're being compelled to do so by a command line flag.
// Note that this be done _after_ the PrefService is initialized and all
@@ -1866,6 +1843,25 @@
NaClProcessHost::EarlyStartup();
#endif
+ run_message_loop_ = true;
+ return content::RESULT_CODE_NORMAL_EXIT;
+}
+
+// Called from MainMessageLoopRun().
+void ChromeBrowserMainParts::StartBrowserOrUITask() {
+ // Still initializing, so need to allow IO.
+ base::ThreadRestrictions::ScopedAllowIO allow_io;
+
+ // Set the notification UI manager after any desktop initialization in
+ // PreMainMessageLoopRun() is complete, and before starting the browser.
+ DesktopNotificationServiceFactory::GetForProfile(profile_)->SetUIManager(
+ g_browser_process->notification_ui_manager());
+
+ // Tests should be able to tune login manager before showing it.
+ // Thus only show login manager in normal (non-testing) mode.
+ if (!parameters().ui_task)
+ OptionallyRunChromeOSLoginManager(parsed_command_line(), profile_);
+
if (parameters().ui_task) {
// We are in test mode. Run one task and enter the main message loop.
#if defined(OS_MACOSX)
@@ -1935,13 +1931,18 @@
}
}
browser_init_.reset();
- return result_code_;
}
bool ChromeBrowserMainParts::MainMessageLoopRun(int* result_code) {
// Set the result code set in PreMainMessageLoopRun or set above.
*result_code = result_code_;
+ // TODO(stevenjb): Move this to another phase, and/or clean up
+ // PreMainMessageLoopRun() so that this can happen after desktop
+ // initilaization and before running the main loop.
+ if (run_message_loop_)
+ StartBrowserOrUITask();
+
if (!run_message_loop_)
return true; // Don't run the default message loop.
@@ -2063,19 +2064,8 @@
// to bypass this code. Perhaps we need a *final* hook that is called on all
// paths from content/browser/browser_main.
CHECK(MetricsService::UmaMetricsProperlyShutdown());
-
- for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
- chrome_extra_parts_[i]->PostMainMessageLoopRun();
}
-// Public members:
-
-void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) {
- chrome_extra_parts_.push_back(parts);
-}
-
-// Misc ------------------------------------------------------------------------
-
// This code is specific to the Windows-only PreReadExperiment field-trial.
void RecordPreReadExperimentTime(const char* name, base::TimeDelta time) {
DCHECK(name != NULL);
« no previous file with comments | « chrome/browser/chrome_browser_main.h ('k') | chrome/browser/chrome_browser_main_extra_parts.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698