| 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" |
| (...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 source_map_.RegisterSource("ttsEngine", IDR_TTS_ENGINE_CUSTOM_BINDINGS_JS); | 675 source_map_.RegisterSource("ttsEngine", IDR_TTS_ENGINE_CUSTOM_BINDINGS_JS); |
| 676 source_map_.RegisterSource("types", IDR_TYPES_CUSTOM_BINDINGS_JS); | 676 source_map_.RegisterSource("types", IDR_TYPES_CUSTOM_BINDINGS_JS); |
| 677 source_map_.RegisterSource("webRequest", IDR_WEB_REQUEST_CUSTOM_BINDINGS_JS); | 677 source_map_.RegisterSource("webRequest", IDR_WEB_REQUEST_CUSTOM_BINDINGS_JS); |
| 678 source_map_.RegisterSource("webRequestInternal", | 678 source_map_.RegisterSource("webRequestInternal", |
| 679 IDR_WEB_REQUEST_INTERNAL_CUSTOM_BINDINGS_JS); | 679 IDR_WEB_REQUEST_INTERNAL_CUSTOM_BINDINGS_JS); |
| 680 source_map_.RegisterSource("webstore", IDR_WEBSTORE_CUSTOM_BINDINGS_JS); | 680 source_map_.RegisterSource("webstore", IDR_WEBSTORE_CUSTOM_BINDINGS_JS); |
| 681 | 681 |
| 682 // Platform app sources that are not API-specific.. | 682 // Platform app sources that are not API-specific.. |
| 683 const CommandLine& command_line = *(CommandLine::ForCurrentProcess()); | 683 const CommandLine& command_line = *(CommandLine::ForCurrentProcess()); |
| 684 if (command_line.HasSwitch(switches::kEnableBrowserPluginOldImplementation)) | 684 if (command_line.HasSwitch(switches::kEnableBrowserPluginOldImplementation)) |
| 685 source_map_.RegisterSource("browserTag", IDR_BROWSER_TAG_OLD_JS); | 685 source_map_.RegisterSource("webview", IDR_WEB_VIEW_OLD_JS); |
| 686 else | 686 else |
| 687 source_map_.RegisterSource("browserTag", IDR_BROWSER_TAG_JS); | 687 source_map_.RegisterSource("webview", IDR_WEB_VIEW_JS); |
| 688 source_map_.RegisterSource("platformApp", IDR_PLATFORM_APP_JS); | 688 source_map_.RegisterSource("platformApp", IDR_PLATFORM_APP_JS); |
| 689 source_map_.RegisterSource("injectAppTitlebar", IDR_INJECT_APP_TITLEBAR_JS); | 689 source_map_.RegisterSource("injectAppTitlebar", IDR_INJECT_APP_TITLEBAR_JS); |
| 690 } | 690 } |
| 691 | 691 |
| 692 void Dispatcher::PopulateLazyBindingsMap() { | 692 void Dispatcher::PopulateLazyBindingsMap() { |
| 693 lazy_bindings_map_["app"] = InstallAppBindings; | 693 lazy_bindings_map_["app"] = InstallAppBindings; |
| 694 lazy_bindings_map_["webstore"] = InstallWebstoreBindings; | 694 lazy_bindings_map_["webstore"] = InstallWebstoreBindings; |
| 695 } | 695 } |
| 696 | 696 |
| 697 void Dispatcher::InstallBindings(ModuleSystem* module_system, | 697 void Dispatcher::InstallBindings(ModuleSystem* module_system, |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 | 804 |
| 805 break; | 805 break; |
| 806 } | 806 } |
| 807 } | 807 } |
| 808 | 808 |
| 809 // Inject custom JS into the platform app context. | 809 // Inject custom JS into the platform app context. |
| 810 if (IsWithinPlatformApp(frame)) | 810 if (IsWithinPlatformApp(frame)) |
| 811 module_system->Require("platformApp"); | 811 module_system->Require("platformApp"); |
| 812 | 812 |
| 813 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT && | 813 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT && |
| 814 extension->HasAPIPermission(APIPermission::kBrowserTag)) { | 814 extension->HasAPIPermission(APIPermission::kWebView)) { |
| 815 module_system->Require("browserTag"); | 815 module_system->Require("webview"); |
| 816 } | 816 } |
| 817 | 817 |
| 818 context->set_module_system(module_system.Pass()); | 818 context->set_module_system(module_system.Pass()); |
| 819 | 819 |
| 820 context->DispatchOnLoadEvent( | 820 context->DispatchOnLoadEvent( |
| 821 ChromeRenderProcessObserver::is_incognito_process(), | 821 ChromeRenderProcessObserver::is_incognito_process(), |
| 822 manifest_version); | 822 manifest_version); |
| 823 | 823 |
| 824 VLOG(1) << "Num tracked contexts: " << v8_context_set_.size(); | 824 VLOG(1) << "Num tracked contexts: " << v8_context_set_.size(); |
| 825 } | 825 } |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1127 // we should abort. | 1127 // we should abort. |
| 1128 WebKit::WebFrame* frame = context->web_frame(); | 1128 WebKit::WebFrame* frame = context->web_frame(); |
| 1129 ExtensionURLInfo url_info(frame->document().securityOrigin(), | 1129 ExtensionURLInfo url_info(frame->document().securityOrigin(), |
| 1130 UserScriptSlave::GetDataSourceURLForFrame(frame)); | 1130 UserScriptSlave::GetDataSourceURLForFrame(frame)); |
| 1131 CHECK(!extensions_.IsSandboxedPage(url_info)); | 1131 CHECK(!extensions_.IsSandboxedPage(url_info)); |
| 1132 | 1132 |
| 1133 return true; | 1133 return true; |
| 1134 } | 1134 } |
| 1135 | 1135 |
| 1136 } // namespace extensions | 1136 } // namespace extensions |
| OLD | NEW |