OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_function_dispatcher.h" | 5 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
6 | 6 |
7 #include "base/process_util.h" | 7 #include "base/process_util.h" |
8 #include "base/singleton.h" | 8 #include "base/singleton.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/extensions/extension_bookmarks_module.h" | 10 #include "chrome/browser/extensions/extension_bookmarks_module.h" |
11 #include "chrome/browser/extensions/extension_bookmarks_module_constants.h" | 11 #include "chrome/browser/extensions/extension_bookmarks_module_constants.h" |
12 #include "chrome/browser/extensions/extension_function.h" | 12 #include "chrome/browser/extensions/extension_function.h" |
| 13 #include "chrome/browser/extensions/extension_i18n_api.h" |
13 #include "chrome/browser/extensions/extension_message_service.h" | 14 #include "chrome/browser/extensions/extension_message_service.h" |
14 #include "chrome/browser/extensions/extension_page_actions_module.h" | 15 #include "chrome/browser/extensions/extension_page_actions_module.h" |
15 #include "chrome/browser/extensions/extension_page_actions_module_constants.h" | 16 #include "chrome/browser/extensions/extension_page_actions_module_constants.h" |
16 #include "chrome/browser/extensions/extension_process_manager.h" | 17 #include "chrome/browser/extensions/extension_process_manager.h" |
17 #include "chrome/browser/extensions/extension_tabs_module.h" | 18 #include "chrome/browser/extensions/extension_tabs_module.h" |
18 #include "chrome/browser/extensions/extension_tabs_module_constants.h" | 19 #include "chrome/browser/extensions/extension_tabs_module_constants.h" |
19 #include "chrome/browser/extensions/extension_test_api.h" | 20 #include "chrome/browser/extensions/extension_test_api.h" |
20 #include "chrome/browser/extensions/extension_toolstrip_api.h" | 21 #include "chrome/browser/extensions/extension_toolstrip_api.h" |
21 #include "chrome/browser/profile.h" | 22 #include "chrome/browser/profile.h" |
22 #include "chrome/browser/renderer_host/render_process_host.h" | 23 #include "chrome/browser/renderer_host/render_process_host.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 }; | 63 }; |
63 | 64 |
64 FactoryRegistry* FactoryRegistry::instance() { | 65 FactoryRegistry* FactoryRegistry::instance() { |
65 return Singleton<FactoryRegistry>::get(); | 66 return Singleton<FactoryRegistry>::get(); |
66 } | 67 } |
67 | 68 |
68 void FactoryRegistry::ResetFunctions() { | 69 void FactoryRegistry::ResetFunctions() { |
69 // Register all functions here. | 70 // Register all functions here. |
70 | 71 |
71 namespace bookmarks = extension_bookmarks_module_constants; | 72 namespace bookmarks = extension_bookmarks_module_constants; |
| 73 namespace i18n = extension_i18n_api_functions; |
72 namespace page_actions = extension_page_actions_module_constants; | 74 namespace page_actions = extension_page_actions_module_constants; |
73 namespace tabs = extension_tabs_module_constants; | 75 namespace tabs = extension_tabs_module_constants; |
74 namespace test = extension_test_api_functions; | 76 namespace test = extension_test_api_functions; |
75 namespace toolstrip = extension_toolstrip_api_functions; | 77 namespace toolstrip = extension_toolstrip_api_functions; |
76 | 78 |
77 // Windows | 79 // Windows |
78 factories_[tabs::kGetWindowFunction] = | 80 factories_[tabs::kGetWindowFunction] = |
79 &NewExtensionFunction<GetWindowFunction>; | 81 &NewExtensionFunction<GetWindowFunction>; |
80 factories_[tabs::kGetCurrentWindowFunction] = | 82 factories_[tabs::kGetCurrentWindowFunction] = |
81 &NewExtensionFunction<GetCurrentWindowFunction>; | 83 &NewExtensionFunction<GetCurrentWindowFunction>; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 &NewExtensionFunction<MoveBookmarkFunction>; | 137 &NewExtensionFunction<MoveBookmarkFunction>; |
136 factories_[bookmarks::kUpdateBookmarkFunction] = | 138 factories_[bookmarks::kUpdateBookmarkFunction] = |
137 &NewExtensionFunction<UpdateBookmarkFunction>; | 139 &NewExtensionFunction<UpdateBookmarkFunction>; |
138 | 140 |
139 // Toolstrips. | 141 // Toolstrips. |
140 factories_[toolstrip::kExpandFunction] = | 142 factories_[toolstrip::kExpandFunction] = |
141 &NewExtensionFunction<ToolstripExpandFunction>; | 143 &NewExtensionFunction<ToolstripExpandFunction>; |
142 factories_[toolstrip::kCollapseFunction] = | 144 factories_[toolstrip::kCollapseFunction] = |
143 &NewExtensionFunction<ToolstripCollapseFunction>; | 145 &NewExtensionFunction<ToolstripCollapseFunction>; |
144 | 146 |
| 147 // I18N. |
| 148 factories_[i18n::kGetAcceptLanguagesFunction] = |
| 149 &NewExtensionFunction<GetAcceptLanguagesFunction>; |
| 150 |
145 // Test. | 151 // Test. |
146 factories_[test::kPassFunction] = | 152 factories_[test::kPassFunction] = |
147 &NewExtensionFunction<ExtensionTestPassFunction>; | 153 &NewExtensionFunction<ExtensionTestPassFunction>; |
148 factories_[test::kFailFunction] = | 154 factories_[test::kFailFunction] = |
149 &NewExtensionFunction<ExtensionTestFailFunction>; | 155 &NewExtensionFunction<ExtensionTestFailFunction>; |
150 factories_[test::kLogFunction] = | 156 factories_[test::kLogFunction] = |
151 &NewExtensionFunction<ExtensionTestLogFunction>; | 157 &NewExtensionFunction<ExtensionTestLogFunction>; |
152 } | 158 } |
153 | 159 |
154 void FactoryRegistry::GetAllNames(std::vector<std::string>* names) { | 160 void FactoryRegistry::GetAllNames(std::vector<std::string>* names) { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 } else { | 280 } else { |
275 NOTREACHED(); | 281 NOTREACHED(); |
276 base::KillProcess(render_view_host_->process()->process().handle(), | 282 base::KillProcess(render_view_host_->process()->process().handle(), |
277 ResultCodes::KILLED_BAD_MESSAGE, false); | 283 ResultCodes::KILLED_BAD_MESSAGE, false); |
278 } | 284 } |
279 } | 285 } |
280 | 286 |
281 Profile* ExtensionFunctionDispatcher::profile() { | 287 Profile* ExtensionFunctionDispatcher::profile() { |
282 return render_view_host_->process()->profile(); | 288 return render_view_host_->process()->profile(); |
283 } | 289 } |
OLD | NEW |