| 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/renderer/extensions/dispatcher.h" | 5 #include "chrome/renderer/extensions/dispatcher.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
| 11 #include "chrome/common/child_process_logging.h" | 11 #include "chrome/common/child_process_logging.h" |
| 12 #include "chrome/common/chrome_switches.h" | 12 #include "chrome/common/chrome_switches.h" |
| 13 #include "chrome/common/chrome_version_info.h" | 13 #include "chrome/common/chrome_version_info.h" |
| 14 #include "chrome/common/extensions/api/extension_api.h" | 14 #include "chrome/common/extensions/api/extension_api.h" |
| 15 #include "chrome/common/extensions/extension.h" | 15 #include "chrome/common/extensions/extension.h" |
| 16 #include "chrome/common/extensions/extension_messages.h" | 16 #include "chrome/common/extensions/extension_messages.h" |
| 17 #include "chrome/common/extensions/permissions/permission_set.h" | 17 #include "chrome/common/extensions/permissions/permission_set.h" |
| 18 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
| 19 #include "chrome/common/view_type.h" | 19 #include "chrome/common/view_type.h" |
| 20 #include "chrome/renderer/chrome_render_process_observer.h" | 20 #include "chrome/renderer/chrome_render_process_observer.h" |
| 21 #include "chrome/renderer/extensions/api_definitions_natives.h" | 21 #include "chrome/renderer/extensions/api_definitions_natives.h" |
| 22 #include "chrome/renderer/extensions/app_bindings.h" | 22 #include "chrome/renderer/extensions/app_bindings.h" |
| 23 #include "chrome/renderer/extensions/app_runtime_custom_bindings.h" | 23 #include "chrome/renderer/extensions/app_runtime_custom_bindings.h" |
| 24 #include "chrome/renderer/extensions/app_window_custom_bindings.h" | 24 #include "chrome/renderer/extensions/app_window_custom_bindings.h" |
| 25 #include "chrome/renderer/extensions/chrome_v8_context.h" | 25 #include "chrome/renderer/extensions/chrome_v8_context.h" |
| 26 #include "chrome/renderer/extensions/chrome_v8_extension.h" | 26 #include "chrome/renderer/extensions/chrome_v8_extension.h" |
| 27 #include "chrome/renderer/extensions/context_menus_custom_bindings.h" | 27 #include "chrome/renderer/extensions/context_menus_custom_bindings.h" |
| 28 #include "chrome/renderer/extensions/downloads_custom_bindings.h" |
| 28 #include "chrome/renderer/extensions/event_bindings.h" | 29 #include "chrome/renderer/extensions/event_bindings.h" |
| 29 #include "chrome/renderer/extensions/extension_custom_bindings.h" | 30 #include "chrome/renderer/extensions/extension_custom_bindings.h" |
| 30 #include "chrome/renderer/extensions/extension_groups.h" | 31 #include "chrome/renderer/extensions/extension_groups.h" |
| 31 #include "chrome/renderer/extensions/extension_helper.h" | 32 #include "chrome/renderer/extensions/extension_helper.h" |
| 32 #include "chrome/renderer/extensions/file_browser_handler_custom_bindings.h" | 33 #include "chrome/renderer/extensions/file_browser_handler_custom_bindings.h" |
| 33 #include "chrome/renderer/extensions/file_browser_private_custom_bindings.h" | 34 #include "chrome/renderer/extensions/file_browser_private_custom_bindings.h" |
| 34 #include "chrome/renderer/extensions/file_system_natives.h" | 35 #include "chrome/renderer/extensions/file_system_natives.h" |
| 35 #include "chrome/renderer/extensions/i18n_custom_bindings.h" | 36 #include "chrome/renderer/extensions/i18n_custom_bindings.h" |
| 36 #include "chrome/renderer/extensions/media_galleries_custom_bindings.h" | 37 #include "chrome/renderer/extensions/media_galleries_custom_bindings.h" |
| 37 #include "chrome/renderer/extensions/miscellaneous_bindings.h" | 38 #include "chrome/renderer/extensions/miscellaneous_bindings.h" |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 | 572 |
| 572 // Custom bindings. | 573 // Custom bindings. |
| 573 module_system->RegisterNativeHandler("app", | 574 module_system->RegisterNativeHandler("app", |
| 574 scoped_ptr<NativeHandler>(new AppBindings(this, context))); | 575 scoped_ptr<NativeHandler>(new AppBindings(this, context))); |
| 575 module_system->RegisterNativeHandler("app_runtime", | 576 module_system->RegisterNativeHandler("app_runtime", |
| 576 scoped_ptr<NativeHandler>(new AppRuntimeCustomBindings())); | 577 scoped_ptr<NativeHandler>(new AppRuntimeCustomBindings())); |
| 577 module_system->RegisterNativeHandler("app_window", | 578 module_system->RegisterNativeHandler("app_window", |
| 578 scoped_ptr<NativeHandler>(new AppWindowCustomBindings(this))); | 579 scoped_ptr<NativeHandler>(new AppWindowCustomBindings(this))); |
| 579 module_system->RegisterNativeHandler("context_menus", | 580 module_system->RegisterNativeHandler("context_menus", |
| 580 scoped_ptr<NativeHandler>(new ContextMenusCustomBindings())); | 581 scoped_ptr<NativeHandler>(new ContextMenusCustomBindings())); |
| 582 module_system->RegisterNativeHandler("downloads", |
| 583 scoped_ptr<NativeHandler>(new DownloadsCustomBindings())); |
| 581 module_system->RegisterNativeHandler("extension", | 584 module_system->RegisterNativeHandler("extension", |
| 582 scoped_ptr<NativeHandler>( | 585 scoped_ptr<NativeHandler>( |
| 583 new ExtensionCustomBindings(this))); | 586 new ExtensionCustomBindings(this))); |
| 584 module_system->RegisterNativeHandler("sync_file_system", | |
| 585 scoped_ptr<NativeHandler>(new SyncFileSystemCustomBindings())); | |
| 586 module_system->RegisterNativeHandler("file_browser_handler", | 587 module_system->RegisterNativeHandler("file_browser_handler", |
| 587 scoped_ptr<NativeHandler>(new FileBrowserHandlerCustomBindings())); | 588 scoped_ptr<NativeHandler>(new FileBrowserHandlerCustomBindings())); |
| 588 module_system->RegisterNativeHandler("file_browser_private", | 589 module_system->RegisterNativeHandler("file_browser_private", |
| 589 scoped_ptr<NativeHandler>(new FileBrowserPrivateCustomBindings())); | 590 scoped_ptr<NativeHandler>(new FileBrowserPrivateCustomBindings())); |
| 590 module_system->RegisterNativeHandler("i18n", | 591 module_system->RegisterNativeHandler("i18n", |
| 591 scoped_ptr<NativeHandler>(new I18NCustomBindings())); | 592 scoped_ptr<NativeHandler>(new I18NCustomBindings())); |
| 592 module_system->RegisterNativeHandler("mediaGalleries", | 593 module_system->RegisterNativeHandler("mediaGalleries", |
| 593 scoped_ptr<NativeHandler>(new MediaGalleriesCustomBindings())); | 594 scoped_ptr<NativeHandler>(new MediaGalleriesCustomBindings())); |
| 594 module_system->RegisterNativeHandler("page_actions", | 595 module_system->RegisterNativeHandler("page_actions", |
| 595 scoped_ptr<NativeHandler>( | 596 scoped_ptr<NativeHandler>( |
| 596 new PageActionsCustomBindings(this))); | 597 new PageActionsCustomBindings(this))); |
| 597 module_system->RegisterNativeHandler("page_capture", | 598 module_system->RegisterNativeHandler("page_capture", |
| 598 scoped_ptr<NativeHandler>(new PageCaptureCustomBindings())); | 599 scoped_ptr<NativeHandler>(new PageCaptureCustomBindings())); |
| 599 module_system->RegisterNativeHandler("runtime", | 600 module_system->RegisterNativeHandler("runtime", |
| 600 scoped_ptr<NativeHandler>(new RuntimeCustomBindings(context))); | 601 scoped_ptr<NativeHandler>(new RuntimeCustomBindings(context))); |
| 602 module_system->RegisterNativeHandler("sync_file_system", |
| 603 scoped_ptr<NativeHandler>(new SyncFileSystemCustomBindings())); |
| 601 module_system->RegisterNativeHandler("tabs", | 604 module_system->RegisterNativeHandler("tabs", |
| 602 scoped_ptr<NativeHandler>(new TabsCustomBindings())); | 605 scoped_ptr<NativeHandler>(new TabsCustomBindings())); |
| 603 module_system->RegisterNativeHandler("tts", | 606 module_system->RegisterNativeHandler("tts", |
| 604 scoped_ptr<NativeHandler>(new TTSCustomBindings())); | 607 scoped_ptr<NativeHandler>(new TTSCustomBindings())); |
| 605 module_system->RegisterNativeHandler("web_request", | 608 module_system->RegisterNativeHandler("web_request", |
| 606 scoped_ptr<NativeHandler>(new WebRequestCustomBindings())); | 609 scoped_ptr<NativeHandler>(new WebRequestCustomBindings())); |
| 607 module_system->RegisterNativeHandler("webstore", | 610 module_system->RegisterNativeHandler("webstore", |
| 608 scoped_ptr<NativeHandler>(new WebstoreBindings(this, context))); | 611 scoped_ptr<NativeHandler>(new WebstoreBindings(this, context))); |
| 609 } | 612 } |
| 610 | 613 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 631 source_map_.RegisterSource("app.window", IDR_APP_WINDOW_CUSTOM_BINDINGS_JS); | 634 source_map_.RegisterSource("app.window", IDR_APP_WINDOW_CUSTOM_BINDINGS_JS); |
| 632 source_map_.RegisterSource("bluetooth", IDR_BLUETOOTH_CUSTOM_BINDINGS_JS); | 635 source_map_.RegisterSource("bluetooth", IDR_BLUETOOTH_CUSTOM_BINDINGS_JS); |
| 633 source_map_.RegisterSource("browserAction", | 636 source_map_.RegisterSource("browserAction", |
| 634 IDR_BROWSER_ACTION_CUSTOM_BINDINGS_JS); | 637 IDR_BROWSER_ACTION_CUSTOM_BINDINGS_JS); |
| 635 source_map_.RegisterSource("contentSettings", | 638 source_map_.RegisterSource("contentSettings", |
| 636 IDR_CONTENT_SETTINGS_CUSTOM_BINDINGS_JS); | 639 IDR_CONTENT_SETTINGS_CUSTOM_BINDINGS_JS); |
| 637 source_map_.RegisterSource("contextMenus", | 640 source_map_.RegisterSource("contextMenus", |
| 638 IDR_CONTEXT_MENUS_CUSTOM_BINDINGS_JS); | 641 IDR_CONTEXT_MENUS_CUSTOM_BINDINGS_JS); |
| 639 source_map_.RegisterSource("declarativeWebRequest", | 642 source_map_.RegisterSource("declarativeWebRequest", |
| 640 IDR_DECLARATIVE_WEBREQUEST_CUSTOM_BINDINGS_JS); | 643 IDR_DECLARATIVE_WEBREQUEST_CUSTOM_BINDINGS_JS); |
| 644 source_map_.RegisterSource("downloads", |
| 645 IDR_DOWNLOADS_CUSTOM_BINDINGS_JS); |
| 641 source_map_.RegisterSource( | 646 source_map_.RegisterSource( |
| 642 "experimental.mediaGalleries", | 647 "experimental.mediaGalleries", |
| 643 IDR_EXPERIMENTAL_MEDIA_GALLERIES_CUSTOM_BINDINGS_JS); | 648 IDR_EXPERIMENTAL_MEDIA_GALLERIES_CUSTOM_BINDINGS_JS); |
| 644 source_map_.RegisterSource("experimental.offscreen", | 649 source_map_.RegisterSource("experimental.offscreen", |
| 645 IDR_EXPERIMENTAL_OFFSCREENTABS_CUSTOM_BINDINGS_JS); | 650 IDR_EXPERIMENTAL_OFFSCREENTABS_CUSTOM_BINDINGS_JS); |
| 646 source_map_.RegisterSource("extension", IDR_EXTENSION_CUSTOM_BINDINGS_JS); | 651 source_map_.RegisterSource("extension", IDR_EXTENSION_CUSTOM_BINDINGS_JS); |
| 647 source_map_.RegisterSource("fileBrowserHandler", | 652 source_map_.RegisterSource("fileBrowserHandler", |
| 648 IDR_FILE_BROWSER_HANDLER_CUSTOM_BINDINGS_JS); | 653 IDR_FILE_BROWSER_HANDLER_CUSTOM_BINDINGS_JS); |
| 649 source_map_.RegisterSource("fileBrowserPrivate", | 654 source_map_.RegisterSource("fileBrowserPrivate", |
| 650 IDR_FILE_BROWSER_PRIVATE_CUSTOM_BINDINGS_JS); | 655 IDR_FILE_BROWSER_PRIVATE_CUSTOM_BINDINGS_JS); |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1131 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str()); | 1136 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str()); |
| 1132 v8::ThrowException( | 1137 v8::ThrowException( |
| 1133 v8::Exception::Error(v8::String::New(error_msg.c_str()))); | 1138 v8::Exception::Error(v8::String::New(error_msg.c_str()))); |
| 1134 return false; | 1139 return false; |
| 1135 } | 1140 } |
| 1136 | 1141 |
| 1137 return true; | 1142 return true; |
| 1138 } | 1143 } |
| 1139 | 1144 |
| 1140 } // namespace extensions | 1145 } // namespace extensions |
| OLD | NEW |