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

Side by Side Diff: chrome/browser/extensions/extension_system.cc

Issue 14757022: Add a non-blocking "OneShotEvent" class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add a test for the behavior within a Post()ed callback Created 7 years, 7 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 autoupdate_enabled = 134 autoupdate_enabled =
135 !command_line->HasSwitch(chromeos::switches::kGuestSession); 135 !command_line->HasSwitch(chromeos::switches::kGuestSession);
136 #endif 136 #endif
137 extension_service_.reset(new ExtensionService( 137 extension_service_.reset(new ExtensionService(
138 profile_, 138 profile_,
139 CommandLine::ForCurrentProcess(), 139 CommandLine::ForCurrentProcess(),
140 profile_->GetPath().AppendASCII(extensions::kInstallDirectoryName), 140 profile_->GetPath().AppendASCII(extensions::kInstallDirectoryName),
141 ExtensionPrefs::Get(profile_), 141 ExtensionPrefs::Get(profile_),
142 blacklist_.get(), 142 blacklist_.get(),
143 autoupdate_enabled, 143 autoupdate_enabled,
144 extensions_enabled)); 144 extensions_enabled,
145 &ready_));
145 146
146 // These services must be registered before the ExtensionService tries to 147 // These services must be registered before the ExtensionService tries to
147 // load any extensions. 148 // load any extensions.
148 { 149 {
149 management_policy_.reset(new ManagementPolicy); 150 management_policy_.reset(new ManagementPolicy);
150 RegisterManagementPolicyProviders(); 151 RegisterManagementPolicyProviders();
151 } 152 }
152 153
153 bool skip_session_extensions = false; 154 bool skip_session_extensions = false;
154 #if defined(OS_CHROMEOS) 155 #if defined(OS_CHROMEOS)
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 } 403 }
403 404
404 ExtensionWarningService* ExtensionSystemImpl::warning_service() { 405 ExtensionWarningService* ExtensionSystemImpl::warning_service() {
405 return shared_->warning_service(); 406 return shared_->warning_service();
406 } 407 }
407 408
408 Blacklist* ExtensionSystemImpl::blacklist() { 409 Blacklist* ExtensionSystemImpl::blacklist() {
409 return shared_->blacklist(); 410 return shared_->blacklist();
410 } 411 }
411 412
413 const OneShotEvent& ExtensionSystemImpl::ready() const {
414 return shared_->ready();
415 }
416
412 void ExtensionSystemImpl::RegisterExtensionWithRequestContexts( 417 void ExtensionSystemImpl::RegisterExtensionWithRequestContexts(
413 const Extension* extension) { 418 const Extension* extension) {
414 base::Time install_time; 419 base::Time install_time;
415 if (extension->location() != Manifest::COMPONENT) { 420 if (extension->location() != Manifest::COMPONENT) {
416 install_time = ExtensionPrefs::Get(profile_)-> 421 install_time = ExtensionPrefs::Get(profile_)->
417 GetInstallTime(extension->id()); 422 GetInstallTime(extension->id());
418 } 423 }
419 bool incognito_enabled = 424 bool incognito_enabled =
420 extension_service()->IsIncognitoEnabled(extension->id()); 425 extension_service()->IsIncognitoEnabled(extension->id());
421 BrowserThread::PostTask( 426 BrowserThread::PostTask(
422 BrowserThread::IO, FROM_HERE, 427 BrowserThread::IO, FROM_HERE,
423 base::Bind(&ExtensionInfoMap::AddExtension, info_map(), 428 base::Bind(&ExtensionInfoMap::AddExtension, info_map(),
424 make_scoped_refptr(extension), install_time, 429 make_scoped_refptr(extension), install_time,
425 incognito_enabled)); 430 incognito_enabled));
426 } 431 }
427 432
428 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( 433 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts(
429 const std::string& extension_id, 434 const std::string& extension_id,
430 const extension_misc::UnloadedExtensionReason reason) { 435 const extension_misc::UnloadedExtensionReason reason) {
431 BrowserThread::PostTask( 436 BrowserThread::PostTask(
432 BrowserThread::IO, FROM_HERE, 437 BrowserThread::IO, FROM_HERE,
433 base::Bind(&ExtensionInfoMap::RemoveExtension, info_map(), 438 base::Bind(&ExtensionInfoMap::RemoveExtension, info_map(),
434 extension_id, reason)); 439 extension_id, reason));
435 } 440 }
436 441
437 } // namespace extensions 442 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_system.h ('k') | chrome/browser/extensions/test_extension_system.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698