OLD | NEW |
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" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 if (ep->CanExtensionControlPref(extension_id, browser_pref, incognito)) | 70 if (ep->CanExtensionControlPref(extension_id, browser_pref, incognito)) |
71 return kControllableByThisExtension; | 71 return kControllableByThisExtension; |
72 | 72 |
73 return kControlledByOtherExtensions; | 73 return kControlledByOtherExtensions; |
74 } | 74 } |
75 | 75 |
76 void DispatchEventToExtensions( | 76 void DispatchEventToExtensions( |
77 Profile* profile, | 77 Profile* profile, |
78 const std::string& event_name, | 78 const std::string& event_name, |
79 ListValue* args, | 79 ListValue* args, |
80 ExtensionAPIPermission::ID permission, | 80 extensions::APIPermission::ID permission, |
81 bool incognito, | 81 bool incognito, |
82 const std::string& browser_pref) { | 82 const std::string& browser_pref) { |
83 ExtensionEventRouter* router = profile->GetExtensionEventRouter(); | 83 ExtensionEventRouter* router = profile->GetExtensionEventRouter(); |
84 if (!router || !router->HasEventListener(event_name)) | 84 if (!router || !router->HasEventListener(event_name)) |
85 return; | 85 return; |
86 ExtensionService* extension_service = profile->GetExtensionService(); | 86 ExtensionService* extension_service = profile->GetExtensionService(); |
87 const ExtensionSet* extensions = extension_service->extensions(); | 87 const ExtensionSet* extensions = extension_service->extensions(); |
88 ExtensionPrefs* extension_prefs = extension_service->extension_prefs(); | 88 ExtensionPrefs* extension_prefs = extension_service->extension_prefs(); |
89 for (ExtensionSet::const_iterator it = extensions->begin(); | 89 for (ExtensionSet::const_iterator it = extensions->begin(); |
90 it != extensions->end(); ++it) { | 90 it != extensions->end(); ++it) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 } | 123 } |
124 } | 124 } |
125 | 125 |
126 router->DispatchEventToExtension( | 126 router->DispatchEventToExtension( |
127 extension_id, event_name, json_args, restrict_to_profile, GURL()); | 127 extension_id, event_name, json_args, restrict_to_profile, GURL()); |
128 } | 128 } |
129 } | 129 } |
130 } | 130 } |
131 | 131 |
132 } // namespace extension_preference_helpers | 132 } // namespace extension_preference_helpers |
OLD | NEW |