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/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 namespace { | 15 namespace { |
16 | 16 |
17 const char kIncognitoPersistent[] = "incognito_persistent"; | 17 const char kIncognitoPersistent[] = "incognito_persistent"; |
18 const char kIncognitoSessionOnly[] = "incognito_session_only"; | 18 const char kIncognitoSessionOnly[] = "incognito_session_only"; |
19 const char kRegular[] = "regular"; | 19 const char kRegular[] = "regular"; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 return kControlledByOtherExtensions; | 75 return kControlledByOtherExtensions; |
76 } | 76 } |
77 | 77 |
78 void DispatchEventToExtensions( | 78 void DispatchEventToExtensions( |
79 Profile* profile, | 79 Profile* profile, |
80 const std::string& event_name, | 80 const std::string& event_name, |
81 ListValue* args, | 81 ListValue* args, |
82 extensions::APIPermission::ID permission, | 82 extensions::APIPermission::ID permission, |
83 bool incognito, | 83 bool incognito, |
84 const std::string& browser_pref) { | 84 const std::string& browser_pref) { |
85 ExtensionEventRouter* router = profile->GetExtensionEventRouter(); | 85 extensions::EventRouter* router = profile->GetExtensionEventRouter(); |
86 if (!router || !router->HasEventListener(event_name)) | 86 if (!router || !router->HasEventListener(event_name)) |
87 return; | 87 return; |
88 ExtensionService* extension_service = profile->GetExtensionService(); | 88 ExtensionService* extension_service = profile->GetExtensionService(); |
89 const ExtensionSet* extensions = extension_service->extensions(); | 89 const ExtensionSet* extensions = extension_service->extensions(); |
90 extensions::ExtensionPrefs* extension_prefs = | 90 extensions::ExtensionPrefs* extension_prefs = |
91 extension_service->extension_prefs(); | 91 extension_service->extension_prefs(); |
92 for (ExtensionSet::const_iterator it = extensions->begin(); | 92 for (ExtensionSet::const_iterator it = extensions->begin(); |
93 it != extensions->end(); ++it) { | 93 it != extensions->end(); ++it) { |
94 std::string extension_id = (*it)->id(); | 94 std::string extension_id = (*it)->id(); |
95 // TODO(bauerb): Only iterate over registered event listeners. | 95 // TODO(bauerb): Only iterate over registered event listeners. |
(...skipping 30 matching lines...) Expand all Loading... |
126 } | 126 } |
127 } | 127 } |
128 | 128 |
129 router->DispatchEventToExtension( | 129 router->DispatchEventToExtension( |
130 extension_id, event_name, json_args, restrict_to_profile, GURL()); | 130 extension_id, event_name, json_args, restrict_to_profile, GURL()); |
131 } | 131 } |
132 } | 132 } |
133 } | 133 } |
134 | 134 |
135 } // namespace extension_preference_helpers | 135 } // namespace extension_preference_helpers |
OLD | NEW |