Chromium Code Reviews| Index: chrome/browser/extensions/extension_function_dispatcher.cc |
| diff --git a/chrome/browser/extensions/extension_function_dispatcher.cc b/chrome/browser/extensions/extension_function_dispatcher.cc |
| index 9e6b07ed47cc2284c82d83be53d847a768aa7241..b97d314df393fca5f42fd0c7257c03b37691c60b 100644 |
| --- a/chrome/browser/extensions/extension_function_dispatcher.cc |
| +++ b/chrome/browser/extensions/extension_function_dispatcher.cc |
| @@ -8,64 +8,18 @@ |
| #include "base/json/json_string_value_serializer.h" |
| #include "base/memory/ref_counted.h" |
| -#include "base/memory/singleton.h" |
| #include "base/process_util.h" |
| #include "base/values.h" |
| #include "build/build_config.h" |
| -#include "chrome/browser/accessibility/accessibility_extension_api.h" |
| -#include "chrome/browser/bookmarks/bookmark_extension_api.h" |
| -#include "chrome/browser/bookmarks/bookmark_manager_extension_api.h" |
| -#include "chrome/browser/download/download_extension_api.h" |
| -#include "chrome/browser/extensions/api/app/app_api.h" |
| -#include "chrome/browser/extensions/api/browsingdata/browsing_data_api.h" |
| -#include "chrome/browser/extensions/api/declarative/declarative_api.h" |
| -#include "chrome/browser/extensions/api/dns/dns_api.h" |
| -#include "chrome/browser/extensions/api/permissions/permissions_api.h" |
| -#include "chrome/browser/extensions/api/serial/serial_api.h" |
| -#include "chrome/browser/extensions/api/socket/socket_api.h" |
| -#include "chrome/browser/extensions/api/webrequest/webrequest_api.h" |
| -#include "chrome/browser/extensions/execute_code_in_tab_function.h" |
| #include "chrome/browser/extensions/extension_activity_log.h" |
| -#include "chrome/browser/extensions/extension_browser_actions_api.h" |
| -#include "chrome/browser/extensions/extension_chrome_auth_private_api.h" |
| -#include "chrome/browser/extensions/extension_content_settings_api.h" |
| -#include "chrome/browser/extensions/extension_context_menu_api.h" |
| -#include "chrome/browser/extensions/extension_cookies_api.h" |
| -#include "chrome/browser/extensions/extension_debugger_api.h" |
| -#include "chrome/browser/extensions/extension_font_settings_api.h" |
| #include "chrome/browser/extensions/extension_function.h" |
| -#include "chrome/browser/extensions/extension_i18n_api.h" |
| -#include "chrome/browser/extensions/extension_idle_api.h" |
| -#include "chrome/browser/extensions/extension_managed_mode_api.h" |
| -#include "chrome/browser/extensions/extension_management_api.h" |
| -#include "chrome/browser/extensions/extension_metrics_module.h" |
| -#include "chrome/browser/extensions/extension_module.h" |
| -#include "chrome/browser/extensions/extension_omnibox_api.h" |
| -#include "chrome/browser/extensions/extension_page_actions_module.h" |
| -#include "chrome/browser/extensions/extension_page_capture_api.h" |
| -#include "chrome/browser/extensions/extension_preference_api.h" |
| -#include "chrome/browser/extensions/extension_processes_api.h" |
| #include "chrome/browser/extensions/extension_service.h" |
| -#include "chrome/browser/extensions/extension_tabs_module.h" |
| -#include "chrome/browser/extensions/extension_test_api.h" |
| -#include "chrome/browser/extensions/extension_tts_api.h" |
| -#include "chrome/browser/extensions/extension_tts_engine_api.h" |
| -#include "chrome/browser/extensions/extension_web_socket_proxy_private_api.h" |
| #include "chrome/browser/extensions/extension_web_ui.h" |
| -#include "chrome/browser/extensions/extension_webnavigation_api.h" |
| -#include "chrome/browser/extensions/extension_webstore_private_api.h" |
| #include "chrome/browser/extensions/extensions_quota_service.h" |
| #include "chrome/browser/extensions/process_map.h" |
| -#include "chrome/browser/extensions/settings/settings_api.h" |
| -#include "chrome/browser/extensions/system/system_api.h" |
| #include "chrome/browser/external_protocol/external_protocol_handler.h" |
| -#include "chrome/browser/history/history_extension_api.h" |
| -#include "chrome/browser/history/top_sites_extension_api.h" |
| -#include "chrome/browser/infobars/infobar_extension_api.h" |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/renderer_host/chrome_render_message_filter.h" |
| -#include "chrome/browser/rlz/rlz_extension_api.h" |
| -#include "chrome/browser/speech/speech_input_extension_api.h" |
| #include "chrome/browser/ui/browser_list.h" |
| #include "chrome/browser/ui/browser_window.h" |
| #include "chrome/common/extensions/api/extension_api.h" |
| @@ -78,484 +32,12 @@ |
| #include "ipc/ipc_message_macros.h" |
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" |
| #include "third_party/skia/include/core/SkBitmap.h" |
| - |
| -#if defined(TOOLKIT_VIEWS) |
| -#include "chrome/browser/extensions/extension_input_api.h" |
| -#endif |
| - |
| -#if defined(OS_CHROMEOS) && defined(USE_VIRTUAL_KEYBOARD) |
| -#include "chrome/browser/extensions/extension_input_ui_api.h" |
| -#endif |
| - |
| -#if defined(OS_CHROMEOS) |
| -#include "chrome/browser/chromeos/extensions/file_browser_private_api.h" |
| -#include "chrome/browser/chromeos/media/media_player_extension_api.h" |
| -#include "chrome/browser/extensions/api/terminal/terminal_private_api.h" |
| -#include "chrome/browser/extensions/extension_info_private_api_chromeos.h" |
| -#include "chrome/browser/extensions/extension_input_ime_api.h" |
| -#include "chrome/browser/extensions/extension_input_method_api.h" |
| -#endif |
| +#include "webkit/glue/resource_type.h" |
| using extensions::ExtensionAPI; |
| using content::RenderViewHost; |
| using WebKit::WebSecurityOrigin; |
| -// FactoryRegistry ------------------------------------------------------------- |
| - |
| -namespace { |
| - |
| -// Template for defining ExtensionFunctionFactory. |
| -template<class T> |
| -ExtensionFunction* NewExtensionFunction() { |
| - return new T(); |
| -} |
| - |
| -// Contains a list of all known extension functions and allows clients to |
| -// create instances of them. |
| -class FactoryRegistry { |
|
asargent_no_longer_on_chrome
2012/03/14 22:46:07
nit: can you change the first line of the descript
|
| - public: |
| - static FactoryRegistry* GetInstance(); |
| - FactoryRegistry() { ResetFunctions(); } |
| - |
| - // Resets all functions to their default values. |
| - void ResetFunctions(); |
| - |
| - // Adds all function names to 'names'. |
| - void GetAllNames(std::vector<std::string>* names); |
| - |
| - // Allows overriding of specific functions (e.g. for testing). Functions |
| - // must be previously registered. Returns true if successful. |
| - bool OverrideFunction(const std::string& name, |
| - ExtensionFunctionFactory factory); |
| - |
| - // Factory method for the ExtensionFunction registered as 'name'. |
| - ExtensionFunction* NewFunction(const std::string& name); |
| - |
| - private: |
| - template<class T> |
| - void RegisterFunction() { |
| - factories_[T::function_name()] = &NewExtensionFunction<T>; |
| - } |
| - |
| - typedef std::map<std::string, ExtensionFunctionFactory> FactoryMap; |
| - FactoryMap factories_; |
| -}; |
| - |
| -FactoryRegistry* FactoryRegistry::GetInstance() { |
| - return Singleton<FactoryRegistry>::get(); |
| -} |
| - |
| -void FactoryRegistry::ResetFunctions() { |
| - // Register all functions here. |
| - |
| - // Windows |
| - RegisterFunction<GetWindowFunction>(); |
| - RegisterFunction<GetCurrentWindowFunction>(); |
| - RegisterFunction<GetLastFocusedWindowFunction>(); |
| - RegisterFunction<GetAllWindowsFunction>(); |
| - RegisterFunction<CreateWindowFunction>(); |
| - RegisterFunction<UpdateWindowFunction>(); |
| - RegisterFunction<RemoveWindowFunction>(); |
| - |
| - // Tabs |
| - RegisterFunction<GetTabFunction>(); |
| - RegisterFunction<GetCurrentTabFunction>(); |
| - RegisterFunction<GetSelectedTabFunction>(); |
| - RegisterFunction<GetAllTabsInWindowFunction>(); |
| - RegisterFunction<QueryTabsFunction>(); |
| - RegisterFunction<HighlightTabsFunction>(); |
| - RegisterFunction<CreateTabFunction>(); |
| - RegisterFunction<UpdateTabFunction>(); |
| - RegisterFunction<MoveTabsFunction>(); |
| - RegisterFunction<ReloadTabFunction>(); |
| - RegisterFunction<RemoveTabsFunction>(); |
| - RegisterFunction<DetectTabLanguageFunction>(); |
| - RegisterFunction<CaptureVisibleTabFunction>(); |
| - RegisterFunction<TabsExecuteScriptFunction>(); |
| - RegisterFunction<TabsInsertCSSFunction>(); |
| - |
| - // Page Actions. |
| - RegisterFunction<EnablePageActionFunction>(); |
| - RegisterFunction<DisablePageActionFunction>(); |
| - RegisterFunction<PageActionShowFunction>(); |
| - RegisterFunction<PageActionHideFunction>(); |
| - RegisterFunction<PageActionSetIconFunction>(); |
| - RegisterFunction<PageActionSetTitleFunction>(); |
| - RegisterFunction<PageActionSetPopupFunction>(); |
| - |
| - // Browser Actions. |
| - RegisterFunction<BrowserActionSetIconFunction>(); |
| - RegisterFunction<BrowserActionSetTitleFunction>(); |
| - RegisterFunction<BrowserActionSetBadgeTextFunction>(); |
| - RegisterFunction<BrowserActionSetBadgeBackgroundColorFunction>(); |
| - RegisterFunction<BrowserActionSetPopupFunction>(); |
| - |
| - // Browsing Data. |
| - RegisterFunction<RemoveBrowsingDataFunction>(); |
| - RegisterFunction<RemoveAppCacheFunction>(); |
| - RegisterFunction<RemoveCacheFunction>(); |
| - RegisterFunction<RemoveCookiesFunction>(); |
| - RegisterFunction<RemoveDownloadsFunction>(); |
| - RegisterFunction<RemoveFileSystemsFunction>(); |
| - RegisterFunction<RemoveFormDataFunction>(); |
| - RegisterFunction<RemoveHistoryFunction>(); |
| - RegisterFunction<RemoveIndexedDBFunction>(); |
| - RegisterFunction<RemoveLocalStorageFunction>(); |
| - RegisterFunction<RemoveOriginBoundCertsFunction>(); |
| - RegisterFunction<RemovePluginDataFunction>(); |
| - RegisterFunction<RemovePasswordsFunction>(); |
| - RegisterFunction<RemoveWebSQLFunction>(); |
| - |
| - // Bookmarks. |
| - RegisterFunction<GetBookmarksFunction>(); |
| - RegisterFunction<GetBookmarkChildrenFunction>(); |
| - RegisterFunction<GetBookmarkRecentFunction>(); |
| - RegisterFunction<GetBookmarkTreeFunction>(); |
| - RegisterFunction<GetBookmarkSubTreeFunction>(); |
| - RegisterFunction<SearchBookmarksFunction>(); |
| - RegisterFunction<RemoveBookmarkFunction>(); |
| - RegisterFunction<RemoveTreeBookmarkFunction>(); |
| - RegisterFunction<CreateBookmarkFunction>(); |
| - RegisterFunction<MoveBookmarkFunction>(); |
| - RegisterFunction<UpdateBookmarkFunction>(); |
| - |
| - // Infobars. |
| - RegisterFunction<ShowInfoBarFunction>(); |
| - |
| - // BookmarkManager |
| - RegisterFunction<CopyBookmarkManagerFunction>(); |
| - RegisterFunction<CutBookmarkManagerFunction>(); |
| - RegisterFunction<PasteBookmarkManagerFunction>(); |
| - RegisterFunction<CanPasteBookmarkManagerFunction>(); |
| - RegisterFunction<ImportBookmarksFunction>(); |
| - RegisterFunction<ExportBookmarksFunction>(); |
| - RegisterFunction<SortChildrenBookmarkManagerFunction>(); |
| - RegisterFunction<BookmarkManagerGetStringsFunction>(); |
| - RegisterFunction<StartDragBookmarkManagerFunction>(); |
| - RegisterFunction<DropBookmarkManagerFunction>(); |
| - RegisterFunction<GetSubtreeBookmarkManagerFunction>(); |
| - RegisterFunction<CanEditBookmarkManagerFunction>(); |
| - |
| - // History |
| - RegisterFunction<AddUrlHistoryFunction>(); |
| - RegisterFunction<DeleteAllHistoryFunction>(); |
| - RegisterFunction<DeleteRangeHistoryFunction>(); |
| - RegisterFunction<DeleteUrlHistoryFunction>(); |
| - RegisterFunction<GetVisitsHistoryFunction>(); |
| - RegisterFunction<SearchHistoryFunction>(); |
| - |
| - // Idle |
| - RegisterFunction<ExtensionIdleQueryStateFunction>(); |
| - |
| - // I18N. |
| - RegisterFunction<GetAcceptLanguagesFunction>(); |
| - |
| - // Processes. |
| - RegisterFunction<GetProcessIdForTabFunction>(); |
| - |
| - // Metrics. |
| - RegisterFunction<MetricsRecordUserActionFunction>(); |
| - RegisterFunction<MetricsRecordValueFunction>(); |
| - RegisterFunction<MetricsRecordPercentageFunction>(); |
| - RegisterFunction<MetricsRecordCountFunction>(); |
| - RegisterFunction<MetricsRecordSmallCountFunction>(); |
| - RegisterFunction<MetricsRecordMediumCountFunction>(); |
| - RegisterFunction<MetricsRecordTimeFunction>(); |
| - RegisterFunction<MetricsRecordMediumTimeFunction>(); |
| - RegisterFunction<MetricsRecordLongTimeFunction>(); |
| - |
| - // RLZ. |
| -#if defined(OS_WIN) |
| - RegisterFunction<RlzRecordProductEventFunction>(); |
| - RegisterFunction<RlzGetAccessPointRlzFunction>(); |
| - RegisterFunction<RlzSendFinancialPingFunction>(); |
| - RegisterFunction<RlzClearProductStateFunction>(); |
| -#endif |
| - |
| - // Cookies. |
| - RegisterFunction<GetCookieFunction>(); |
| - RegisterFunction<GetAllCookiesFunction>(); |
| - RegisterFunction<SetCookieFunction>(); |
| - RegisterFunction<RemoveCookieFunction>(); |
| - RegisterFunction<GetAllCookieStoresFunction>(); |
| - |
| - // Test. |
| - RegisterFunction<ExtensionTestPassFunction>(); |
| - RegisterFunction<ExtensionTestFailFunction>(); |
| - RegisterFunction<ExtensionTestLogFunction>(); |
| - RegisterFunction<ExtensionTestQuotaResetFunction>(); |
| - RegisterFunction<ExtensionTestCreateIncognitoTabFunction>(); |
| - RegisterFunction<ExtensionTestSendMessageFunction>(); |
| - RegisterFunction<ExtensionTestGetConfigFunction>(); |
| - |
| - // Accessibility. |
| - RegisterFunction<GetFocusedControlFunction>(); |
| - RegisterFunction<SetAccessibilityEnabledFunction>(); |
| - RegisterFunction<GetAlertsForTabFunction>(); |
| - |
| - // Text-to-speech. |
| - RegisterFunction<ExtensionTtsEngineSendTtsEventFunction>(); |
| - RegisterFunction<ExtensionTtsGetVoicesFunction>(); |
| - RegisterFunction<ExtensionTtsIsSpeakingFunction>(); |
| - RegisterFunction<ExtensionTtsSpeakFunction>(); |
| - RegisterFunction<ExtensionTtsStopSpeakingFunction>(); |
| - |
| - // Context Menus. |
| - RegisterFunction<CreateContextMenuFunction>(); |
| - RegisterFunction<UpdateContextMenuFunction>(); |
| - RegisterFunction<RemoveContextMenuFunction>(); |
| - RegisterFunction<RemoveAllContextMenusFunction>(); |
| - |
| - // Omnibox. |
| - RegisterFunction<OmniboxSendSuggestionsFunction>(); |
| - RegisterFunction<OmniboxSetDefaultSuggestionFunction>(); |
| - |
| - // Speech input. |
| - RegisterFunction<StartSpeechInputFunction>(); |
| - RegisterFunction<StopSpeechInputFunction>(); |
| - RegisterFunction<IsRecordingSpeechInputFunction>(); |
| - |
| -#if defined(TOOLKIT_VIEWS) |
| - // Input. |
| - RegisterFunction<SendKeyboardEventInputFunction>(); |
| -#endif |
| - |
| -#if defined(USE_VIRTUAL_KEYBOARD) |
| - RegisterFunction<HideKeyboardFunction>(); |
| - RegisterFunction<SetKeyboardHeightFunction>(); |
| -#endif |
| - |
| -#if defined(OS_CHROMEOS) |
| - // IME |
| - RegisterFunction<SetCompositionFunction>(); |
| - RegisterFunction<ClearCompositionFunction>(); |
| - RegisterFunction<CommitTextFunction>(); |
| - RegisterFunction<SetCandidateWindowPropertiesFunction>(); |
| - RegisterFunction<SetCandidatesFunction>(); |
| - RegisterFunction<SetCursorPositionFunction>(); |
| - RegisterFunction<SetMenuItemsFunction>(); |
| - RegisterFunction<UpdateMenuItemsFunction>(); |
| - |
| - RegisterFunction<InputEventHandled>(); |
| -#if defined(USE_VIRTUAL_KEYBOARD) |
| - RegisterFunction<CandidateClickedInputUiFunction>(); |
| - RegisterFunction<CursorUpInputUiFunction>(); |
| - RegisterFunction<CursorDownInputUiFunction>(); |
| - RegisterFunction<PageUpInputUiFunction>(); |
| - RegisterFunction<PageDownInputUiFunction>(); |
| - RegisterFunction<RegisterInputUiFunction>(); |
| - RegisterFunction<PageUpInputUiFunction>(); |
| - RegisterFunction<PageDownInputUiFunction>(); |
| -#endif |
| -#endif |
| - |
| - // Managed mode. |
| - RegisterFunction<GetManagedModeFunction>(); |
| - RegisterFunction<EnterManagedModeFunction>(); |
| - |
| - // Management. |
| - RegisterFunction<GetAllExtensionsFunction>(); |
| - RegisterFunction<GetExtensionByIdFunction>(); |
| - RegisterFunction<GetPermissionWarningsByIdFunction>(); |
| - RegisterFunction<GetPermissionWarningsByManifestFunction>(); |
| - RegisterFunction<LaunchAppFunction>(); |
| - RegisterFunction<SetEnabledFunction>(); |
| - RegisterFunction<UninstallFunction>(); |
| - |
| - // Extension module. |
| - RegisterFunction<SetUpdateUrlDataFunction>(); |
| - RegisterFunction<IsAllowedIncognitoAccessFunction>(); |
| - RegisterFunction<IsAllowedFileSchemeAccessFunction>(); |
| - |
| - // WebstorePrivate. |
| - RegisterFunction<GetBrowserLoginFunction>(); |
| - RegisterFunction<GetStoreLoginFunction>(); |
| - RegisterFunction<SetStoreLoginFunction>(); |
| - RegisterFunction<InstallBundleFunction>(); |
| - RegisterFunction<BeginInstallWithManifestFunction>(); |
| - RegisterFunction<CompleteInstallFunction>(); |
| - RegisterFunction<SilentlyInstallFunction>(); |
| - RegisterFunction<GetWebGLStatusFunction>(); |
| - |
| - // WebNavigation. |
| - RegisterFunction<GetFrameFunction>(); |
| - RegisterFunction<GetAllFramesFunction>(); |
| - |
| - // WebRequest. |
| - RegisterFunction<WebRequestAddEventListener>(); |
| - RegisterFunction<WebRequestEventHandled>(); |
| - RegisterFunction<WebRequestHandlerBehaviorChanged>(); |
| - |
| - // Preferences. |
| - RegisterFunction<GetPreferenceFunction>(); |
| - RegisterFunction<SetPreferenceFunction>(); |
| - RegisterFunction<ClearPreferenceFunction>(); |
| - |
| - // ChromeOS-specific part of the API. |
| -#if defined(OS_CHROMEOS) |
| - // Device Customization. |
| - RegisterFunction<GetChromeosInfoFunction>(); |
| - |
| - // FileBrowserPrivate functions. |
| - // TODO(jamescook): Expose these on non-ChromeOS platforms so we can use |
| - // the extension-based file picker on Aura. crbug.com/97424 |
| - RegisterFunction<CancelFileDialogFunction>(); |
| - RegisterFunction<ExecuteTasksFileBrowserFunction>(); |
| - RegisterFunction<FileDialogStringsFunction>(); |
| - RegisterFunction<GetFileTasksFileBrowserFunction>(); |
| - RegisterFunction<GetVolumeMetadataFunction>(); |
| - RegisterFunction<RequestLocalFileSystemFunction>(); |
| - RegisterFunction<AddFileWatchBrowserFunction>(); |
| - RegisterFunction<RemoveFileWatchBrowserFunction>(); |
| - RegisterFunction<SelectFileFunction>(); |
| - RegisterFunction<SelectFilesFunction>(); |
| - RegisterFunction<AddMountFunction>(); |
| - RegisterFunction<RemoveMountFunction>(); |
| - RegisterFunction<GetMountPointsFunction>(); |
| - RegisterFunction<GetSizeStatsFunction>(); |
| - RegisterFunction<FormatDeviceFunction>(); |
| - RegisterFunction<ViewFilesFunction>(); |
| - RegisterFunction<ToggleFullscreenFunction>(); |
| - RegisterFunction<IsFullscreenFunction>(); |
| - RegisterFunction<GetGDataFilePropertiesFunction>(); |
| - RegisterFunction<PinGDataFileFunction>(); |
| - RegisterFunction<GetFileLocationsFunction>(); |
| - RegisterFunction<GetGDataFilesFunction>(); |
| - |
| - // Mediaplayer |
| - RegisterFunction<PlayMediaplayerFunction>(); |
| - RegisterFunction<GetPlaylistMediaplayerFunction>(); |
| - RegisterFunction<SetWindowHeightMediaplayerFunction>(); |
| - RegisterFunction<CloseWindowMediaplayerFunction>(); |
| - |
| - // InputMethod |
| - RegisterFunction<GetInputMethodFunction>(); |
| - |
| - // Terminal |
| - RegisterFunction<OpenTerminalProcessFunction>(); |
| - RegisterFunction<SendInputToTerminalProcessFunction>(); |
| - RegisterFunction<CloseTerminalProcessFunction>(); |
| - RegisterFunction<OnTerminalResizeFunction>(); |
| - |
| -#if defined(USE_VIRTUAL_KEYBOARD) |
| - // Input |
| - RegisterFunction<SendHandwritingStrokeFunction>(); |
| - RegisterFunction<CancelHandwritingStrokesFunction>(); |
| -#endif |
| -#endif |
| - |
| - // Websocket to TCP proxy. Currently noop on anything other than ChromeOS. |
| - RegisterFunction<WebSocketProxyPrivateGetPassportForTCPFunction>(); |
| - RegisterFunction<WebSocketProxyPrivateGetURLForTCPFunction>(); |
| - |
| - // Debugger |
| - RegisterFunction<AttachDebuggerFunction>(); |
| - RegisterFunction<DetachDebuggerFunction>(); |
| - RegisterFunction<SendCommandDebuggerFunction>(); |
| - |
| - // Settings |
| - RegisterFunction<extensions::GetSettingsFunction>(); |
| - RegisterFunction<extensions::SetSettingsFunction>(); |
| - RegisterFunction<extensions::RemoveSettingsFunction>(); |
| - RegisterFunction<extensions::ClearSettingsFunction>(); |
| - RegisterFunction<extensions::GetBytesInUseSettingsFunction>(); |
| - |
| - // Content settings. |
| - RegisterFunction<GetResourceIdentifiersFunction>(); |
| - RegisterFunction<ClearContentSettingsFunction>(); |
| - RegisterFunction<GetContentSettingFunction>(); |
| - RegisterFunction<SetContentSettingFunction>(); |
| - |
| - // Font settings. |
| - RegisterFunction<GetFontListFunction>(); |
| - RegisterFunction<GetFontNameFunction>(); |
| - RegisterFunction<SetFontNameFunction>(); |
| - |
| - // ChromeAuth settings. |
| - RegisterFunction<SetCloudPrintCredentialsFunction>(); |
| - |
| - // Experimental App API. |
| - RegisterFunction<AppNotifyFunction>(); |
| - RegisterFunction<AppClearAllNotificationsFunction>(); |
| - |
| - // Permissions |
| - RegisterFunction<ContainsPermissionsFunction>(); |
| - RegisterFunction<GetAllPermissionsFunction>(); |
| - RegisterFunction<RemovePermissionsFunction>(); |
| - RegisterFunction<RequestPermissionsFunction>(); |
| - |
| - // Downloads |
| - RegisterFunction<DownloadsDownloadFunction>(); |
| - RegisterFunction<DownloadsSearchFunction>(); |
| - RegisterFunction<DownloadsPauseFunction>(); |
| - RegisterFunction<DownloadsResumeFunction>(); |
| - RegisterFunction<DownloadsCancelFunction>(); |
| - RegisterFunction<DownloadsEraseFunction>(); |
| - RegisterFunction<DownloadsSetDestinationFunction>(); |
| - RegisterFunction<DownloadsAcceptDangerFunction>(); |
| - RegisterFunction<DownloadsShowFunction>(); |
| - RegisterFunction<DownloadsDragFunction>(); |
| - RegisterFunction<DownloadsGetFileIconFunction>(); |
| - |
| - // PageCapture |
| - RegisterFunction<PageCaptureSaveAsMHTMLFunction>(); |
| - |
| - // TopSites |
| - RegisterFunction<GetTopSitesFunction>(); |
| - |
| - // Serial |
| - RegisterFunction<extensions::SerialOpenFunction>(); |
| - RegisterFunction<extensions::SerialCloseFunction>(); |
| - RegisterFunction<extensions::SerialReadFunction>(); |
| - RegisterFunction<extensions::SerialWriteFunction>(); |
| - |
| - // Sockets |
| - RegisterFunction<extensions::SocketCreateFunction>(); |
| - RegisterFunction<extensions::SocketDestroyFunction>(); |
| - RegisterFunction<extensions::SocketConnectFunction>(); |
| - RegisterFunction<extensions::SocketDisconnectFunction>(); |
| - RegisterFunction<extensions::SocketReadFunction>(); |
| - RegisterFunction<extensions::SocketWriteFunction>(); |
| - |
| - // DNS |
| - RegisterFunction<extensions::DNSResolveFunction>(); |
| - |
| - // System |
| - RegisterFunction<extensions::GetIncognitoModeAvailabilityFunction>(); |
| - RegisterFunction<extensions::GetUpdateStatusFunction>(); |
| - |
| - // Net |
| - RegisterFunction<extensions::AddRulesFunction>(); |
| - RegisterFunction<extensions::RemoveRulesFunction>(); |
| - RegisterFunction<extensions::GetRulesFunction>(); |
| -} |
| - |
| -void FactoryRegistry::GetAllNames(std::vector<std::string>* names) { |
| - for (FactoryMap::iterator iter = factories_.begin(); |
| - iter != factories_.end(); ++iter) { |
| - names->push_back(iter->first); |
| - } |
| -} |
| - |
| -bool FactoryRegistry::OverrideFunction(const std::string& name, |
| - ExtensionFunctionFactory factory) { |
| - FactoryMap::iterator iter = factories_.find(name); |
| - if (iter == factories_.end()) { |
| - return false; |
| - } else { |
| - iter->second = factory; |
| - return true; |
| - } |
| -} |
| - |
| -ExtensionFunction* FactoryRegistry::NewFunction(const std::string& name) { |
| - FactoryMap::iterator iter = factories_.find(name); |
| - DCHECK(iter != factories_.end()); |
| - ExtensionFunction* function = iter->second(); |
| - function->set_name(name); |
| - return function; |
| -} |
| - |
| const char kAccessDenied[] = "access denied"; |
| const char kQuotaExceeded[] = "quota exceeded"; |
| @@ -597,10 +79,6 @@ void LogFailure(const Extension* extension, |
| } |
| } |
| -}; // namespace |
| - |
| -// ExtensionFunctionDispatcher ------------------------------------------------- |
| - |
| void ExtensionFunctionDispatcher::GetAllFunctionNames( |
| std::vector<std::string>* names) { |
| FactoryRegistry::GetInstance()->GetAllNames(names); |