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/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
144 !command_line->HasSwitch(chromeos::switches::kGuestSession); | 144 !command_line->HasSwitch(chromeos::switches::kGuestSession); |
145 #endif | 145 #endif |
146 extension_service_.reset(new ExtensionService( | 146 extension_service_.reset(new ExtensionService( |
147 profile_, | 147 profile_, |
148 CommandLine::ForCurrentProcess(), | 148 CommandLine::ForCurrentProcess(), |
149 profile_->GetPath().AppendASCII(ExtensionService::kInstallDirectoryName), | 149 profile_->GetPath().AppendASCII(ExtensionService::kInstallDirectoryName), |
150 extension_prefs_.get(), | 150 extension_prefs_.get(), |
151 blacklist_.get(), | 151 blacklist_.get(), |
152 autoupdate_enabled, | 152 autoupdate_enabled, |
153 extensions_enabled)); | 153 extensions_enabled)); |
154 extension_service_->ready().RunAfter( | |
155 FROM_HERE, base::Bind(&AsyncEvent::MarkHappened, ready_.AsWeakPtr())); | |
Matt Perry
2013/05/15 21:08:54
I think it will get confusing to have 2 "ready" si
Jeffrey Yasskin
2013/05/15 22:46:50
Ok, I've moved them into ExtensionSystem. They nee
| |
154 | 156 |
155 // These services must be registered before the ExtensionService tries to | 157 // These services must be registered before the ExtensionService tries to |
156 // load any extensions. | 158 // load any extensions. |
157 { | 159 { |
158 management_policy_.reset(new ManagementPolicy); | 160 management_policy_.reset(new ManagementPolicy); |
159 RegisterManagementPolicyProviders(); | 161 RegisterManagementPolicyProviders(); |
160 } | 162 } |
161 | 163 |
162 bool skip_session_extensions = false; | 164 bool skip_session_extensions = false; |
163 #if defined(OS_CHROMEOS) | 165 #if defined(OS_CHROMEOS) |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
429 } | 431 } |
430 | 432 |
431 ExtensionWarningService* ExtensionSystemImpl::warning_service() { | 433 ExtensionWarningService* ExtensionSystemImpl::warning_service() { |
432 return shared_->warning_service(); | 434 return shared_->warning_service(); |
433 } | 435 } |
434 | 436 |
435 Blacklist* ExtensionSystemImpl::blacklist() { | 437 Blacklist* ExtensionSystemImpl::blacklist() { |
436 return shared_->blacklist(); | 438 return shared_->blacklist(); |
437 } | 439 } |
438 | 440 |
441 const AsyncEvent& ExtensionSystemImpl::ready() const { | |
442 return shared_->ready(); | |
443 } | |
444 | |
439 void ExtensionSystemImpl::RegisterExtensionWithRequestContexts( | 445 void ExtensionSystemImpl::RegisterExtensionWithRequestContexts( |
440 const Extension* extension) { | 446 const Extension* extension) { |
441 base::Time install_time; | 447 base::Time install_time; |
442 if (extension->location() != Manifest::COMPONENT) { | 448 if (extension->location() != Manifest::COMPONENT) { |
443 install_time = extension_service()->extension_prefs()-> | 449 install_time = extension_service()->extension_prefs()-> |
444 GetInstallTime(extension->id()); | 450 GetInstallTime(extension->id()); |
445 } | 451 } |
446 bool incognito_enabled = | 452 bool incognito_enabled = |
447 extension_service()->IsIncognitoEnabled(extension->id()); | 453 extension_service()->IsIncognitoEnabled(extension->id()); |
448 BrowserThread::PostTask( | 454 BrowserThread::PostTask( |
449 BrowserThread::IO, FROM_HERE, | 455 BrowserThread::IO, FROM_HERE, |
450 base::Bind(&ExtensionInfoMap::AddExtension, info_map(), | 456 base::Bind(&ExtensionInfoMap::AddExtension, info_map(), |
451 make_scoped_refptr(extension), install_time, | 457 make_scoped_refptr(extension), install_time, |
452 incognito_enabled)); | 458 incognito_enabled)); |
453 } | 459 } |
454 | 460 |
455 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( | 461 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( |
456 const std::string& extension_id, | 462 const std::string& extension_id, |
457 const extension_misc::UnloadedExtensionReason reason) { | 463 const extension_misc::UnloadedExtensionReason reason) { |
458 BrowserThread::PostTask( | 464 BrowserThread::PostTask( |
459 BrowserThread::IO, FROM_HERE, | 465 BrowserThread::IO, FROM_HERE, |
460 base::Bind(&ExtensionInfoMap::RemoveExtension, info_map(), | 466 base::Bind(&ExtensionInfoMap::RemoveExtension, info_map(), |
461 extension_id, reason)); | 467 extension_id, reason)); |
462 } | 468 } |
463 | 469 |
464 } // namespace extensions | 470 } // namespace extensions |
OLD | NEW |