[email protected] | e0813a39 | 2011-02-01 22:57:25 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
[email protected] | bfdffe2b | 2009-04-24 22:05:35 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "chrome/browser/extensions/extension_function_dispatcher.h" |
| 6 | |
[email protected] | 745feedb | 2010-08-02 04:08:07 | [diff] [blame] | 7 | #include <map> |
| 8 | |
[email protected] | efd7599 | 2011-12-15 22:42:42 | [diff] [blame^] | 9 | #include "base/json/json_value_serializer.h" |
[email protected] | 3b63f8f4 | 2011-03-28 01:54:15 | [diff] [blame] | 10 | #include "base/memory/ref_counted.h" |
| 11 | #include "base/memory/singleton.h" |
[email protected] | bfdffe2b | 2009-04-24 22:05:35 | [diff] [blame] | 12 | #include "base/process_util.h" |
[email protected] | bfdffe2b | 2009-04-24 22:05:35 | [diff] [blame] | 13 | #include "base/values.h" |
[email protected] | 17d40f0 | 2010-07-01 01:18:06 | [diff] [blame] | 14 | #include "build/build_config.h" |
[email protected] | a692a95 | 2011-11-28 08:23:54 | [diff] [blame] | 15 | #include "chrome/browser/accessibility/accessibility_extension_api.h" |
[email protected] | 23d5f17 | 2011-10-25 05:49:53 | [diff] [blame] | 16 | #include "chrome/browser/bookmarks/bookmark_extension_api.h" |
| 17 | #include "chrome/browser/bookmarks/bookmark_manager_extension_api.h" |
[email protected] | cdcf6024 | 2011-11-04 15:53:43 | [diff] [blame] | 18 | #include "chrome/browser/download/download_extension_api.h" |
[email protected] | 55afeb5 | 2011-12-06 00:15:39 | [diff] [blame] | 19 | #include "chrome/browser/extensions/api/socket/socket_api.h" |
[email protected] | 912256b3 | 2009-09-18 09:47:35 | [diff] [blame] | 20 | #include "chrome/browser/extensions/execute_code_in_tab_function.h" |
[email protected] | efd7599 | 2011-12-15 22:42:42 | [diff] [blame^] | 21 | #include "chrome/browser/extensions/extension_activity_log.h" |
[email protected] | c1d05aa | 2011-06-28 02:07:30 | [diff] [blame] | 22 | #include "chrome/browser/extensions/extension_app_api.h" |
[email protected] | ec9ac0df | 2009-10-01 18:06:47 | [diff] [blame] | 23 | #include "chrome/browser/extensions/extension_browser_actions_api.h" |
[email protected] | cdcf6024 | 2011-11-04 15:53:43 | [diff] [blame] | 24 | #include "chrome/browser/extensions/extension_chrome_auth_private_api.h" |
[email protected] | 6093d74 | 2011-08-26 16:37:18 | [diff] [blame] | 25 | #include "chrome/browser/extensions/extension_clear_api.h" |
[email protected] | fa062426 | 2011-06-09 14:17:38 | [diff] [blame] | 26 | #include "chrome/browser/extensions/extension_content_settings_api.h" |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 27 | #include "chrome/browser/extensions/extension_context_menu_api.h" |
[email protected] | 898bbd3 | 2010-05-18 18:52:29 | [diff] [blame] | 28 | #include "chrome/browser/extensions/extension_cookies_api.h" |
[email protected] | 91ba331 | 2011-03-17 20:39:22 | [diff] [blame] | 29 | #include "chrome/browser/extensions/extension_debugger_api.h" |
[email protected] | bfdffe2b | 2009-04-24 22:05:35 | [diff] [blame] | 30 | #include "chrome/browser/extensions/extension_function.h" |
[email protected] | 2bb5130 | 2011-02-18 22:39:27 | [diff] [blame] | 31 | #include "chrome/browser/extensions/extension_i18n_api.h" |
[email protected] | 2f69b38 | 2011-02-19 00:34:25 | [diff] [blame] | 32 | #include "chrome/browser/extensions/extension_idle_api.h" |
[email protected] | cffd789 | 2010-08-26 17:43:28 | [diff] [blame] | 33 | #include "chrome/browser/extensions/extension_management_api.h" |
[email protected] | 438772df | 2010-02-26 18:08:43 | [diff] [blame] | 34 | #include "chrome/browser/extensions/extension_metrics_module.h" |
[email protected] | a65882c | 2010-11-12 15:15:09 | [diff] [blame] | 35 | #include "chrome/browser/extensions/extension_module.h" |
[email protected] | 56ad379 | 2010-05-28 17:45:33 | [diff] [blame] | 36 | #include "chrome/browser/extensions/extension_omnibox_api.h" |
[email protected] | f7f3a5f | 2009-05-01 22:02:34 | [diff] [blame] | 37 | #include "chrome/browser/extensions/extension_page_actions_module.h" |
[email protected] | 9e4430f | 2011-11-28 07:43:29 | [diff] [blame] | 38 | #include "chrome/browser/extensions/extension_page_capture_api.h" |
[email protected] | 902fd7b | 2011-07-27 18:42:31 | [diff] [blame] | 39 | #include "chrome/browser/extensions/extension_permissions_api.h" |
[email protected] | 598bbcc | 2011-02-24 10:03:25 | [diff] [blame] | 40 | #include "chrome/browser/extensions/extension_preference_api.h" |
[email protected] | 381162b | 2010-01-28 17:29:35 | [diff] [blame] | 41 | #include "chrome/browser/extensions/extension_processes_api.h" |
[email protected] | a9c23a5 | 2010-08-04 09:13:44 | [diff] [blame] | 42 | #include "chrome/browser/extensions/extension_proxy_api.h" |
[email protected] | 2f69b38 | 2011-02-19 00:34:25 | [diff] [blame] | 43 | #include "chrome/browser/extensions/extension_service.h" |
[email protected] | 8b8e7c9 | 2010-08-19 18:05:56 | [diff] [blame] | 44 | #include "chrome/browser/extensions/extension_sidebar_api.h" |
[email protected] | bfdffe2b | 2009-04-24 22:05:35 | [diff] [blame] | 45 | #include "chrome/browser/extensions/extension_tabs_module.h" |
[email protected] | 25fd1b2e | 2009-08-17 20:57:14 | [diff] [blame] | 46 | #include "chrome/browser/extensions/extension_test_api.h" |
[email protected] | 8abe0a3 | 2010-08-12 00:40:22 | [diff] [blame] | 47 | #include "chrome/browser/extensions/extension_tts_api.h" |
[email protected] | c63f2b7 | 2011-07-07 05:25:00 | [diff] [blame] | 48 | #include "chrome/browser/extensions/extension_tts_engine_api.h" |
[email protected] | c6e584c | 2011-05-18 11:58:44 | [diff] [blame] | 49 | #include "chrome/browser/extensions/extension_web_socket_proxy_private_api.h" |
[email protected] | 8f9d4eb | 2011-02-05 01:39:10 | [diff] [blame] | 50 | #include "chrome/browser/extensions/extension_web_ui.h" |
[email protected] | 557a51dd | 2011-07-26 12:17:11 | [diff] [blame] | 51 | #include "chrome/browser/extensions/extension_webnavigation_api.h" |
[email protected] | c41fe66 | 2011-02-15 01:19:26 | [diff] [blame] | 52 | #include "chrome/browser/extensions/extension_webrequest_api.h" |
[email protected] | 63cda0c | 2010-09-01 04:41:23 | [diff] [blame] | 53 | #include "chrome/browser/extensions/extension_webstore_private_api.h" |
[email protected] | d13950e | 2009-12-04 01:43:02 | [diff] [blame] | 54 | #include "chrome/browser/extensions/extensions_quota_service.h" |
[email protected] | a4f9892 | 2011-12-06 11:32:23 | [diff] [blame] | 55 | #include "chrome/browser/extensions/system/system_api.h" |
[email protected] | 83820d4 | 2011-11-12 22:03:11 | [diff] [blame] | 56 | #include "chrome/browser/extensions/process_map.h" |
[email protected] | ae7f1ba | 2011-11-28 23:07:31 | [diff] [blame] | 57 | #include "chrome/browser/extensions/settings/settings_api.h" |
[email protected] | ed2b100 | 2011-05-25 14:12:10 | [diff] [blame] | 58 | #include "chrome/browser/external_protocol/external_protocol_handler.h" |
[email protected] | d2e6bd6 | 2011-10-24 20:29:07 | [diff] [blame] | 59 | #include "chrome/browser/history/history_extension_api.h" |
[email protected] | 5eddc3e | 2011-10-26 04:33:31 | [diff] [blame] | 60 | #include "chrome/browser/history/top_sites_extension_api.h" |
[email protected] | cdcf6024 | 2011-11-04 15:53:43 | [diff] [blame] | 61 | #include "chrome/browser/infobars/infobar_extension_api.h" |
[email protected] | 8ecad5e | 2010-12-02 21:18:33 | [diff] [blame] | 62 | #include "chrome/browser/profiles/profile.h" |
[email protected] | c357acb4 | 2011-06-09 20:52:42 | [diff] [blame] | 63 | #include "chrome/browser/renderer_host/chrome_render_message_filter.h" |
[email protected] | 792556c | 2011-10-25 05:01:07 | [diff] [blame] | 64 | #include "chrome/browser/rlz/rlz_extension_api.h" |
[email protected] | b9971dc | 2011-11-11 15:50:43 | [diff] [blame] | 65 | #include "chrome/browser/speech/speech_input_extension_api.h" |
[email protected] | 71b73f0 | 2011-04-06 15:57:29 | [diff] [blame] | 66 | #include "chrome/browser/ui/browser_list.h" |
[email protected] | 00070c73 | 2011-04-09 15:31:33 | [diff] [blame] | 67 | #include "chrome/browser/ui/browser_window.h" |
[email protected] | 83820d4 | 2011-11-12 22:03:11 | [diff] [blame] | 68 | #include "chrome/common/extensions/api/extension_api.h" |
[email protected] | 44c49c9 | 2011-03-28 16:17:23 | [diff] [blame] | 69 | #include "chrome/common/extensions/extension_messages.h" |
[email protected] | 615d88f | 2011-12-13 01:47:44 | [diff] [blame] | 70 | #include "chrome/common/extensions/extension_set.h" |
[email protected] | 9c45b718 | 2009-08-04 16:44:43 | [diff] [blame] | 71 | #include "chrome/common/url_constants.h" |
[email protected] | 5de63471 | 2011-03-02 00:20:19 | [diff] [blame] | 72 | #include "content/browser/renderer_host/render_view_host.h" |
[email protected] | f82d57b5 | 2011-04-27 19:13:17 | [diff] [blame] | 73 | #include "ipc/ipc_message.h" |
| 74 | #include "ipc/ipc_message_macros.h" |
[email protected] | 939856a | 2010-08-24 20:29:02 | [diff] [blame] | 75 | #include "third_party/skia/include/core/SkBitmap.h" |
[email protected] | 615d88f | 2011-12-13 01:47:44 | [diff] [blame] | 76 | #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" |
[email protected] | bfdffe2b | 2009-04-24 22:05:35 | [diff] [blame] | 77 | |
[email protected] | 8f9d4eb | 2011-02-05 01:39:10 | [diff] [blame] | 78 | #if defined(TOOLKIT_VIEWS) |
| 79 | #include "chrome/browser/extensions/extension_input_api.h" |
| 80 | #endif |
[email protected] | d683385 | 2010-08-20 18:00:45 | [diff] [blame] | 81 | |
[email protected] | 9a2aebe0 | 2011-12-02 21:54:14 | [diff] [blame] | 82 | #if defined(OS_CHROMEOS) && defined(USE_VIRTUAL_KEYBOARD) |
[email protected] | 27072cad | 2011-05-09 19:46:40 | [diff] [blame] | 83 | #include "chrome/browser/extensions/extension_input_ui_api.h" |
| 84 | #endif |
| 85 | |
[email protected] | 61b55b6 | 2011-03-24 09:03:10 | [diff] [blame] | 86 | #if defined(OS_CHROMEOS) |
[email protected] | 8f42798 | 2011-12-13 23:40:23 | [diff] [blame] | 87 | #include "chrome/browser/extensions/api/terminal/terminal_private_api.h" |
[email protected] | 8baf0dbb | 2011-11-27 22:47:02 | [diff] [blame] | 88 | #include "chrome/browser/extensions/extension_file_browser_private_api.h" |
| 89 | #include "chrome/browser/extensions/extension_info_private_api_chromeos.h" |
| 90 | #include "chrome/browser/extensions/extension_input_ime_api.h" |
| 91 | #include "chrome/browser/extensions/extension_input_method_api.h" |
| 92 | #include "chrome/browser/extensions/extension_mediaplayer_private_api.h" |
[email protected] | 61b55b6 | 2011-03-24 09:03:10 | [diff] [blame] | 93 | #endif |
| 94 | |
[email protected] | 83820d4 | 2011-11-12 22:03:11 | [diff] [blame] | 95 | using extensions::ExtensionAPI; |
[email protected] | 615d88f | 2011-12-13 01:47:44 | [diff] [blame] | 96 | using WebKit::WebSecurityOrigin; |
[email protected] | 83820d4 | 2011-11-12 22:03:11 | [diff] [blame] | 97 | |
[email protected] | bfdffe2b | 2009-04-24 22:05:35 | [diff] [blame] | 98 | // FactoryRegistry ------------------------------------------------------------- |
| 99 | |
| 100 | namespace { |
| 101 | |
[email protected] | b83e460 | 2009-05-15 22:58:33 | [diff] [blame] | 102 | // Template for defining ExtensionFunctionFactory. |
| 103 | template<class T> |
| 104 | ExtensionFunction* NewExtensionFunction() { |
| 105 | return new T(); |
| 106 | } |
[email protected] | bfdffe2b | 2009-04-24 22:05:35 | [diff] [blame] | 107 | |
[email protected] | b83e460 | 2009-05-15 22:58:33 | [diff] [blame] | 108 | // Contains a list of all known extension functions and allows clients to |
| 109 | // create instances of them. |
[email protected] | bfdffe2b | 2009-04-24 22:05:35 | [diff] [blame] | 110 | class FactoryRegistry { |
| 111 | public: |
[email protected] | 8e8bb6d | 2010-12-13 08:18:55 | [diff] [blame] | 112 | static FactoryRegistry* GetInstance(); |
[email protected] | b83e460 | 2009-05-15 22:58:33 | [diff] [blame] | 113 | FactoryRegistry() { ResetFunctions(); } |
| 114 | |
| 115 | // Resets all functions to their default values. |
| 116 | void ResetFunctions(); |
| 117 | |
| 118 | // Adds all function names to 'names'. |
[email protected] | bfdffe2b | 2009-04-24 22:05:35 | [diff] [blame] | 119 | void GetAllNames(std::vector<std::string>* names); |
[email protected] | b83e460 | 2009-05-15 22:58:33 | [diff] [blame] | 120 | |
| 121 | // Allows overriding of specific functions (e.g. for testing). Functions |
| 122 | // must be previously registered. Returns true if successful. |
| 123 | bool OverrideFunction(const std::string& name, |
| 124 | ExtensionFunctionFactory factory); |
| 125 | |
| 126 | // Factory method for the ExtensionFunction registered as 'name'. |
[email protected] | bfdffe2b | 2009-04-24 22:05:35 | [diff] [blame] | 127 | ExtensionFunction* NewFunction(const std::string& name); |
| 128 | |
| 129 | private: |
[email protected] | 61424c06 | 2009-10-14 23:14:59 | [diff] [blame] | 130 | template<class T> |
| 131 | void RegisterFunction() { |
| 132 | factories_[T::function_name()] = &NewExtensionFunction<T>; |
| 133 | } |
| 134 | |
[email protected] | bfdffe2b | 2009-04-24 22:05:35 | [diff] [blame] | 135 | typedef std::map<std::string, ExtensionFunctionFactory> FactoryMap; |
| 136 | FactoryMap factories_; |
| 137 | }; |
| 138 | |
[email protected] | 8e8bb6d | 2010-12-13 08:18:55 | [diff] [blame] | 139 | FactoryRegistry* FactoryRegistry::GetInstance() { |
[email protected] | bfdffe2b | 2009-04-24 22:05:35 | [diff] [blame] | 140 | return Singleton<FactoryRegistry>::get(); |
| 141 | } |
| 142 | |
[email protected] | b83e460 | 2009-05-15 22:58:33 | [diff] [blame] | 143 | void FactoryRegistry::ResetFunctions() { |
[email protected] | bfdffe2b | 2009-04-24 22:05:35 | [diff] [blame] | 144 | // Register all functions here. |
| 145 | |
[email protected] | e515f5d | 2009-05-05 03:05:00 | [diff] [blame] | 146 | // Windows |
[email protected] | 61424c06 | 2009-10-14 23:14:59 | [diff] [blame] | 147 | RegisterFunction<GetWindowFunction>(); |
| 148 | RegisterFunction<GetCurrentWindowFunction>(); |
| 149 | RegisterFunction<GetLastFocusedWindowFunction>(); |
| 150 | RegisterFunction<GetAllWindowsFunction>(); |
| 151 | RegisterFunction<CreateWindowFunction>(); |
| 152 | RegisterFunction<UpdateWindowFunction>(); |
| 153 | RegisterFunction<RemoveWindowFunction>(); |
[email protected] | b83e460 | 2009-05-15 22:58:33 | [diff] [blame] | 154 | |
[email protected] | e515f5d | 2009-05-05 03:05:00 | [diff] [blame] | 155 | // Tabs |
[email protected] | 61424c06 | 2009-10-14 23:14:59 | [diff] [blame] | 156 | RegisterFunction<GetTabFunction>(); |
[email protected] | e3eafb29 | 2010-04-14 21:30:41 | [diff] [blame] | 157 | RegisterFunction<GetCurrentTabFunction>(); |
[email protected] | 61424c06 | 2009-10-14 23:14:59 | [diff] [blame] | 158 | RegisterFunction<GetSelectedTabFunction>(); |
| 159 | RegisterFunction<GetAllTabsInWindowFunction>(); |
[email protected] | 8c3495c | 2011-09-28 03:32:30 | [diff] [blame] | 160 | RegisterFunction<QueryTabsFunction>(); |
| 161 | RegisterFunction<HighlightTabsFunction>(); |
[email protected] | 61424c06 | 2009-10-14 23:14:59 | [diff] [blame] | 162 | RegisterFunction<CreateTabFunction>(); |
| 163 | RegisterFunction<UpdateTabFunction>(); |
[email protected] | 8c3495c | 2011-09-28 03:32:30 | [diff] [blame] | 164 | RegisterFunction<MoveTabsFunction>(); |
[email protected] | 5d93511 | 2011-09-07 09:24:54 | [diff] [blame] | 165 | RegisterFunction<ReloadTabFunction>(); |
[email protected] | 8c3495c | 2011-09-28 03:32:30 | [diff] [blame] | 166 | RegisterFunction<RemoveTabsFunction>(); |
[email protected] | 61424c06 | 2009-10-14 23:14:59 | [diff] [blame] | 167 | RegisterFunction<DetectTabLanguageFunction>(); |
| 168 | RegisterFunction<CaptureVisibleTabFunction>(); |
| 169 | RegisterFunction<TabsExecuteScriptFunction>(); |
| 170 | RegisterFunction<TabsInsertCSSFunction>(); |
[email protected] | bfdffe2b | 2009-04-24 22:05:35 | [diff] [blame] | 171 | |
[email protected] | f7f3a5f | 2009-05-01 22:02:34 | [diff] [blame] | 172 | // Page Actions. |
[email protected] | 61424c06 | 2009-10-14 23:14:59 | [diff] [blame] | 173 | RegisterFunction<EnablePageActionFunction>(); |
| 174 | RegisterFunction<DisablePageActionFunction>(); |
[email protected] | 744ef17 | 2009-10-16 21:53:46 | [diff] [blame] | 175 | RegisterFunction<PageActionShowFunction>(); |
| 176 | RegisterFunction<PageActionHideFunction>(); |
| 177 | RegisterFunction<PageActionSetIconFunction>(); |
| 178 | RegisterFunction<PageActionSetTitleFunction>(); |
[email protected] | e478d670 | 2010-01-28 00:10:29 | [diff] [blame] | 179 | RegisterFunction<PageActionSetPopupFunction>(); |
[email protected] | f7f3a5f | 2009-05-01 22:02:34 | [diff] [blame] | 180 | |
[email protected] | ec9ac0df | 2009-10-01 18:06:47 | [diff] [blame] | 181 | // Browser Actions. |
[email protected] | 61424c06 | 2009-10-14 23:14:59 | [diff] [blame] | 182 | RegisterFunction<BrowserActionSetIconFunction>(); |
[email protected] | 1288ba0 | 2009-10-15 00:02:24 | [diff] [blame] | 183 | RegisterFunction<BrowserActionSetTitleFunction>(); |
[email protected] | 61424c06 | 2009-10-14 23:14:59 | [diff] [blame] | 184 | RegisterFunction<BrowserActionSetBadgeTextFunction>(); |
| 185 | RegisterFunction<BrowserActionSetBadgeBackgroundColorFunction>(); |
[email protected] | 85ae959 | 2010-02-03 20:58:50 | [diff] [blame] | 186 | RegisterFunction<BrowserActionSetPopupFunction>(); |
[email protected] | ec9ac0df | 2009-10-01 18:06:47 | [diff] [blame] | 187 | |
[email protected] | 6093d74 | 2011-08-26 16:37:18 | [diff] [blame] | 188 | // Browsing Data. |
| 189 | RegisterFunction<ClearBrowsingDataFunction>(); |
[email protected] | 6b55790a | 2011-12-15 14:05:05 | [diff] [blame] | 190 | RegisterFunction<ClearAppCacheFunction>(); |
[email protected] | 6093d74 | 2011-08-26 16:37:18 | [diff] [blame] | 191 | RegisterFunction<ClearCacheFunction>(); |
| 192 | RegisterFunction<ClearCookiesFunction>(); |
| 193 | RegisterFunction<ClearDownloadsFunction>(); |
[email protected] | 6b55790a | 2011-12-15 14:05:05 | [diff] [blame] | 194 | RegisterFunction<ClearFileSystemsFunction>(); |
[email protected] | 6093d74 | 2011-08-26 16:37:18 | [diff] [blame] | 195 | RegisterFunction<ClearFormDataFunction>(); |
| 196 | RegisterFunction<ClearHistoryFunction>(); |
[email protected] | 6b55790a | 2011-12-15 14:05:05 | [diff] [blame] | 197 | RegisterFunction<ClearIndexedDBFunction>(); |
| 198 | RegisterFunction<ClearLocalStorageFunction>(); |
| 199 | RegisterFunction<ClearPluginDataFunction>(); |
[email protected] | 6093d74 | 2011-08-26 16:37:18 | [diff] [blame] | 200 | RegisterFunction<ClearPasswordsFunction>(); |
[email protected] | 6b55790a | 2011-12-15 14:05:05 | [diff] [blame] | 201 | RegisterFunction<ClearWebSQLFunction>(); |
[email protected] | 6093d74 | 2011-08-26 16:37:18 | [diff] [blame] | 202 | |
[email protected] | f7f3a5f | 2009-05-01 22:02:34 | [diff] [blame] | 203 | // Bookmarks. |
[email protected] | 61424c06 | 2009-10-14 23:14:59 | [diff] [blame] | 204 | RegisterFunction<GetBookmarksFunction>(); |
| 205 | RegisterFunction<GetBookmarkChildrenFunction>(); |
[email protected] | a3c94c71 | 2009-12-18 19:23:55 | [diff] [blame] | 206 | RegisterFunction<GetBookmarkRecentFunction>(); |
[email protected] | 61424c06 | 2009-10-14 23:14:59 | [diff] [blame] | 207 | RegisterFunction<GetBookmarkTreeFunction>(); |
[email protected] | 532a8c6 | 2011-06-03 21:30:01 | [diff] [blame] | 208 | RegisterFunction<GetBookmarkSubTreeFunction>(); |
[email protected] | 61424c06 | 2009-10-14 23:14:59 | [diff] [blame] | 209 | RegisterFunction<SearchBookmarksFunction>(); |
| 210 | RegisterFunction<RemoveBookmarkFunction>(); |
| 211 | RegisterFunction<RemoveTreeBookmarkFunction>(); |
| 212 | RegisterFunction<CreateBookmarkFunction>(); |
| 213 | RegisterFunction<MoveBookmarkFunction>(); |
| 214 | RegisterFunction<UpdateBookmarkFunction>(); |
[email protected] | 9c45b718 | 2009-08-04 16:44:43 | [diff] [blame] | 215 | |
[email protected] | f34e7963 | 2010-03-17 02:34:08 | [diff] [blame] | 216 | // Infobars. |
| 217 | RegisterFunction<ShowInfoBarFunction>(); |
| 218 | |
[email protected] | 9dd97bc | 2010-01-14 01:40:04 | [diff] [blame] | 219 | // BookmarkManager |
| 220 | RegisterFunction<CopyBookmarkManagerFunction>(); |
| 221 | RegisterFunction<CutBookmarkManagerFunction>(); |
| 222 | RegisterFunction<PasteBookmarkManagerFunction>(); |
[email protected] | 03b3bbf | 2010-01-29 23:54:57 | [diff] [blame] | 223 | RegisterFunction<CanPasteBookmarkManagerFunction>(); |
[email protected] | cb6cf79 | 2010-01-28 00:04:56 | [diff] [blame] | 224 | RegisterFunction<ImportBookmarksFunction>(); |
| 225 | RegisterFunction<ExportBookmarksFunction>(); |
[email protected] | d406e2e | 2010-01-30 21:45:18 | [diff] [blame] | 226 | RegisterFunction<SortChildrenBookmarkManagerFunction>(); |
[email protected] | 9dd97bc | 2010-01-14 01:40:04 | [diff] [blame] | 227 | RegisterFunction<BookmarkManagerGetStringsFunction>(); |
[email protected] | ced90ae1 | 2010-02-20 02:06:16 | [diff] [blame] | 228 | RegisterFunction<StartDragBookmarkManagerFunction>(); |
| 229 | RegisterFunction<DropBookmarkManagerFunction>(); |
[email protected] | 9b07185 | 2010-04-02 06:45:31 | [diff] [blame] | 230 | RegisterFunction<GetSubtreeBookmarkManagerFunction>(); |
[email protected] | 933ebbe | 2011-06-30 12:24:01 | [diff] [blame] | 231 | RegisterFunction<CanEditBookmarkManagerFunction>(); |
[email protected] | 9dd97bc | 2010-01-14 01:40:04 | [diff] [blame] | 232 | |
[email protected] | de768a83 | 2009-10-30 05:25:01 | [diff] [blame] | 233 | // History |
| 234 | RegisterFunction<AddUrlHistoryFunction>(); |
| 235 | RegisterFunction<DeleteAllHistoryFunction>(); |
| 236 | RegisterFunction<DeleteRangeHistoryFunction>(); |
| 237 | RegisterFunction<DeleteUrlHistoryFunction>(); |
| 238 | RegisterFunction<GetVisitsHistoryFunction>(); |
| 239 | RegisterFunction<SearchHistoryFunction>(); |
| 240 | |
[email protected] | f520541 | 2010-03-16 00:19:34 | [diff] [blame] | 241 | // Idle |
| 242 | RegisterFunction<ExtensionIdleQueryStateFunction>(); |
| 243 | |
[email protected] | 198bcfe | 2009-09-09 22:56:28 | [diff] [blame] | 244 | // I18N. |
[email protected] | 61424c06 | 2009-10-14 23:14:59 | [diff] [blame] | 245 | RegisterFunction<GetAcceptLanguagesFunction>(); |
[email protected] | 198bcfe | 2009-09-09 22:56:28 | [diff] [blame] | 246 | |
[email protected] | 381162b | 2010-01-28 17:29:35 | [diff] [blame] | 247 | // Processes. |
[email protected] | 8a661f8 | 2010-10-19 21:47:11 | [diff] [blame] | 248 | RegisterFunction<GetProcessIdForTabFunction>(); |
[email protected] | 381162b | 2010-01-28 17:29:35 | [diff] [blame] | 249 | |
[email protected] | 438772df | 2010-02-26 18:08:43 | [diff] [blame] | 250 | // Metrics. |
[email protected] | cf25e4d | 2010-03-12 21:19:34 | [diff] [blame] | 251 | RegisterFunction<MetricsRecordUserActionFunction>(); |
| 252 | RegisterFunction<MetricsRecordValueFunction>(); |
| 253 | RegisterFunction<MetricsRecordPercentageFunction>(); |
| 254 | RegisterFunction<MetricsRecordCountFunction>(); |
| 255 | RegisterFunction<MetricsRecordSmallCountFunction>(); |
| 256 | RegisterFunction<MetricsRecordMediumCountFunction>(); |
| 257 | RegisterFunction<MetricsRecordTimeFunction>(); |
| 258 | RegisterFunction<MetricsRecordMediumTimeFunction>(); |
| 259 | RegisterFunction<MetricsRecordLongTimeFunction>(); |
[email protected] | 438772df | 2010-02-26 18:08:43 | [diff] [blame] | 260 | |
[email protected] | 17d40f0 | 2010-07-01 01:18:06 | [diff] [blame] | 261 | // RLZ. |
| 262 | #if defined(OS_WIN) |
| 263 | RegisterFunction<RlzRecordProductEventFunction>(); |
| 264 | RegisterFunction<RlzGetAccessPointRlzFunction>(); |
[email protected] | 3a612be | 2010-07-17 03:11:21 | [diff] [blame] | 265 | RegisterFunction<RlzSendFinancialPingFunction>(); |
[email protected] | 17d40f0 | 2010-07-01 01:18:06 | [diff] [blame] | 266 | RegisterFunction<RlzClearProductStateFunction>(); |
| 267 | #endif |
| 268 | |
[email protected] | 898bbd3 | 2010-05-18 18:52:29 | [diff] [blame] | 269 | // Cookies. |
| 270 | RegisterFunction<GetCookieFunction>(); |
| 271 | RegisterFunction<GetAllCookiesFunction>(); |
| 272 | RegisterFunction<SetCookieFunction>(); |
| 273 | RegisterFunction<RemoveCookieFunction>(); |
| 274 | RegisterFunction<GetAllCookieStoresFunction>(); |
| 275 | |
[email protected] | 25fd1b2e | 2009-08-17 20:57:14 | [diff] [blame] | 276 | // Test. |
[email protected] | 61424c06 | 2009-10-14 23:14:59 | [diff] [blame] | 277 | RegisterFunction<ExtensionTestPassFunction>(); |
| 278 | RegisterFunction<ExtensionTestFailFunction>(); |
| 279 | RegisterFunction<ExtensionTestLogFunction>(); |
[email protected] | d13950e | 2009-12-04 01:43:02 | [diff] [blame] | 280 | RegisterFunction<ExtensionTestQuotaResetFunction>(); |
[email protected] | db7331a | 2010-02-25 22:10:50 | [diff] [blame] | 281 | RegisterFunction<ExtensionTestCreateIncognitoTabFunction>(); |
[email protected] | 745feedb | 2010-08-02 04:08:07 | [diff] [blame] | 282 | RegisterFunction<ExtensionTestSendMessageFunction>(); |
[email protected] | 761e716 | 2010-10-18 19:26:39 | [diff] [blame] | 283 | RegisterFunction<ExtensionTestGetConfigFunction>(); |
[email protected] | 5cbe1e2 | 2010-01-30 01:18:56 | [diff] [blame] | 284 | |
| 285 | // Accessibility. |
| 286 | RegisterFunction<GetFocusedControlFunction>(); |
| 287 | RegisterFunction<SetAccessibilityEnabledFunction>(); |
[email protected] | 44625595 | 2010-03-17 20:41:58 | [diff] [blame] | 288 | |
[email protected] | 8abe0a3 | 2010-08-12 00:40:22 | [diff] [blame] | 289 | // Text-to-speech. |
[email protected] | c63f2b7 | 2011-07-07 05:25:00 | [diff] [blame] | 290 | RegisterFunction<ExtensionTtsEngineSendTtsEventFunction>(); |
| 291 | RegisterFunction<ExtensionTtsGetVoicesFunction>(); |
| 292 | RegisterFunction<ExtensionTtsIsSpeakingFunction>(); |
[email protected] | 8abe0a3 | 2010-08-12 00:40:22 | [diff] [blame] | 293 | RegisterFunction<ExtensionTtsSpeakFunction>(); |
| 294 | RegisterFunction<ExtensionTtsStopSpeakingFunction>(); |
[email protected] | 8abe0a3 | 2010-08-12 00:40:22 | [diff] [blame] | 295 | |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 296 | // Context Menus. |
| 297 | RegisterFunction<CreateContextMenuFunction>(); |
[email protected] | 66dbfb2c | 2010-05-12 20:20:15 | [diff] [blame] | 298 | RegisterFunction<UpdateContextMenuFunction>(); |
[email protected] | 2e3b520 | 2010-03-23 06:52:41 | [diff] [blame] | 299 | RegisterFunction<RemoveContextMenuFunction>(); |
[email protected] | 66dbfb2c | 2010-05-12 20:20:15 | [diff] [blame] | 300 | RegisterFunction<RemoveAllContextMenusFunction>(); |
[email protected] | 56ad379 | 2010-05-28 17:45:33 | [diff] [blame] | 301 | |
| 302 | // Omnibox. |
| 303 | RegisterFunction<OmniboxSendSuggestionsFunction>(); |
[email protected] | 1bead071 | 2010-11-27 17:41:53 | [diff] [blame] | 304 | RegisterFunction<OmniboxSetDefaultSuggestionFunction>(); |
[email protected] | a9c23a5 | 2010-08-04 09:13:44 | [diff] [blame] | 305 | |
[email protected] | 8b8e7c9 | 2010-08-19 18:05:56 | [diff] [blame] | 306 | // Sidebar. |
| 307 | RegisterFunction<CollapseSidebarFunction>(); |
| 308 | RegisterFunction<ExpandSidebarFunction>(); |
| 309 | RegisterFunction<GetStateSidebarFunction>(); |
| 310 | RegisterFunction<HideSidebarFunction>(); |
| 311 | RegisterFunction<NavigateSidebarFunction>(); |
| 312 | RegisterFunction<SetBadgeTextSidebarFunction>(); |
| 313 | RegisterFunction<SetIconSidebarFunction>(); |
| 314 | RegisterFunction<SetTitleSidebarFunction>(); |
| 315 | RegisterFunction<ShowSidebarFunction>(); |
[email protected] | d683385 | 2010-08-20 18:00:45 | [diff] [blame] | 316 | |
[email protected] | e06a1fe | 2011-09-29 21:20:44 | [diff] [blame] | 317 | // Speech input. |
| 318 | RegisterFunction<StartSpeechInputFunction>(); |
| 319 | RegisterFunction<StopSpeechInputFunction>(); |
| 320 | RegisterFunction<IsRecordingSpeechInputFunction>(); |
| 321 | |
[email protected] | d683385 | 2010-08-20 18:00:45 | [diff] [blame] | 322 | #if defined(TOOLKIT_VIEWS) |
| 323 | // Input. |
| 324 | RegisterFunction<SendKeyboardEventInputFunction>(); |
| 325 | #endif |
[email protected] | cffd789 | 2010-08-26 17:43:28 | [diff] [blame] | 326 | |
[email protected] | 2cc81d3 | 2011-10-04 17:03:18 | [diff] [blame] | 327 | #if defined(USE_VIRTUAL_KEYBOARD) |
[email protected] | bcde748 | 2011-05-23 19:29:12 | [diff] [blame] | 328 | RegisterFunction<HideKeyboardFunction>(); |
[email protected] | 3c8faef | 2011-06-09 22:56:51 | [diff] [blame] | 329 | RegisterFunction<SetKeyboardHeightFunction>(); |
[email protected] | bcde748 | 2011-05-23 19:29:12 | [diff] [blame] | 330 | #endif |
| 331 | |
[email protected] | 14da67b0 | 2011-08-02 05:49:13 | [diff] [blame] | 332 | #if defined(OS_CHROMEOS) |
[email protected] | 27072cad | 2011-05-09 19:46:40 | [diff] [blame] | 333 | // IME |
[email protected] | 14da67b0 | 2011-08-02 05:49:13 | [diff] [blame] | 334 | RegisterFunction<SetCompositionFunction>(); |
| 335 | RegisterFunction<ClearCompositionFunction>(); |
| 336 | RegisterFunction<CommitTextFunction>(); |
| 337 | RegisterFunction<SetCandidateWindowPropertiesFunction>(); |
| 338 | RegisterFunction<SetCandidatesFunction>(); |
| 339 | RegisterFunction<SetCursorPositionFunction>(); |
| 340 | RegisterFunction<SetMenuItemsFunction>(); |
| 341 | RegisterFunction<UpdateMenuItemsFunction>(); |
[email protected] | cd0b04c9 | 2011-09-08 05:18:06 | [diff] [blame] | 342 | |
| 343 | RegisterFunction<InputEventHandled>(); |
[email protected] | 9a2aebe0 | 2011-12-02 21:54:14 | [diff] [blame] | 344 | #if defined(USE_VIRTUAL_KEYBOARD) |
[email protected] | 27072cad | 2011-05-09 19:46:40 | [diff] [blame] | 345 | RegisterFunction<CandidateClickedInputUiFunction>(); |
| 346 | RegisterFunction<CursorUpInputUiFunction>(); |
| 347 | RegisterFunction<CursorDownInputUiFunction>(); |
| 348 | RegisterFunction<PageUpInputUiFunction>(); |
| 349 | RegisterFunction<PageDownInputUiFunction>(); |
| 350 | RegisterFunction<RegisterInputUiFunction>(); |
| 351 | RegisterFunction<PageUpInputUiFunction>(); |
| 352 | RegisterFunction<PageDownInputUiFunction>(); |
| 353 | #endif |
[email protected] | 14da67b0 | 2011-08-02 05:49:13 | [diff] [blame] | 354 | #endif |
[email protected] | 27072cad | 2011-05-09 19:46:40 | [diff] [blame] | 355 | |
[email protected] | cffd789 | 2010-08-26 17:43:28 | [diff] [blame] | 356 | // Management. |
| 357 | RegisterFunction<GetAllExtensionsFunction>(); |
[email protected] | e78543c | 2010-11-08 22:05:23 | [diff] [blame] | 358 | RegisterFunction<GetExtensionByIdFunction>(); |
[email protected] | 925a54d | 2011-07-29 17:21:00 | [diff] [blame] | 359 | RegisterFunction<GetPermissionWarningsByIdFunction>(); |
| 360 | RegisterFunction<GetPermissionWarningsByManifestFunction>(); |
[email protected] | e558ff8 | 2010-09-23 20:19:56 | [diff] [blame] | 361 | RegisterFunction<LaunchAppFunction>(); |
[email protected] | cffd789 | 2010-08-26 17:43:28 | [diff] [blame] | 362 | RegisterFunction<SetEnabledFunction>(); |
[email protected] | cffd789 | 2010-08-26 17:43:28 | [diff] [blame] | 363 | RegisterFunction<UninstallFunction>(); |
[email protected] | 63cda0c | 2010-09-01 04:41:23 | [diff] [blame] | 364 | |
[email protected] | a65882c | 2010-11-12 15:15:09 | [diff] [blame] | 365 | // Extension module. |
| 366 | RegisterFunction<SetUpdateUrlDataFunction>(); |
[email protected] | c7c401d | 2011-03-16 10:20:01 | [diff] [blame] | 367 | RegisterFunction<IsAllowedIncognitoAccessFunction>(); |
| 368 | RegisterFunction<IsAllowedFileSchemeAccessFunction>(); |
[email protected] | a65882c | 2010-11-12 15:15:09 | [diff] [blame] | 369 | |
[email protected] | 63cda0c | 2010-09-01 04:41:23 | [diff] [blame] | 370 | // WebstorePrivate. |
[email protected] | d688559 | 2010-10-11 19:38:24 | [diff] [blame] | 371 | RegisterFunction<GetBrowserLoginFunction>(); |
[email protected] | 63cda0c | 2010-09-01 04:41:23 | [diff] [blame] | 372 | RegisterFunction<GetStoreLoginFunction>(); |
| 373 | RegisterFunction<SetStoreLoginFunction>(); |
[email protected] | 5349ac6d | 2011-04-05 22:20:17 | [diff] [blame] | 374 | RegisterFunction<BeginInstallWithManifestFunction>(); |
[email protected] | b1f04cc | 2010-11-10 22:59:30 | [diff] [blame] | 375 | RegisterFunction<CompleteInstallFunction>(); |
[email protected] | f66a50a | 2011-11-02 23:53:46 | [diff] [blame] | 376 | RegisterFunction<SilentlyInstallFunction>(); |
[email protected] | 979b69c | 2011-12-08 23:19:55 | [diff] [blame] | 377 | RegisterFunction<GetWebGLStatusFunction>(); |
[email protected] | c41fe66 | 2011-02-15 01:19:26 | [diff] [blame] | 378 | |
[email protected] | 557a51dd | 2011-07-26 12:17:11 | [diff] [blame] | 379 | // WebNavigation. |
| 380 | RegisterFunction<GetFrameFunction>(); |
[email protected] | 5a13067 | 2011-09-09 08:42:29 | [diff] [blame] | 381 | RegisterFunction<GetAllFramesFunction>(); |
[email protected] | 557a51dd | 2011-07-26 12:17:11 | [diff] [blame] | 382 | |
[email protected] | c41fe66 | 2011-02-15 01:19:26 | [diff] [blame] | 383 | // WebRequest. |
| 384 | RegisterFunction<WebRequestAddEventListener>(); |
[email protected] | 05cc4e7 | 2011-03-08 21:29:48 | [diff] [blame] | 385 | RegisterFunction<WebRequestEventHandled>(); |
[email protected] | e81d4d7 | 2011-09-29 16:54:31 | [diff] [blame] | 386 | RegisterFunction<WebRequestHandlerBehaviorChanged>(); |
[email protected] | 598bbcc | 2011-02-24 10:03:25 | [diff] [blame] | 387 | |
| 388 | // Preferences. |
| 389 | RegisterFunction<GetPreferenceFunction>(); |
| 390 | RegisterFunction<SetPreferenceFunction>(); |
[email protected] | c433bcb | 2011-02-24 13:10:27 | [diff] [blame] | 391 | RegisterFunction<ClearPreferenceFunction>(); |
[email protected] | 91ba331 | 2011-03-17 20:39:22 | [diff] [blame] | 392 | |
[email protected] | b6b805e9 | 2011-04-16 09:24:14 | [diff] [blame] | 393 | // ChromeOS-specific part of the API. |
| 394 | #if defined(OS_CHROMEOS) |
| 395 | // Device Customization. |
| 396 | RegisterFunction<GetChromeosInfoFunction>(); |
| 397 | |
| 398 | // FileBrowserPrivate functions. |
[email protected] | 04ef515 | 2011-11-18 04:05:25 | [diff] [blame] | 399 | // TODO(jamescook): Expose these on non-ChromeOS platforms so we can use |
| 400 | // the extension-based file picker on Aura. crbug.com/97424 |
[email protected] | 94bda20 | 2011-04-18 23:31:00 | [diff] [blame] | 401 | RegisterFunction<CancelFileDialogFunction>(); |
[email protected] | b6b805e9 | 2011-04-16 09:24:14 | [diff] [blame] | 402 | RegisterFunction<ExecuteTasksFileBrowserFunction>(); |
[email protected] | 94bda20 | 2011-04-18 23:31:00 | [diff] [blame] | 403 | RegisterFunction<FileDialogStringsFunction>(); |
[email protected] | b6b805e9 | 2011-04-16 09:24:14 | [diff] [blame] | 404 | RegisterFunction<GetFileTasksFileBrowserFunction>(); |
[email protected] | 61334fa | 2011-06-16 01:01:40 | [diff] [blame] | 405 | RegisterFunction<GetVolumeMetadataFunction>(); |
[email protected] | b6b805e9 | 2011-04-16 09:24:14 | [diff] [blame] | 406 | RegisterFunction<RequestLocalFileSystemFunction>(); |
[email protected] | a6d0664 | 2011-06-02 05:55:23 | [diff] [blame] | 407 | RegisterFunction<AddFileWatchBrowserFunction>(); |
| 408 | RegisterFunction<RemoveFileWatchBrowserFunction>(); |
[email protected] | 9d4c2c5 | 2011-04-07 18:53:10 | [diff] [blame] | 409 | RegisterFunction<SelectFileFunction>(); |
| 410 | RegisterFunction<SelectFilesFunction>(); |
[email protected] | 928ae885 | 2011-07-26 01:15:03 | [diff] [blame] | 411 | RegisterFunction<AddMountFunction>(); |
| 412 | RegisterFunction<RemoveMountFunction>(); |
| 413 | RegisterFunction<GetMountPointsFunction>(); |
[email protected] | 694cafac | 2011-09-21 17:41:53 | [diff] [blame] | 414 | RegisterFunction<GetSizeStatsFunction>(); |
[email protected] | 3fd9004c | 2011-08-12 00:58:46 | [diff] [blame] | 415 | RegisterFunction<FormatDeviceFunction>(); |
[email protected] | 94bda20 | 2011-04-18 23:31:00 | [diff] [blame] | 416 | RegisterFunction<ViewFilesFunction>(); |
[email protected] | f1852b5 | 2011-05-17 04:58:08 | [diff] [blame] | 417 | |
[email protected] | ce980204 | 2011-05-27 10:11:40 | [diff] [blame] | 418 | // Mediaplayer |
| 419 | RegisterFunction<PlayAtMediaplayerFunction>(); |
| 420 | RegisterFunction<SetPlaybackErrorMediaplayerFunction>(); |
| 421 | RegisterFunction<GetPlaylistMediaplayerFunction>(); |
| 422 | RegisterFunction<TogglePlaylistPanelMediaplayerFunction>(); |
| 423 | RegisterFunction<ToggleFullscreenMediaplayerFunction>(); |
[email protected] | be5bd574 | 2011-07-14 07:21:01 | [diff] [blame] | 424 | |
| 425 | // InputMethod |
| 426 | RegisterFunction<GetInputMethodFunction>(); |
| 427 | |
[email protected] | 8f42798 | 2011-12-13 23:40:23 | [diff] [blame] | 428 | // Terminal |
| 429 | RegisterFunction<OpenTerminalProcessFunction>(); |
| 430 | RegisterFunction<SendInputToTerminalProcessFunction>(); |
| 431 | RegisterFunction<CloseTerminalProcessFunction>(); |
| 432 | |
[email protected] | 9a2aebe0 | 2011-12-02 21:54:14 | [diff] [blame] | 433 | #if defined(USE_VIRTUAL_KEYBOARD) |
[email protected] | f1852b5 | 2011-05-17 04:58:08 | [diff] [blame] | 434 | // Input |
| 435 | RegisterFunction<SendHandwritingStrokeFunction>(); |
| 436 | RegisterFunction<CancelHandwritingStrokesFunction>(); |
| 437 | #endif |
[email protected] | 61b55b6 | 2011-03-24 09:03:10 | [diff] [blame] | 438 | #endif |
| 439 | |
[email protected] | c6e584c | 2011-05-18 11:58:44 | [diff] [blame] | 440 | // Websocket to TCP proxy. Currently noop on anything other than ChromeOS. |
| 441 | RegisterFunction<WebSocketProxyPrivateGetPassportForTCPFunction>(); |
[email protected] | 5ddffb8 | 2011-10-14 17:48:07 | [diff] [blame] | 442 | RegisterFunction<WebSocketProxyPrivateGetURLForTCPFunction>(); |
[email protected] | c6e584c | 2011-05-18 11:58:44 | [diff] [blame] | 443 | |
[email protected] | 91ba331 | 2011-03-17 20:39:22 | [diff] [blame] | 444 | // Debugger |
| 445 | RegisterFunction<AttachDebuggerFunction>(); |
| 446 | RegisterFunction<DetachDebuggerFunction>(); |
[email protected] | c7580b6 | 2011-10-26 08:46:30 | [diff] [blame] | 447 | RegisterFunction<SendCommandDebuggerFunction>(); |
[email protected] | fa062426 | 2011-06-09 14:17:38 | [diff] [blame] | 448 | |
[email protected] | b7f853e28 | 2011-08-10 09:24:20 | [diff] [blame] | 449 | // Settings |
[email protected] | 0d9a220 | 2011-11-09 13:48:41 | [diff] [blame] | 450 | RegisterFunction<extensions::GetSettingsFunction>(); |
| 451 | RegisterFunction<extensions::SetSettingsFunction>(); |
| 452 | RegisterFunction<extensions::RemoveSettingsFunction>(); |
| 453 | RegisterFunction<extensions::ClearSettingsFunction>(); |
[email protected] | b7f853e28 | 2011-08-10 09:24:20 | [diff] [blame] | 454 | |
[email protected] | fa062426 | 2011-06-09 14:17:38 | [diff] [blame] | 455 | // Content settings. |
[email protected] | 49ba482 | 2011-06-15 18:41:56 | [diff] [blame] | 456 | RegisterFunction<GetResourceIdentifiersFunction>(); |
[email protected] | fa062426 | 2011-06-09 14:17:38 | [diff] [blame] | 457 | RegisterFunction<ClearContentSettingsFunction>(); |
| 458 | RegisterFunction<GetContentSettingFunction>(); |
| 459 | RegisterFunction<SetContentSettingFunction>(); |
[email protected] | c1d05aa | 2011-06-28 02:07:30 | [diff] [blame] | 460 | |
[email protected] | be9d9c8 | 2011-07-13 04:17:31 | [diff] [blame] | 461 | // ChromeAuth settings. |
| 462 | RegisterFunction<SetCloudPrintCredentialsFunction>(); |
| 463 | |
[email protected] | c1d05aa | 2011-06-28 02:07:30 | [diff] [blame] | 464 | // Experimental App API. |
| 465 | RegisterFunction<AppNotifyFunction>(); |
| 466 | RegisterFunction<AppClearAllNotificationsFunction>(); |
[email protected] | 902fd7b | 2011-07-27 18:42:31 | [diff] [blame] | 467 | |
| 468 | // Permissions |
| 469 | RegisterFunction<ContainsPermissionsFunction>(); |
| 470 | RegisterFunction<GetAllPermissionsFunction>(); |
| 471 | RegisterFunction<RemovePermissionsFunction>(); |
| 472 | RegisterFunction<RequestPermissionsFunction>(); |
[email protected] | 21d7a4e30 | 2011-08-15 16:17:12 | [diff] [blame] | 473 | |
| 474 | // Downloads |
| 475 | RegisterFunction<DownloadsDownloadFunction>(); |
| 476 | RegisterFunction<DownloadsSearchFunction>(); |
| 477 | RegisterFunction<DownloadsPauseFunction>(); |
| 478 | RegisterFunction<DownloadsResumeFunction>(); |
| 479 | RegisterFunction<DownloadsCancelFunction>(); |
| 480 | RegisterFunction<DownloadsEraseFunction>(); |
| 481 | RegisterFunction<DownloadsSetDestinationFunction>(); |
| 482 | RegisterFunction<DownloadsAcceptDangerFunction>(); |
| 483 | RegisterFunction<DownloadsShowFunction>(); |
| 484 | RegisterFunction<DownloadsDragFunction>(); |
[email protected] | 3a605e8 | 2011-09-26 17:26:16 | [diff] [blame] | 485 | |
[email protected] | 9e4430f | 2011-11-28 07:43:29 | [diff] [blame] | 486 | // PageCapture |
| 487 | RegisterFunction<PageCaptureSaveAsMHTMLFunction>(); |
[email protected] | 6a16dc9b | 2011-10-17 18:28:16 | [diff] [blame] | 488 | |
[email protected] | 5eddc3e | 2011-10-26 04:33:31 | [diff] [blame] | 489 | // TopSites |
| 490 | RegisterFunction<GetTopSitesFunction>(); |
[email protected] | ae7f1ba | 2011-11-28 23:07:31 | [diff] [blame] | 491 | |
| 492 | // Sockets |
| 493 | RegisterFunction<extensions::SocketCreateFunction>(); |
[email protected] | 55afeb5 | 2011-12-06 00:15:39 | [diff] [blame] | 494 | RegisterFunction<extensions::SocketDestroyFunction>(); |
[email protected] | ae7f1ba | 2011-11-28 23:07:31 | [diff] [blame] | 495 | RegisterFunction<extensions::SocketConnectFunction>(); |
[email protected] | 55afeb5 | 2011-12-06 00:15:39 | [diff] [blame] | 496 | RegisterFunction<extensions::SocketCloseFunction>(); |
| 497 | RegisterFunction<extensions::SocketWriteFunction>(); |
[email protected] | a4f9892 | 2011-12-06 11:32:23 | [diff] [blame] | 498 | |
| 499 | // System |
| 500 | RegisterFunction<extensions::GetIncognitoModeAvailabilityFunction>(); |
[email protected] | 1723bdc2 | 2011-12-15 05:04:18 | [diff] [blame] | 501 | RegisterFunction<extensions::GetUpdateStatusFunction>(); |
[email protected] | bfdffe2b | 2009-04-24 22:05:35 | [diff] [blame] | 502 | } |
| 503 | |
[email protected] | b83e460 | 2009-05-15 22:58:33 | [diff] [blame] | 504 | void FactoryRegistry::GetAllNames(std::vector<std::string>* names) { |
| 505 | for (FactoryMap::iterator iter = factories_.begin(); |
| 506 | iter != factories_.end(); ++iter) { |
[email protected] | bfdffe2b | 2009-04-24 22:05:35 | [diff] [blame] | 507 | names->push_back(iter->first); |
| 508 | } |
| 509 | } |
| 510 | |
[email protected] | b83e460 | 2009-05-15 22:58:33 | [diff] [blame] | 511 | bool FactoryRegistry::OverrideFunction(const std::string& name, |
| 512 | ExtensionFunctionFactory factory) { |
| 513 | FactoryMap::iterator iter = factories_.find(name); |
| 514 | if (iter == factories_.end()) { |
| 515 | return false; |
| 516 | } else { |
| 517 | iter->second = factory; |
| 518 | return true; |
| 519 | } |
| 520 | } |
| 521 | |
[email protected] | bfdffe2b | 2009-04-24 22:05:35 | [diff] [blame] | 522 | ExtensionFunction* FactoryRegistry::NewFunction(const std::string& name) { |
| 523 | FactoryMap::iterator iter = factories_.find(name); |
| 524 | DCHECK(iter != factories_.end()); |
[email protected] | b83e460 | 2009-05-15 22:58:33 | [diff] [blame] | 525 | ExtensionFunction* function = iter->second(); |
[email protected] | 76a3db85 | 2009-07-24 02:14:56 | [diff] [blame] | 526 | function->set_name(name); |
[email protected] | b83e460 | 2009-05-15 22:58:33 | [diff] [blame] | 527 | return function; |
[email protected] | bfdffe2b | 2009-04-24 22:05:35 | [diff] [blame] | 528 | } |
| 529 | |
[email protected] | efd7599 | 2011-12-15 22:42:42 | [diff] [blame^] | 530 | const char kAccessDenied[] = "access denied"; |
| 531 | const char kQuotaExceeded[] = "quota exceeded"; |
| 532 | |
| 533 | void LogSuccess(const Extension* extension, |
| 534 | const ExtensionHostMsg_Request_Params& params) { |
| 535 | ExtensionActivityLog* extension_activity_log = |
| 536 | ExtensionActivityLog::GetInstance(); |
| 537 | if (extension_activity_log->HasObservers(extension)) { |
| 538 | std::string call_signature = params.name + "("; |
| 539 | ListValue::const_iterator it = params.arguments.begin(); |
| 540 | for (; it != params.arguments.end(); ++it) { |
| 541 | std::string arg; |
| 542 | JSONStringValueSerializer serializer(&arg); |
| 543 | if (serializer.SerializeAndOmitBinaryValues(**it)) { |
| 544 | if (it != params.arguments.begin()) |
| 545 | call_signature += ", "; |
| 546 | call_signature += arg; |
| 547 | } |
| 548 | } |
| 549 | call_signature += ")"; |
| 550 | |
| 551 | extension_activity_log->Log( |
| 552 | extension, |
| 553 | ExtensionActivityLog::ACTIVITY_EXTENSION_API_CALL, |
| 554 | call_signature); |
| 555 | } |
| 556 | } |
| 557 | |
| 558 | void LogFailure(const Extension* extension, |
| 559 | const std::string& func_name, |
| 560 | const char* reason) { |
| 561 | ExtensionActivityLog* extension_activity_log = |
| 562 | ExtensionActivityLog::GetInstance(); |
| 563 | if (extension_activity_log->HasObservers(extension)) { |
| 564 | extension_activity_log->Log( |
| 565 | extension, |
| 566 | ExtensionActivityLog::ACTIVITY_EXTENSION_API_BLOCK, |
| 567 | func_name + ": " + reason); |
| 568 | } |
| 569 | } |
| 570 | |
[email protected] | b83e460 | 2009-05-15 22:58:33 | [diff] [blame] | 571 | }; // namespace |
[email protected] | bfdffe2b | 2009-04-24 22:05:35 | [diff] [blame] | 572 | |
| 573 | // ExtensionFunctionDispatcher ------------------------------------------------- |
| 574 | |
| 575 | void ExtensionFunctionDispatcher::GetAllFunctionNames( |
| 576 | std::vector<std::string>* names) { |
[email protected] | 8e8bb6d | 2010-12-13 08:18:55 | [diff] [blame] | 577 | FactoryRegistry::GetInstance()->GetAllNames(names); |
[email protected] | bfdffe2b | 2009-04-24 22:05:35 | [diff] [blame] | 578 | } |
| 579 | |
[email protected] | b83e460 | 2009-05-15 22:58:33 | [diff] [blame] | 580 | bool ExtensionFunctionDispatcher::OverrideFunction( |
| 581 | const std::string& name, ExtensionFunctionFactory factory) { |
[email protected] | 8e8bb6d | 2010-12-13 08:18:55 | [diff] [blame] | 582 | return FactoryRegistry::GetInstance()->OverrideFunction(name, factory); |
[email protected] | b83e460 | 2009-05-15 22:58:33 | [diff] [blame] | 583 | } |
| 584 | |
| 585 | void ExtensionFunctionDispatcher::ResetFunctions() { |
[email protected] | 8e8bb6d | 2010-12-13 08:18:55 | [diff] [blame] | 586 | FactoryRegistry::GetInstance()->ResetFunctions(); |
[email protected] | b83e460 | 2009-05-15 22:58:33 | [diff] [blame] | 587 | } |
| 588 | |
[email protected] | c357acb4 | 2011-06-09 20:52:42 | [diff] [blame] | 589 | // static |
| 590 | void ExtensionFunctionDispatcher::DispatchOnIOThread( |
[email protected] | fd50e7b | 2011-11-03 09:20:25 | [diff] [blame] | 591 | ExtensionInfoMap* extension_info_map, |
[email protected] | 67351452 | 2011-07-13 18:17:18 | [diff] [blame] | 592 | void* profile, |
[email protected] | c357acb4 | 2011-06-09 20:52:42 | [diff] [blame] | 593 | int render_process_id, |
| 594 | base::WeakPtr<ChromeRenderMessageFilter> ipc_sender, |
| 595 | int routing_id, |
| 596 | const ExtensionHostMsg_Request_Params& params) { |
| 597 | const Extension* extension = |
[email protected] | 83820d4 | 2011-11-12 22:03:11 | [diff] [blame] | 598 | extension_info_map->extensions().GetByID(params.extension_id); |
[email protected] | c357acb4 | 2011-06-09 20:52:42 | [diff] [blame] | 599 | |
[email protected] | 6f37144 | 2011-11-09 06:45:46 | [diff] [blame] | 600 | scoped_refptr<ExtensionFunction> function( |
| 601 | CreateExtensionFunction(params, extension, render_process_id, |
| 602 | extension_info_map->process_map(), profile, |
| 603 | ipc_sender, routing_id)); |
[email protected] | efd7599 | 2011-12-15 22:42:42 | [diff] [blame^] | 604 | if (!function) { |
| 605 | LogFailure(extension, params.name, kAccessDenied); |
[email protected] | c357acb4 | 2011-06-09 20:52:42 | [diff] [blame] | 606 | return; |
[email protected] | efd7599 | 2011-12-15 22:42:42 | [diff] [blame^] | 607 | } |
[email protected] | c357acb4 | 2011-06-09 20:52:42 | [diff] [blame] | 608 | |
| 609 | IOThreadExtensionFunction* function_io = |
| 610 | function->AsIOThreadExtensionFunction(); |
| 611 | if (!function_io) { |
| 612 | NOTREACHED(); |
| 613 | return; |
| 614 | } |
| 615 | function_io->set_ipc_sender(ipc_sender, routing_id); |
| 616 | function_io->set_extension_info_map(extension_info_map); |
| 617 | function->set_include_incognito( |
| 618 | extension_info_map->IsIncognitoEnabled(extension->id())); |
[email protected] | fd50e7b | 2011-11-03 09:20:25 | [diff] [blame] | 619 | |
| 620 | ExtensionsQuotaService* quota = extension_info_map->quota_service(); |
| 621 | if (quota->Assess(extension->id(), function, ¶ms.arguments, |
| 622 | base::TimeTicks::Now())) { |
| 623 | function->Run(); |
[email protected] | efd7599 | 2011-12-15 22:42:42 | [diff] [blame^] | 624 | LogSuccess(extension, params); |
[email protected] | fd50e7b | 2011-11-03 09:20:25 | [diff] [blame] | 625 | } else { |
| 626 | function->OnQuotaExceeded(); |
[email protected] | efd7599 | 2011-12-15 22:42:42 | [diff] [blame^] | 627 | LogFailure(extension, params.name, kQuotaExceeded); |
[email protected] | fd50e7b | 2011-11-03 09:20:25 | [diff] [blame] | 628 | } |
[email protected] | c357acb4 | 2011-06-09 20:52:42 | [diff] [blame] | 629 | } |
| 630 | |
[email protected] | c5dbef0 | 2011-05-13 05:06:09 | [diff] [blame] | 631 | ExtensionFunctionDispatcher::ExtensionFunctionDispatcher(Profile* profile, |
| 632 | Delegate* delegate) |
| 633 | : profile_(profile), |
[email protected] | 55ce33071 | 2011-05-24 19:04:27 | [diff] [blame] | 634 | delegate_(delegate) { |
[email protected] | bfdffe2b | 2009-04-24 22:05:35 | [diff] [blame] | 635 | } |
| 636 | |
[email protected] | 32dda36 | 2009-06-05 19:07:01 | [diff] [blame] | 637 | ExtensionFunctionDispatcher::~ExtensionFunctionDispatcher() { |
[email protected] | 32dda36 | 2009-06-05 19:07:01 | [diff] [blame] | 638 | } |
| 639 | |
[email protected] | 0ec9203 | 2010-03-24 19:59:41 | [diff] [blame] | 640 | Browser* ExtensionFunctionDispatcher::GetCurrentBrowser( |
[email protected] | c5dbef0 | 2011-05-13 05:06:09 | [diff] [blame] | 641 | RenderViewHost* render_view_host, bool include_incognito) { |
[email protected] | 0ec9203 | 2010-03-24 19:59:41 | [diff] [blame] | 642 | Browser* browser = delegate_->GetBrowser(); |
[email protected] | 7eecaed5 | 2009-05-07 21:44:12 | [diff] [blame] | 643 | |
[email protected] | bc535ee5 | 2010-08-31 18:40:32 | [diff] [blame] | 644 | // If the delegate has an associated browser, that is always the right answer. |
| 645 | if (browser) |
| 646 | return browser; |
[email protected] | 9c45b718 | 2009-08-04 16:44:43 | [diff] [blame] | 647 | |
[email protected] | bc535ee5 | 2010-08-31 18:40:32 | [diff] [blame] | 648 | // Otherwise, try to default to a reasonable browser. If |include_incognito| |
| 649 | // is true, we will also search browsers in the incognito version of this |
| 650 | // profile. Note that the profile may already be incognito, in which case |
| 651 | // we will search the incognito version only, regardless of the value of |
| 652 | // |include_incognito|. |
[email protected] | 9b62ecf | 2011-07-27 20:23:08 | [diff] [blame] | 653 | Profile* profile = Profile::FromBrowserContext( |
[email protected] | f3b1a08 | 2011-11-18 00:34:30 | [diff] [blame] | 654 | render_view_host->process()->GetBrowserContext()); |
[email protected] | b35b26b3 | 2011-05-05 20:35:14 | [diff] [blame] | 655 | browser = BrowserList::FindTabbedBrowser(profile, include_incognito); |
[email protected] | 0ec9203 | 2010-03-24 19:59:41 | [diff] [blame] | 656 | |
[email protected] | 0ec9203 | 2010-03-24 19:59:41 | [diff] [blame] | 657 | // NOTE(rafaelw): This can return NULL in some circumstances. In particular, |
[email protected] | 6d7a604 | 2010-08-12 20:12:42 | [diff] [blame] | 658 | // a background_page onload chrome.tabs api call can make it into here |
| 659 | // before the browser is sufficiently initialized to return here. |
[email protected] | 0ec9203 | 2010-03-24 19:59:41 | [diff] [blame] | 660 | // A similar situation may arise during shutdown. |
| 661 | // TODO(rafaelw): Delay creation of background_page until the browser |
| 662 | // is available. http://code.google.com/p/chromium/issues/detail?id=13284 |
| 663 | return browser; |
[email protected] | b2725756 | 2009-11-16 23:28:26 | [diff] [blame] | 664 | } |
| 665 | |
[email protected] | c5dbef0 | 2011-05-13 05:06:09 | [diff] [blame] | 666 | void ExtensionFunctionDispatcher::Dispatch( |
| 667 | const ExtensionHostMsg_Request_Params& params, |
| 668 | RenderViewHost* render_view_host) { |
[email protected] | c5dbef0 | 2011-05-13 05:06:09 | [diff] [blame] | 669 | ExtensionService* service = profile()->GetExtensionService(); |
[email protected] | 6f37144 | 2011-11-09 06:45:46 | [diff] [blame] | 670 | extensions::ProcessMap* process_map = service->process_map(); |
| 671 | if (!service || !process_map) |
[email protected] | c5dbef0 | 2011-05-13 05:06:09 | [diff] [blame] | 672 | return; |
| 673 | |
[email protected] | 615d88f | 2011-12-13 01:47:44 | [diff] [blame] | 674 | const Extension* extension = service->extensions()->GetByID( |
| 675 | params.extension_id); |
[email protected] | c5dbef0 | 2011-05-13 05:06:09 | [diff] [blame] | 676 | if (!extension) |
[email protected] | 615d88f | 2011-12-13 01:47:44 | [diff] [blame] | 677 | extension = service->extensions()->GetHostedAppByURL(ExtensionURLInfo( |
| 678 | WebSecurityOrigin::createFromString(params.source_origin), |
| 679 | params.source_url)); |
[email protected] | c5dbef0 | 2011-05-13 05:06:09 | [diff] [blame] | 680 | |
[email protected] | 8add541 | 2011-10-01 21:02:14 | [diff] [blame] | 681 | scoped_refptr<ExtensionFunction> function( |
[email protected] | 6f37144 | 2011-11-09 06:45:46 | [diff] [blame] | 682 | CreateExtensionFunction(params, extension, |
[email protected] | f3b1a08 | 2011-11-18 00:34:30 | [diff] [blame] | 683 | render_view_host->process()->GetID(), |
[email protected] | 6f37144 | 2011-11-09 06:45:46 | [diff] [blame] | 684 | *(service->process_map()), |
| 685 | profile(), render_view_host, |
[email protected] | 8add541 | 2011-10-01 21:02:14 | [diff] [blame] | 686 | render_view_host->routing_id())); |
[email protected] | efd7599 | 2011-12-15 22:42:42 | [diff] [blame^] | 687 | if (!function) { |
| 688 | LogFailure(extension, params.name, kAccessDenied); |
[email protected] | f82d57b5 | 2011-04-27 19:13:17 | [diff] [blame] | 689 | return; |
[email protected] | efd7599 | 2011-12-15 22:42:42 | [diff] [blame^] | 690 | } |
[email protected] | f82d57b5 | 2011-04-27 19:13:17 | [diff] [blame] | 691 | |
[email protected] | a2aef2e | 2011-05-26 22:48:12 | [diff] [blame] | 692 | UIThreadExtensionFunction* function_ui = |
| 693 | function->AsUIThreadExtensionFunction(); |
| 694 | if (!function_ui) { |
| 695 | NOTREACHED(); |
| 696 | return; |
| 697 | } |
| 698 | function_ui->SetRenderViewHost(render_view_host); |
| 699 | function_ui->set_dispatcher(AsWeakPtr()); |
| 700 | function_ui->set_profile(profile_); |
[email protected] | 2a8f24e | 2010-11-03 21:37:05 | [diff] [blame] | 701 | function->set_include_incognito(service->CanCrossIncognito(extension)); |
[email protected] | cb0ce1e02 | 2010-03-10 19:54:41 | [diff] [blame] | 702 | |
[email protected] | d13950e | 2009-12-04 01:43:02 | [diff] [blame] | 703 | ExtensionsQuotaService* quota = service->quota_service(); |
[email protected] | c5dbef0 | 2011-05-13 05:06:09 | [diff] [blame] | 704 | if (quota->Assess(extension->id(), function, ¶ms.arguments, |
[email protected] | 8b8e7c9 | 2010-08-19 18:05:56 | [diff] [blame] | 705 | base::TimeTicks::Now())) { |
[email protected] | d070ec6 | 2010-07-27 21:28:26 | [diff] [blame] | 706 | // See crbug.com/39178. |
| 707 | ExternalProtocolHandler::PermitLaunchUrl(); |
| 708 | |
[email protected] | d13950e | 2009-12-04 01:43:02 | [diff] [blame] | 709 | function->Run(); |
[email protected] | efd7599 | 2011-12-15 22:42:42 | [diff] [blame^] | 710 | LogSuccess(extension, params); |
[email protected] | d13950e | 2009-12-04 01:43:02 | [diff] [blame] | 711 | } else { |
[email protected] | fd50e7b | 2011-11-03 09:20:25 | [diff] [blame] | 712 | function->OnQuotaExceeded(); |
[email protected] | efd7599 | 2011-12-15 22:42:42 | [diff] [blame^] | 713 | LogFailure(extension, params.name, kQuotaExceeded); |
[email protected] | d13950e | 2009-12-04 01:43:02 | [diff] [blame] | 714 | } |
[email protected] | bfdffe2b | 2009-04-24 22:05:35 | [diff] [blame] | 715 | } |
| 716 | |
[email protected] | c357acb4 | 2011-06-09 20:52:42 | [diff] [blame] | 717 | // static |
| 718 | ExtensionFunction* ExtensionFunctionDispatcher::CreateExtensionFunction( |
| 719 | const ExtensionHostMsg_Request_Params& params, |
| 720 | const Extension* extension, |
[email protected] | 6f37144 | 2011-11-09 06:45:46 | [diff] [blame] | 721 | int requesting_process_id, |
| 722 | const extensions::ProcessMap& process_map, |
[email protected] | 67351452 | 2011-07-13 18:17:18 | [diff] [blame] | 723 | void* profile, |
[email protected] | c357acb4 | 2011-06-09 20:52:42 | [diff] [blame] | 724 | IPC::Message::Sender* ipc_sender, |
| 725 | int routing_id) { |
[email protected] | c357acb4 | 2011-06-09 20:52:42 | [diff] [blame] | 726 | if (!extension) { |
[email protected] | 6f37144 | 2011-11-09 06:45:46 | [diff] [blame] | 727 | LOG(ERROR) << "Specified extension does not exist."; |
| 728 | SendAccessDenied(ipc_sender, routing_id, params.request_id); |
| 729 | return NULL; |
| 730 | } |
| 731 | |
[email protected] | 83820d4 | 2011-11-12 22:03:11 | [diff] [blame] | 732 | if (ExtensionAPI::GetInstance()->IsPrivileged(params.name) && |
| 733 | !process_map.Contains(extension->id(), requesting_process_id)) { |
[email protected] | 6f37144 | 2011-11-09 06:45:46 | [diff] [blame] | 734 | LOG(ERROR) << "Extension API called from incorrect process " |
| 735 | << requesting_process_id |
| 736 | << " from URL " << params.source_url.spec(); |
[email protected] | c357acb4 | 2011-06-09 20:52:42 | [diff] [blame] | 737 | SendAccessDenied(ipc_sender, routing_id, params.request_id); |
| 738 | return NULL; |
| 739 | } |
| 740 | |
[email protected] | 0d3e4a2 | 2011-06-23 19:02:52 | [diff] [blame] | 741 | if (!extension->HasAPIPermission(params.name)) { |
[email protected] | c357acb4 | 2011-06-09 20:52:42 | [diff] [blame] | 742 | LOG(ERROR) << "Extension " << extension->id() << " does not have " |
| 743 | << "permission to function: " << params.name; |
| 744 | SendAccessDenied(ipc_sender, routing_id, params.request_id); |
| 745 | return NULL; |
| 746 | } |
| 747 | |
| 748 | ExtensionFunction* function = |
| 749 | FactoryRegistry::GetInstance()->NewFunction(params.name); |
| 750 | function->SetArgs(¶ms.arguments); |
| 751 | function->set_source_url(params.source_url); |
| 752 | function->set_request_id(params.request_id); |
| 753 | function->set_has_callback(params.has_callback); |
| 754 | function->set_user_gesture(params.user_gesture); |
| 755 | function->set_extension(extension); |
[email protected] | 637bf32 | 2011-10-01 20:46:32 | [diff] [blame] | 756 | function->set_profile_id(profile); |
[email protected] | c357acb4 | 2011-06-09 20:52:42 | [diff] [blame] | 757 | return function; |
| 758 | } |
| 759 | |
| 760 | // static |
[email protected] | c5dbef0 | 2011-05-13 05:06:09 | [diff] [blame] | 761 | void ExtensionFunctionDispatcher::SendAccessDenied( |
[email protected] | c357acb4 | 2011-06-09 20:52:42 | [diff] [blame] | 762 | IPC::Message::Sender* ipc_sender, int routing_id, int request_id) { |
| 763 | ipc_sender->Send(new ExtensionMsg_Response( |
| 764 | routing_id, request_id, false, std::string(), |
[email protected] | c5dbef0 | 2011-05-13 05:06:09 | [diff] [blame] | 765 | "Access to extension API denied.")); |
[email protected] | bfdffe2b | 2009-04-24 22:05:35 | [diff] [blame] | 766 | } |