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

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

Issue 10407105: Improve error messaging of webRequest API in case of conflicts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Attempt to fix windows compilation Created 8 years, 2 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_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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 show_extensions_prompts_(true), 344 show_extensions_prompts_(true),
345 ready_(false), 345 ready_(false),
346 toolbar_model_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), 346 toolbar_model_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
347 menu_manager_(profile), 347 menu_manager_(profile),
348 app_notification_manager_( 348 app_notification_manager_(
349 new extensions::AppNotificationManager(profile)), 349 new extensions::AppNotificationManager(profile)),
350 event_routers_initialized_(false), 350 event_routers_initialized_(false),
351 update_once_all_providers_are_ready_(false), 351 update_once_all_providers_are_ready_(false),
352 app_sync_bundle_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), 352 app_sync_bundle_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
353 extension_sync_bundle_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), 353 extension_sync_bundle_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
354 extension_warnings_(profile),
355 app_shortcut_manager_(profile) { 354 app_shortcut_manager_(profile) {
356 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 355 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
357 356
358 // Figure out if extension installation should be enabled. 357 // Figure out if extension installation should be enabled.
359 if (command_line->HasSwitch(switches::kDisableExtensions) || 358 if (command_line->HasSwitch(switches::kDisableExtensions) ||
360 profile->GetPrefs()->GetBoolean(prefs::kDisableExtensions)) { 359 profile->GetPrefs()->GetBoolean(prefs::kDisableExtensions)) {
361 extensions_enabled_ = false; 360 extensions_enabled_ = false;
362 } 361 }
363 362
364 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, 363 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED,
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 817
819 static bool default_apps_trial_exists = 818 static bool default_apps_trial_exists =
820 base::FieldTrialList::TrialExists(kDefaultAppsTrialName); 819 base::FieldTrialList::TrialExists(kDefaultAppsTrialName);
821 if (default_apps_trial_exists) { 820 if (default_apps_trial_exists) {
822 UMA_HISTOGRAM_ENUMERATION( 821 UMA_HISTOGRAM_ENUMERATION(
823 base::FieldTrial::MakeName("Extensions.ExtensionUninstalled", 822 base::FieldTrial::MakeName("Extensions.ExtensionUninstalled",
824 kDefaultAppsTrialName), 823 kDefaultAppsTrialName),
825 1, 2); 824 1, 2);
826 } 825 }
827 826
828 // Uninstalling one extension might have solved the problems of others.
829 // Therefore, we clear warnings of this type for all extensions.
830 std::set<ExtensionWarningSet::WarningType> warnings;
831 extension_warnings_.GetWarningsAffectingExtension(extension_id, &warnings);
832 extension_warnings_.ClearWarnings(warnings);
833
834 return true; 827 return true;
835 } 828 }
836 829
837 bool ExtensionService::IsExtensionEnabled( 830 bool ExtensionService::IsExtensionEnabled(
838 const std::string& extension_id) const { 831 const std::string& extension_id) const {
839 if (extensions_.Contains(extension_id) || 832 if (extensions_.Contains(extension_id) ||
840 terminated_extensions_.Contains(extension_id)) { 833 terminated_extensions_.Contains(extension_id)) {
841 return true; 834 return true;
842 } 835 }
843 836
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 // for terminated extensions being disabled. 914 // for terminated extensions being disabled.
922 disabled_extensions_.Insert(make_scoped_refptr(extension)); 915 disabled_extensions_.Insert(make_scoped_refptr(extension));
923 if (extensions_.Contains(extension->id())) { 916 if (extensions_.Contains(extension->id())) {
924 extensions_.Remove(extension->id()); 917 extensions_.Remove(extension->id());
925 NotifyExtensionUnloaded(extension, extension_misc::UNLOAD_REASON_DISABLE); 918 NotifyExtensionUnloaded(extension, extension_misc::UNLOAD_REASON_DISABLE);
926 } else { 919 } else {
927 terminated_extensions_.Remove(extension->id()); 920 terminated_extensions_.Remove(extension->id());
928 } 921 }
929 922
930 SyncExtensionChangeIfNeeded(*extension); 923 SyncExtensionChangeIfNeeded(*extension);
931
932 // Deactivating one extension might have solved the problems of others.
933 // Therefore, we clear warnings of this type for all extensions.
934 std::set<ExtensionWarningSet::WarningType> warnings;
935 extension_warnings_.GetWarningsAffectingExtension(extension_id, &warnings);
936 extension_warnings_.ClearWarnings(warnings);
937 } 924 }
938 925
939 void ExtensionService::GrantPermissionsAndEnableExtension( 926 void ExtensionService::GrantPermissionsAndEnableExtension(
940 const Extension* extension, bool record_oauth2_grant) { 927 const Extension* extension, bool record_oauth2_grant) {
941 GrantPermissions(extension, record_oauth2_grant); 928 GrantPermissions(extension, record_oauth2_grant);
942 RecordPermissionMessagesHistogram( 929 RecordPermissionMessagesHistogram(
943 extension, "Extensions.Permissions_ReEnable"); 930 extension, "Extensions.Permissions_ReEnable");
944 extension_prefs_->SetDidExtensionEscalatePermissions(extension, false); 931 extension_prefs_->SetDidExtensionEscalatePermissions(extension, false);
945 EnableExtension(extension->id()); 932 EnableExtension(extension->id());
946 } 933 }
(...skipping 1797 matching lines...) Expand 10 before | Expand all | Expand 10 after
2744 // enabling them. 2731 // enabling them.
2745 if (Extension::IsExternalLocation(extension->location()) && 2732 if (Extension::IsExternalLocation(extension->location()) &&
2746 !extension_prefs_->IsExternalExtensionAcknowledged(extension->id())) { 2733 !extension_prefs_->IsExternalExtensionAcknowledged(extension->id())) {
2747 return false; 2734 return false;
2748 } 2735 }
2749 } 2736 }
2750 #endif 2737 #endif
2751 2738
2752 return true; 2739 return true;
2753 } 2740 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698