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 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
974 context, | 974 context, |
975 v8_context); | 975 v8_context); |
976 break; | 976 break; |
977 } | 977 } |
978 } | 978 } |
979 | 979 |
980 // Inject custom JS into the platform app context. | 980 // Inject custom JS into the platform app context. |
981 if (IsWithinPlatformApp(frame)) | 981 if (IsWithinPlatformApp(frame)) |
982 module_system->Require("platformApp"); | 982 module_system->Require("platformApp"); |
983 | 983 |
984 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { | 984 // Only platform app need to support <webview> tag, "webView" and |
Charlie Reis
2013/03/18 15:16:05
Please fix typos:
Only platform apps support the <
| |
985 // "denyWebView" modules will effect the performace of the DOM modification | |
Charlie Reis
2013/03/18 15:16:05
nit: will effect -> affect
nit: performance of DOM
| |
986 // (http://crbug.com/196453). | |
987 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT && | |
988 IsWithinPlatformApp(frame)) { | |
PhistucK
2013/03/18 17:50:41
Just driving by -
Maybe cache the result of IsWith
| |
985 // Note: setting up the WebView class here, not the chrome.webview API. | 989 // Note: setting up the WebView class here, not the chrome.webview API. |
986 // The API will be automatically set up when first used. | 990 // The API will be automatically set up when first used. |
987 if (extension->HasAPIPermission(APIPermission::kWebView)) { | 991 if (extension->HasAPIPermission(APIPermission::kWebView)) { |
988 module_system->Require("webView"); | 992 module_system->Require("webView"); |
989 if (Feature::GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV) | 993 if (Feature::GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV) |
990 module_system->Require("webViewExperimental"); | 994 module_system->Require("webViewExperimental"); |
991 } else { | 995 } else { |
992 module_system->Require("denyWebView"); | 996 module_system->Require("denyWebView"); |
993 } | 997 } |
994 } | 998 } |
(...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()); | 1325 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str()); |
1322 v8::ThrowException( | 1326 v8::ThrowException( |
1323 v8::Exception::Error(v8::String::New(error_msg.c_str()))); | 1327 v8::Exception::Error(v8::String::New(error_msg.c_str()))); |
1324 return false; | 1328 return false; |
1325 } | 1329 } |
1326 | 1330 |
1327 return true; | 1331 return true; |
1328 } | 1332 } |
1329 | 1333 |
1330 } // namespace extensions | 1334 } // namespace extensions |
OLD | NEW |