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

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

Issue 195813007: Remove ExtensionService::IsExternalExtensionUninstalled() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 <iterator> 8 #include <iterator>
9 #include <set> 9 #include <set>
10 10
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 bool autoupdate_enabled, 351 bool autoupdate_enabled,
352 bool extensions_enabled, 352 bool extensions_enabled,
353 extensions::OneShotEvent* ready) 353 extensions::OneShotEvent* ready)
354 : extensions::Blacklist::Observer(blacklist), 354 : extensions::Blacklist::Observer(blacklist),
355 profile_(profile), 355 profile_(profile),
356 system_(extensions::ExtensionSystem::Get(profile)), 356 system_(extensions::ExtensionSystem::Get(profile)),
357 extension_prefs_(extension_prefs), 357 extension_prefs_(extension_prefs),
358 blacklist_(blacklist), 358 blacklist_(blacklist),
359 extension_sync_service_(NULL), 359 extension_sync_service_(NULL),
360 registry_(extensions::ExtensionRegistry::Get(profile)), 360 registry_(extensions::ExtensionRegistry::Get(profile)),
361 pending_extension_manager_(*this), 361 pending_extension_manager_(*this, profile),
362 install_directory_(install_directory), 362 install_directory_(install_directory),
363 extensions_enabled_(extensions_enabled), 363 extensions_enabled_(extensions_enabled),
364 show_extensions_prompts_(true), 364 show_extensions_prompts_(true),
365 install_updates_when_idle_(true), 365 install_updates_when_idle_(true),
366 ready_(ready), 366 ready_(ready),
367 update_once_all_providers_are_ready_(false), 367 update_once_all_providers_are_ready_(false),
368 browser_terminating_(false), 368 browser_terminating_(false),
369 installs_delayed_for_gc_(false), 369 installs_delayed_for_gc_(false),
370 is_first_run_(false) { 370 is_first_run_(false) {
371 #if defined(OS_CHROMEOS) 371 #if defined(OS_CHROMEOS)
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 registry_->blacklisted_extensions().Contains(extension_id)) { 948 registry_->blacklisted_extensions().Contains(extension_id)) {
949 return false; 949 return false;
950 } 950 }
951 951
952 // If the extension hasn't been loaded yet, check the prefs for it. Assume 952 // If the extension hasn't been loaded yet, check the prefs for it. Assume
953 // enabled unless otherwise noted. 953 // enabled unless otherwise noted.
954 return !extension_prefs_->IsExtensionDisabled(extension_id) && 954 return !extension_prefs_->IsExtensionDisabled(extension_id) &&
955 !extension_prefs_->IsExternalExtensionUninstalled(extension_id); 955 !extension_prefs_->IsExternalExtensionUninstalled(extension_id);
956 } 956 }
957 957
958 bool ExtensionService::IsExternalExtensionUninstalled(
959 const std::string& extension_id) const {
960 return extension_prefs_->IsExternalExtensionUninstalled(extension_id);
961 }
962
963 void ExtensionService::EnableExtension(const std::string& extension_id) { 958 void ExtensionService::EnableExtension(const std::string& extension_id) {
964 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 959 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
965 960
966 if (IsExtensionEnabled(extension_id)) 961 if (IsExtensionEnabled(extension_id))
967 return; 962 return;
968 const Extension* extension = 963 const Extension* extension =
969 registry_->disabled_extensions().GetByID(extension_id); 964 registry_->disabled_extensions().GetByID(extension_id);
970 965
971 ManagementPolicy* policy = system_->management_policy(); 966 ManagementPolicy* policy = system_->management_policy();
972 if (extension && policy->MustRemainDisabled(extension, NULL, NULL)) { 967 if (extension && policy->MustRemainDisabled(extension, NULL, NULL)) {
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after
2131 NOTREACHED(); 2126 NOTREACHED();
2132 } 2127 }
2133 return; 2128 return;
2134 } 2129 }
2135 2130
2136 pending_extension_manager()->Remove(id); 2131 pending_extension_manager()->Remove(id);
2137 } else { 2132 } else {
2138 // We explicitly want to re-enable an uninstalled external 2133 // We explicitly want to re-enable an uninstalled external
2139 // extension; if we're here, that means the user is manually 2134 // extension; if we're here, that means the user is manually
2140 // installing the extension. 2135 // installing the extension.
2141 if (IsExternalExtensionUninstalled(id)) { 2136 if (extension_prefs_->IsExternalExtensionUninstalled(id)) {
2142 initial_enable = true; 2137 initial_enable = true;
2143 } 2138 }
2144 } 2139 }
2145 2140
2146 // Unsupported requirements overrides the management policy. 2141 // Unsupported requirements overrides the management policy.
2147 if (has_requirement_errors) { 2142 if (has_requirement_errors) {
2148 initial_enable = false; 2143 initial_enable = false;
2149 extension_prefs_->AddDisableReason( 2144 extension_prefs_->AddDisableReason(
2150 id, Extension::DISABLE_UNSUPPORTED_REQUIREMENT); 2145 id, Extension::DISABLE_UNSUPPORTED_REQUIREMENT);
2151 // If the extension was disabled because of unsupported requirements but 2146 // If the extension was disabled because of unsupported requirements but
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
2885 void ExtensionService::UnloadAllExtensionsInternal() { 2880 void ExtensionService::UnloadAllExtensionsInternal() {
2886 profile_->GetExtensionSpecialStoragePolicy()->RevokeRightsForAllExtensions(); 2881 profile_->GetExtensionSpecialStoragePolicy()->RevokeRightsForAllExtensions();
2887 2882
2888 registry_->ClearAll(); 2883 registry_->ClearAll();
2889 system_->runtime_data()->ClearAll(); 2884 system_->runtime_data()->ClearAll();
2890 2885
2891 // TODO(erikkay) should there be a notification for this? We can't use 2886 // TODO(erikkay) should there be a notification for this? We can't use
2892 // EXTENSION_UNLOADED since that implies that the extension has been disabled 2887 // EXTENSION_UNLOADED since that implies that the extension has been disabled
2893 // or uninstalled. 2888 // or uninstalled.
2894 } 2889 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698