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

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

Issue 10682007: Move PendingExtensionManager and PendingExtensionInfo into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Latest master for cq Created 8 years, 5 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
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_service.h" 5 #include "chrome/browser/extensions/extension_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 } 418 }
419 419
420 const ExtensionSet* ExtensionService::GenerateInstalledExtensionsSet() const { 420 const ExtensionSet* ExtensionService::GenerateInstalledExtensionsSet() const {
421 ExtensionSet* installed_extensions = new ExtensionSet(); 421 ExtensionSet* installed_extensions = new ExtensionSet();
422 installed_extensions->InsertAll(extensions_); 422 installed_extensions->InsertAll(extensions_);
423 installed_extensions->InsertAll(disabled_extensions_); 423 installed_extensions->InsertAll(disabled_extensions_);
424 installed_extensions->InsertAll(terminated_extensions_); 424 installed_extensions->InsertAll(terminated_extensions_);
425 return installed_extensions; 425 return installed_extensions;
426 } 426 }
427 427
428 PendingExtensionManager* ExtensionService::pending_extension_manager() { 428 extensions::PendingExtensionManager*
429 ExtensionService::pending_extension_manager() {
429 return &pending_extension_manager_; 430 return &pending_extension_manager_;
430 } 431 }
431 432
432 ExtensionService::~ExtensionService() { 433 ExtensionService::~ExtensionService() {
433 // No need to unload extensions here because they are profile-scoped, and the 434 // No need to unload extensions here because they are profile-scoped, and the
434 // profile is in the process of being deleted. 435 // profile is in the process of being deleted.
435 436
436 extensions::ProviderCollection::const_iterator i; 437 extensions::ProviderCollection::const_iterator i;
437 for (i = external_extension_providers_.begin(); 438 for (i = external_extension_providers_.begin();
438 i != external_extension_providers_.end(); ++i) { 439 i != external_extension_providers_.end(); ++i) {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 } 548 }
548 } 549 }
549 550
550 bool ExtensionService::UpdateExtension( 551 bool ExtensionService::UpdateExtension(
551 const std::string& id, 552 const std::string& id,
552 const FilePath& extension_path, 553 const FilePath& extension_path,
553 const GURL& download_url, 554 const GURL& download_url,
554 CrxInstaller** out_crx_installer) { 555 CrxInstaller** out_crx_installer) {
555 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 556 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
556 557
557 const PendingExtensionInfo* pending_extension_info = 558 const extensions::PendingExtensionInfo* pending_extension_info =
558 pending_extension_manager()->GetById(id); 559 pending_extension_manager()->GetById(id);
559 560
560 const Extension* extension = 561 const Extension* extension =
561 GetExtensionByIdInternal(id, true, true, false); 562 GetExtensionByIdInternal(id, true, true, false);
562 if (!pending_extension_info && !extension) { 563 if (!pending_extension_info && !extension) {
563 LOG(WARNING) << "Will not update extension " << id 564 LOG(WARNING) << "Will not update extension " << id
564 << " because it is not installed or pending"; 565 << " because it is not installed or pending";
565 // Delete extension_path since we're not creating a CrxInstaller 566 // Delete extension_path since we're not creating a CrxInstaller
566 // that would do it for us. 567 // that would do it for us.
567 if (!BrowserThread::PostTask( 568 if (!BrowserThread::PostTask(
(...skipping 1528 matching lines...) Expand 10 before | Expand all | Expand 10 after
2096 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 2097 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
2097 2098
2098 // Ensure extension is deleted unless we transfer ownership. 2099 // Ensure extension is deleted unless we transfer ownership.
2099 scoped_refptr<const Extension> scoped_extension(extension); 2100 scoped_refptr<const Extension> scoped_extension(extension);
2100 const std::string& id = extension->id(); 2101 const std::string& id = extension->id();
2101 // Extensions installed by policy can't be disabled. So even if a previous 2102 // Extensions installed by policy can't be disabled. So even if a previous
2102 // installation disabled the extension, make sure it is now enabled. 2103 // installation disabled the extension, make sure it is now enabled.
2103 bool initial_enable = 2104 bool initial_enable =
2104 !extension_prefs_->IsExtensionDisabled(id) || 2105 !extension_prefs_->IsExtensionDisabled(id) ||
2105 system_->management_policy()->MustRemainEnabled(extension, NULL); 2106 system_->management_policy()->MustRemainEnabled(extension, NULL);
2106 const PendingExtensionInfo* pending_extension_info = NULL; 2107 const extensions::PendingExtensionInfo* pending_extension_info = NULL;
2107 if ((pending_extension_info = pending_extension_manager()->GetById(id))) { 2108 if ((pending_extension_info = pending_extension_manager()->GetById(id))) {
2108 if (!pending_extension_info->ShouldAllowInstall(*extension)) { 2109 if (!pending_extension_info->ShouldAllowInstall(*extension)) {
2109 pending_extension_manager()->Remove(id); 2110 pending_extension_manager()->Remove(id);
2110 2111
2111 LOG(WARNING) 2112 LOG(WARNING)
2112 << "ShouldAllowInstall() returned false for " 2113 << "ShouldAllowInstall() returned false for "
2113 << id << " of type " << extension->GetType() 2114 << id << " of type " << extension->GetType()
2114 << " and update URL " << extension->update_url().spec() 2115 << " and update URL " << extension->update_url().spec()
2115 << "; not installing"; 2116 << "; not installing";
2116 2117
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
2539 2540
2540 ExtensionService::NaClModuleInfoList::iterator 2541 ExtensionService::NaClModuleInfoList::iterator
2541 ExtensionService::FindNaClModule(const GURL& url) { 2542 ExtensionService::FindNaClModule(const GURL& url) {
2542 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); 2543 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin();
2543 iter != nacl_module_list_.end(); ++iter) { 2544 iter != nacl_module_list_.end(); ++iter) {
2544 if (iter->url == url) 2545 if (iter->url == url)
2545 return iter; 2546 return iter;
2546 } 2547 }
2547 return nacl_module_list_.end(); 2548 return nacl_module_list_.end();
2548 } 2549 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service.h ('k') | chrome/browser/extensions/extension_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698