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

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

Issue 8822021: Revert 113071 - Revert 113047 - Make ExtensionService use ExtensionSet. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_preference_api.h" 5 #include "chrome/browser/extensions/extension_preference_api.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 dict->Set(kValue, transformer->BrowserToExtensionPref(pref->GetValue())); 309 dict->Set(kValue, transformer->BrowserToExtensionPref(pref->GetValue()));
310 if (incognito) { 310 if (incognito) {
311 ExtensionPrefs* ep = extension_service->extension_prefs(); 311 ExtensionPrefs* ep = extension_service->extension_prefs();
312 dict->SetBoolean(kIncognitoSpecific, 312 dict->SetBoolean(kIncognitoSpecific,
313 ep->HasIncognitoPrefValue(browser_pref)); 313 ep->HasIncognitoPrefValue(browser_pref));
314 } 314 }
315 315
316 ExtensionEventRouter* router = profile_->GetExtensionEventRouter(); 316 ExtensionEventRouter* router = profile_->GetExtensionEventRouter();
317 if (!router || !router->HasEventListener(event_name)) 317 if (!router || !router->HasEventListener(event_name))
318 return; 318 return;
319 const ExtensionList* extensions = extension_service->extensions(); 319 const ExtensionSet* extensions = extension_service->extensions();
320 for (ExtensionList::const_iterator it = extensions->begin(); 320 for (ExtensionSet::const_iterator it = extensions->begin();
321 it != extensions->end(); ++it) { 321 it != extensions->end(); ++it) {
322 std::string extension_id = (*it)->id(); 322 std::string extension_id = (*it)->id();
323 // TODO(bauerb): Only iterate over registered event listeners. 323 // TODO(bauerb): Only iterate over registered event listeners.
324 if (router->ExtensionHasEventListener(extension_id, event_name) && 324 if (router->ExtensionHasEventListener(extension_id, event_name) &&
325 (*it)->HasAPIPermission(permission) && 325 (*it)->HasAPIPermission(permission) &&
326 (!incognito || extension_service->CanCrossIncognito(*it))) { 326 (!incognito || extension_service->CanCrossIncognito(*it))) {
327 std::string level_of_control = 327 std::string level_of_control =
328 GetLevelOfControl(profile_, extension_id, browser_pref, incognito); 328 GetLevelOfControl(profile_, extension_id, browser_pref, incognito);
329 dict->SetString(kLevelOfControl, level_of_control); 329 dict->SetString(kLevelOfControl, level_of_control);
330 330
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 pref_key, &browser_pref, &permission)); 511 pref_key, &browser_pref, &permission));
512 if (!GetExtension()->HasAPIPermission(permission)) { 512 if (!GetExtension()->HasAPIPermission(permission)) {
513 error_ = ExtensionErrorUtils::FormatErrorMessage( 513 error_ = ExtensionErrorUtils::FormatErrorMessage(
514 keys::kPermissionErrorMessage, pref_key); 514 keys::kPermissionErrorMessage, pref_key);
515 return false; 515 return false;
516 } 516 }
517 ExtensionPrefs* prefs = profile_->GetExtensionService()->extension_prefs(); 517 ExtensionPrefs* prefs = profile_->GetExtensionService()->extension_prefs();
518 prefs->RemoveExtensionControlledPref(extension_id(), browser_pref, scope); 518 prefs->RemoveExtensionControlledPref(extension_id(), browser_pref, scope);
519 return true; 519 return true;
520 } 520 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_override_apitest.cc ('k') | chrome/browser/extensions/extension_process_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698