| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/extensions/extension_system.h" | 5 #include "chrome/browser/extensions/extension_system.h" |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 new ExtensionIconSource(profile_)); | 195 new ExtensionIconSource(profile_)); |
| 196 | 196 |
| 197 // Initialize extension event routers. Note that on Chrome OS, this will | 197 // Initialize extension event routers. Note that on Chrome OS, this will |
| 198 // not succeed if the user has not logged in yet, in which case the | 198 // not succeed if the user has not logged in yet, in which case the |
| 199 // event routers are initialized in LoginUtilsImpl::CompleteLogin instead. | 199 // event routers are initialized in LoginUtilsImpl::CompleteLogin instead. |
| 200 // The InitEventRouters call used to be in BrowserMain, because when bookmark | 200 // The InitEventRouters call used to be in BrowserMain, because when bookmark |
| 201 // import happened on first run, the bookmark bar was not being correctly | 201 // import happened on first run, the bookmark bar was not being correctly |
| 202 // initialized (see issue 40144). Now that bookmarks aren't imported and | 202 // initialized (see issue 40144). Now that bookmarks aren't imported and |
| 203 // the event routers need to be initialized for every profile individually, | 203 // the event routers need to be initialized for every profile individually, |
| 204 // initialize them with the extension service. | 204 // initialize them with the extension service. |
| 205 // If this profile is being created as part of the import process, never | 205 // If import is going to run in a separate process (the profile itself is on |
| 206 // initialize the event routers. If import is going to run in a separate | 206 // the main process), wait for import to finish before initializing the |
| 207 // process (the profile itself is on the main process), wait for import to | 207 // routers. |
| 208 // finish before initializing the routers. | 208 CHECK(!ProfileManager::IsImportProcess(*command_line)); |
| 209 if (!command_line->HasSwitch(switches::kImport) && | 209 if (g_browser_process->profile_manager()->will_import()) { |
| 210 !command_line->HasSwitch(switches::kImportFromFile)) { | 210 extension_service_->InitEventRoutersAfterImport(); |
| 211 if (g_browser_process->profile_manager()->will_import()) { | 211 } else { |
| 212 extension_service_->InitEventRoutersAfterImport(); | 212 extension_service_->InitEventRouters(); |
| 213 } else { | |
| 214 extension_service_->InitEventRouters(); | |
| 215 } | |
| 216 } | 213 } |
| 217 | 214 |
| 218 extension_warning_service_.reset(new ExtensionWarningService(profile_)); | 215 extension_warning_service_.reset(new ExtensionWarningService(profile_)); |
| 219 extension_warning_badge_service_.reset( | 216 extension_warning_badge_service_.reset( |
| 220 new ExtensionWarningBadgeService(profile_)); | 217 new ExtensionWarningBadgeService(profile_)); |
| 221 extension_warning_service_->AddObserver( | 218 extension_warning_service_->AddObserver( |
| 222 extension_warning_badge_service_.get()); | 219 extension_warning_badge_service_.get()); |
| 223 } | 220 } |
| 224 | 221 |
| 225 void ExtensionSystemImpl::Shared::Shutdown() { | 222 void ExtensionSystemImpl::Shared::Shutdown() { |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( | 424 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( |
| 428 const std::string& extension_id, | 425 const std::string& extension_id, |
| 429 const extension_misc::UnloadedExtensionReason reason) { | 426 const extension_misc::UnloadedExtensionReason reason) { |
| 430 BrowserThread::PostTask( | 427 BrowserThread::PostTask( |
| 431 BrowserThread::IO, FROM_HERE, | 428 BrowserThread::IO, FROM_HERE, |
| 432 base::Bind(&ExtensionInfoMap::RemoveExtension, info_map(), | 429 base::Bind(&ExtensionInfoMap::RemoveExtension, info_map(), |
| 433 extension_id, reason)); | 430 extension_id, reason)); |
| 434 } | 431 } |
| 435 | 432 |
| 436 } // namespace extensions | 433 } // namespace extensions |
| OLD | NEW |