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 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
970 // regardless of |context_type|. ExtensionAPI knows how to return the | 970 // regardless of |context_type|. ExtensionAPI knows how to return the |
971 // correct APIs, however, until it doesn't have a 2MB overhead we can't | 971 // correct APIs, however, until it doesn't have a 2MB overhead we can't |
972 // load it in every process. | 972 // load it in every process. |
973 RegisterSchemaGeneratedBindings(module_system.get(), | 973 RegisterSchemaGeneratedBindings(module_system.get(), |
974 context, | 974 context, |
975 v8_context); | 975 v8_context); |
976 break; | 976 break; |
977 } | 977 } |
978 } | 978 } |
979 | 979 |
980 bool is_within_platform_app = extension && extension->is_platform_app(); | |
Charlie Reis
2013/03/20 01:52:25
Wait, you're changing behavior here. We're using
| |
980 // Inject custom JS into the platform app context. | 981 // Inject custom JS into the platform app context. |
981 if (IsWithinPlatformApp(frame)) | 982 if (is_within_platform_app) |
982 module_system->Require("platformApp"); | 983 module_system->Require("platformApp"); |
983 | 984 |
984 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { | 985 // Only platform apps support the <webview> tag, because the "webView" and |
986 // "denyWebView" modules will affect the performance of DOM modifications | |
987 // (http://crbug.com/196453). | |
988 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT && | |
989 is_within_platform_app) { | |
985 // Note: setting up the WebView class here, not the chrome.webview API. | 990 // Note: setting up the WebView class here, not the chrome.webview API. |
986 // The API will be automatically set up when first used. | 991 // The API will be automatically set up when first used. |
987 if (extension->HasAPIPermission(APIPermission::kWebView)) { | 992 if (extension->HasAPIPermission(APIPermission::kWebView)) { |
988 module_system->Require("webView"); | 993 module_system->Require("webView"); |
989 if (Feature::GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV) | 994 if (Feature::GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV) |
990 module_system->Require("webViewExperimental"); | 995 module_system->Require("webViewExperimental"); |
991 } else { | 996 } else { |
992 module_system->Require("denyWebView"); | 997 module_system->Require("denyWebView"); |
993 } | 998 } |
994 } | 999 } |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1321 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str()); | 1326 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str()); |
1322 v8::ThrowException( | 1327 v8::ThrowException( |
1323 v8::Exception::Error(v8::String::New(error_msg.c_str()))); | 1328 v8::Exception::Error(v8::String::New(error_msg.c_str()))); |
1324 return false; | 1329 return false; |
1325 } | 1330 } |
1326 | 1331 |
1327 return true; | 1332 return true; |
1328 } | 1333 } |
1329 | 1334 |
1330 } // namespace extensions | 1335 } // namespace extensions |
OLD | NEW |