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/extension_dispatcher.h" | 5 #include "chrome/renderer/extensions/extension_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" |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 // Custom bindings. | 556 // Custom bindings. |
557 module_system->RegisterNativeHandler("app", | 557 module_system->RegisterNativeHandler("app", |
558 scoped_ptr<NativeHandler>(new AppBindings(this, context))); | 558 scoped_ptr<NativeHandler>(new AppBindings(this, context))); |
559 module_system->RegisterNativeHandler("app_window", | 559 module_system->RegisterNativeHandler("app_window", |
560 scoped_ptr<NativeHandler>(new AppWindowCustomBindings(this))); | 560 scoped_ptr<NativeHandler>(new AppWindowCustomBindings(this))); |
561 module_system->RegisterNativeHandler("context_menus", | 561 module_system->RegisterNativeHandler("context_menus", |
562 scoped_ptr<NativeHandler>(new ContextMenusCustomBindings())); | 562 scoped_ptr<NativeHandler>(new ContextMenusCustomBindings())); |
563 module_system->RegisterNativeHandler("extension", | 563 module_system->RegisterNativeHandler("extension", |
564 scoped_ptr<NativeHandler>( | 564 scoped_ptr<NativeHandler>( |
565 new ExtensionCustomBindings(this))); | 565 new ExtensionCustomBindings(this))); |
566 module_system->RegisterNativeHandler("experimental_mediaGalleries", | |
567 scoped_ptr<NativeHandler>(new MediaGalleryCustomBindings())); | |
568 module_system->RegisterNativeHandler("experimental_app", | 566 module_system->RegisterNativeHandler("experimental_app", |
569 scoped_ptr<NativeHandler>(new ExperimentalAppCustomBindings())); | 567 scoped_ptr<NativeHandler>(new ExperimentalAppCustomBindings())); |
570 module_system->RegisterNativeHandler("experimental_usb", | 568 module_system->RegisterNativeHandler("experimental_usb", |
571 scoped_ptr<NativeHandler>(new ExperimentalUsbCustomBindings())); | 569 scoped_ptr<NativeHandler>(new ExperimentalUsbCustomBindings())); |
572 module_system->RegisterNativeHandler("file_browser_handler", | 570 module_system->RegisterNativeHandler("file_browser_handler", |
573 scoped_ptr<NativeHandler>(new FileBrowserHandlerCustomBindings())); | 571 scoped_ptr<NativeHandler>(new FileBrowserHandlerCustomBindings())); |
574 module_system->RegisterNativeHandler("file_browser_private", | 572 module_system->RegisterNativeHandler("file_browser_private", |
575 scoped_ptr<NativeHandler>(new FileBrowserPrivateCustomBindings())); | 573 scoped_ptr<NativeHandler>(new FileBrowserPrivateCustomBindings())); |
576 module_system->RegisterNativeHandler("i18n", | 574 module_system->RegisterNativeHandler("i18n", |
577 scoped_ptr<NativeHandler>(new I18NCustomBindings())); | 575 scoped_ptr<NativeHandler>(new I18NCustomBindings())); |
| 576 module_system->RegisterNativeHandler("mediaGalleries", |
| 577 scoped_ptr<NativeHandler>(new MediaGalleryCustomBindings())); |
578 module_system->RegisterNativeHandler("page_actions", | 578 module_system->RegisterNativeHandler("page_actions", |
579 scoped_ptr<NativeHandler>( | 579 scoped_ptr<NativeHandler>( |
580 new PageActionsCustomBindings(this))); | 580 new PageActionsCustomBindings(this))); |
581 module_system->RegisterNativeHandler("page_capture", | 581 module_system->RegisterNativeHandler("page_capture", |
582 scoped_ptr<NativeHandler>(new PageCaptureCustomBindings())); | 582 scoped_ptr<NativeHandler>(new PageCaptureCustomBindings())); |
583 module_system->RegisterNativeHandler("runtime", | 583 module_system->RegisterNativeHandler("runtime", |
584 scoped_ptr<NativeHandler>(new RuntimeCustomBindings(context))); | 584 scoped_ptr<NativeHandler>(new RuntimeCustomBindings(context))); |
585 module_system->RegisterNativeHandler("tabs", | 585 module_system->RegisterNativeHandler("tabs", |
586 scoped_ptr<NativeHandler>(new TabsCustomBindings())); | 586 scoped_ptr<NativeHandler>(new TabsCustomBindings())); |
587 module_system->RegisterNativeHandler("tts", | 587 module_system->RegisterNativeHandler("tts", |
(...skipping 30 matching lines...) Expand all Loading... |
618 source_map_.RegisterSource("contextMenus", | 618 source_map_.RegisterSource("contextMenus", |
619 IDR_CONTEXT_MENUS_CUSTOM_BINDINGS_JS); | 619 IDR_CONTEXT_MENUS_CUSTOM_BINDINGS_JS); |
620 source_map_.RegisterSource("declarativeWebRequest", | 620 source_map_.RegisterSource("declarativeWebRequest", |
621 IDR_DECLARATIVE_WEBREQUEST_CUSTOM_BINDINGS_JS); | 621 IDR_DECLARATIVE_WEBREQUEST_CUSTOM_BINDINGS_JS); |
622 source_map_.RegisterSource("devtools", IDR_DEVTOOLS_CUSTOM_BINDINGS_JS); | 622 source_map_.RegisterSource("devtools", IDR_DEVTOOLS_CUSTOM_BINDINGS_JS); |
623 source_map_.RegisterSource("experimental.app", | 623 source_map_.RegisterSource("experimental.app", |
624 IDR_EXPERIMENTAL_APP_CUSTOM_BINDINGS_JS); | 624 IDR_EXPERIMENTAL_APP_CUSTOM_BINDINGS_JS); |
625 source_map_.RegisterSource("experimental.bluetooth", | 625 source_map_.RegisterSource("experimental.bluetooth", |
626 IDR_EXPERIMENTAL_BLUETOOTH_CUSTOM_BINDINGS_JS); | 626 IDR_EXPERIMENTAL_BLUETOOTH_CUSTOM_BINDINGS_JS); |
627 source_map_.RegisterSource("experimental.mediaGalleries", | 627 source_map_.RegisterSource("experimental.mediaGalleries", |
628 IDR_MEDIA_GALLERY_CUSTOM_BINDINGS_JS); | 628 IDR_EXPERIMENTAL_MEDIA_GALLERY_CUSTOM_BINDINGS_JS); |
629 source_map_.RegisterSource("experimental.offscreen", | 629 source_map_.RegisterSource("experimental.offscreen", |
630 IDR_EXPERIMENTAL_OFFSCREENTABS_CUSTOM_BINDINGS_JS); | 630 IDR_EXPERIMENTAL_OFFSCREENTABS_CUSTOM_BINDINGS_JS); |
631 source_map_.RegisterSource("experimental.usb", | 631 source_map_.RegisterSource("experimental.usb", |
632 IDR_EXPERIMENTAL_USB_CUSTOM_BINDINGS_JS); | 632 IDR_EXPERIMENTAL_USB_CUSTOM_BINDINGS_JS); |
633 source_map_.RegisterSource("extension", IDR_EXTENSION_CUSTOM_BINDINGS_JS); | 633 source_map_.RegisterSource("extension", IDR_EXTENSION_CUSTOM_BINDINGS_JS); |
634 source_map_.RegisterSource("fileBrowserHandler", | 634 source_map_.RegisterSource("fileBrowserHandler", |
635 IDR_FILE_BROWSER_HANDLER_CUSTOM_BINDINGS_JS); | 635 IDR_FILE_BROWSER_HANDLER_CUSTOM_BINDINGS_JS); |
636 source_map_.RegisterSource("fileBrowserPrivate", | 636 source_map_.RegisterSource("fileBrowserPrivate", |
637 IDR_FILE_BROWSER_PRIVATE_CUSTOM_BINDINGS_JS); | 637 IDR_FILE_BROWSER_PRIVATE_CUSTOM_BINDINGS_JS); |
638 source_map_.RegisterSource("fileSystem", | 638 source_map_.RegisterSource("fileSystem", |
639 IDR_FILE_SYSTEM_CUSTOM_BINDINGS_JS); | 639 IDR_FILE_SYSTEM_CUSTOM_BINDINGS_JS); |
640 source_map_.RegisterSource("i18n", IDR_I18N_CUSTOM_BINDINGS_JS); | 640 source_map_.RegisterSource("i18n", IDR_I18N_CUSTOM_BINDINGS_JS); |
641 source_map_.RegisterSource("input.ime", IDR_INPUT_IME_CUSTOM_BINDINGS_JS); | 641 source_map_.RegisterSource("input.ime", IDR_INPUT_IME_CUSTOM_BINDINGS_JS); |
| 642 source_map_.RegisterSource("mediaGalleries", |
| 643 IDR_MEDIA_GALLERY_CUSTOM_BINDINGS_JS); |
642 source_map_.RegisterSource("omnibox", IDR_OMNIBOX_CUSTOM_BINDINGS_JS); | 644 source_map_.RegisterSource("omnibox", IDR_OMNIBOX_CUSTOM_BINDINGS_JS); |
643 source_map_.RegisterSource("pageActions", | 645 source_map_.RegisterSource("pageActions", |
644 IDR_PAGE_ACTIONS_CUSTOM_BINDINGS_JS); | 646 IDR_PAGE_ACTIONS_CUSTOM_BINDINGS_JS); |
645 source_map_.RegisterSource("pageAction", IDR_PAGE_ACTION_CUSTOM_BINDINGS_JS); | 647 source_map_.RegisterSource("pageAction", IDR_PAGE_ACTION_CUSTOM_BINDINGS_JS); |
646 source_map_.RegisterSource("pageCapture", | 648 source_map_.RegisterSource("pageCapture", |
647 IDR_PAGE_CAPTURE_CUSTOM_BINDINGS_JS); | 649 IDR_PAGE_CAPTURE_CUSTOM_BINDINGS_JS); |
648 source_map_.RegisterSource("runtime", IDR_RUNTIME_CUSTOM_BINDINGS_JS); | 650 source_map_.RegisterSource("runtime", IDR_RUNTIME_CUSTOM_BINDINGS_JS); |
649 source_map_.RegisterSource("storage", IDR_STORAGE_CUSTOM_BINDINGS_JS); | 651 source_map_.RegisterSource("storage", IDR_STORAGE_CUSTOM_BINDINGS_JS); |
650 source_map_.RegisterSource("tabs", IDR_TABS_CUSTOM_BINDINGS_JS); | 652 source_map_.RegisterSource("tabs", IDR_TABS_CUSTOM_BINDINGS_JS); |
651 source_map_.RegisterSource("tts", IDR_TTS_CUSTOM_BINDINGS_JS); | 653 source_map_.RegisterSource("tts", IDR_TTS_CUSTOM_BINDINGS_JS); |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1068 // APIs, they don't get extension bindings injected. If we end up here it | 1070 // APIs, they don't get extension bindings injected. If we end up here it |
1069 // means that a sandboxed page somehow managed to invoke an API anyway, so | 1071 // means that a sandboxed page somehow managed to invoke an API anyway, so |
1070 // we should abort. | 1072 // we should abort. |
1071 WebKit::WebFrame* frame = context->web_frame(); | 1073 WebKit::WebFrame* frame = context->web_frame(); |
1072 ExtensionURLInfo url_info(frame->document().securityOrigin(), | 1074 ExtensionURLInfo url_info(frame->document().securityOrigin(), |
1073 extensions::UserScriptSlave::GetDataSourceURLForFrame(frame)); | 1075 extensions::UserScriptSlave::GetDataSourceURLForFrame(frame)); |
1074 CHECK(!extensions_.IsSandboxedPage(url_info)); | 1076 CHECK(!extensions_.IsSandboxedPage(url_info)); |
1075 | 1077 |
1076 return true; | 1078 return true; |
1077 } | 1079 } |
OLD | NEW |