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

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

Issue 10649003: Move each permission classes to its own files in extensions/permissions (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase on HEAD 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_preference_helpers.h" 5 #include "chrome/browser/extensions/extension_preference_helpers.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/extensions/extension_event_router.h" 9 #include "chrome/browser/extensions/extension_event_router.h"
10 #include "chrome/browser/extensions/extension_prefs.h" 10 #include "chrome/browser/extensions/extension_prefs.h"
11 #include "chrome/browser/extensions/extension_service.h" 11 #include "chrome/browser/extensions/extension_service.h"
12 #include "chrome/browser/prefs/pref_service.h" 12 #include "chrome/browser/prefs/pref_service.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 14
15 using extensions::APIPermission;
16
15 namespace { 17 namespace {
16 18
17 const char kIncognitoPersistent[] = "incognito_persistent"; 19 const char kIncognitoPersistent[] = "incognito_persistent";
18 const char kIncognitoSessionOnly[] = "incognito_session_only"; 20 const char kIncognitoSessionOnly[] = "incognito_session_only";
19 const char kRegular[] = "regular"; 21 const char kRegular[] = "regular";
20 const char kRegularOnly[] = "regular_only"; 22 const char kRegularOnly[] = "regular_only";
21 23
22 const char kLevelOfControlKey[] = "levelOfControl"; 24 const char kLevelOfControlKey[] = "levelOfControl";
23 25
24 const char kNotControllable[] = "not_controllable"; 26 const char kNotControllable[] = "not_controllable";
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 if (ep->CanExtensionControlPref(extension_id, browser_pref, incognito)) 67 if (ep->CanExtensionControlPref(extension_id, browser_pref, incognito))
66 return kControllableByThisExtension; 68 return kControllableByThisExtension;
67 69
68 return kControlledByOtherExtensions; 70 return kControlledByOtherExtensions;
69 } 71 }
70 72
71 void DispatchEventToExtensions( 73 void DispatchEventToExtensions(
72 Profile* profile, 74 Profile* profile,
73 const std::string& event_name, 75 const std::string& event_name,
74 ListValue* args, 76 ListValue* args,
75 ExtensionAPIPermission::ID permission, 77 APIPermission::ID permission,
76 bool incognito, 78 bool incognito,
77 const std::string& browser_pref) { 79 const std::string& browser_pref) {
78 ExtensionEventRouter* router = profile->GetExtensionEventRouter(); 80 ExtensionEventRouter* router = profile->GetExtensionEventRouter();
79 if (!router || !router->HasEventListener(event_name)) 81 if (!router || !router->HasEventListener(event_name))
80 return; 82 return;
81 ExtensionService* extension_service = profile->GetExtensionService(); 83 ExtensionService* extension_service = profile->GetExtensionService();
82 const ExtensionSet* extensions = extension_service->extensions(); 84 const ExtensionSet* extensions = extension_service->extensions();
83 for (ExtensionSet::const_iterator it = extensions->begin(); 85 for (ExtensionSet::const_iterator it = extensions->begin();
84 it != extensions->end(); ++it) { 86 it != extensions->end(); ++it) {
85 std::string extension_id = (*it)->id(); 87 std::string extension_id = (*it)->id();
(...skipping 11 matching lines...) Expand all
97 99
98 std::string json_args; 100 std::string json_args;
99 base::JSONWriter::Write(args, &json_args); 101 base::JSONWriter::Write(args, &json_args);
100 router->DispatchEventToExtension( 102 router->DispatchEventToExtension(
101 extension_id, event_name, json_args, NULL, GURL()); 103 extension_id, event_name, json_args, NULL, GURL());
102 } 104 }
103 } 105 }
104 } 106 }
105 107
106 } // namespace extension_preference_helpers 108 } // namespace extension_preference_helpers
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698