OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/renderer/dispatcher.h" | 5 #include "extensions/renderer/dispatcher.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/alias.h" | 10 #include "base/debug/alias.h" |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 } | 316 } |
317 | 317 |
318 UpdateBindingsForContext(context); | 318 UpdateBindingsForContext(context); |
319 | 319 |
320 bool is_within_platform_app = IsWithinPlatformApp(); | 320 bool is_within_platform_app = IsWithinPlatformApp(); |
321 // Inject custom JS into the platform app context. | 321 // Inject custom JS into the platform app context. |
322 if (is_within_platform_app) { | 322 if (is_within_platform_app) { |
323 module_system->Require("platformApp"); | 323 module_system->Require("platformApp"); |
324 } | 324 } |
325 | 325 |
| 326 // Note: setting up the WebView class here, not the chrome.webview API. |
| 327 // The API will be automatically set up when first used. |
| 328 if (context->GetAvailability("webViewInternal").is_available()) { |
| 329 module_system->Require("webView"); |
| 330 if (context->GetAvailability("webViewExperimentalInternal") |
| 331 .is_available()) { |
| 332 module_system->Require("webViewExperimental"); |
| 333 } |
| 334 } else if (context_type == extensions::Feature::BLESSED_EXTENSION_CONTEXT) { |
| 335 module_system->Require("denyWebView"); |
| 336 } |
| 337 |
326 delegate_->RequireAdditionalModules(context, is_within_platform_app); | 338 delegate_->RequireAdditionalModules(context, is_within_platform_app); |
327 | 339 |
328 VLOG(1) << "Num tracked contexts: " << script_context_set_.size(); | 340 VLOG(1) << "Num tracked contexts: " << script_context_set_.size(); |
329 } | 341 } |
330 | 342 |
331 void Dispatcher::WillReleaseScriptContext( | 343 void Dispatcher::WillReleaseScriptContext( |
332 WebFrame* frame, | 344 WebFrame* frame, |
333 const v8::Handle<v8::Context>& v8_context, | 345 const v8::Handle<v8::Context>& v8_context, |
334 int world_id) { | 346 int world_id) { |
335 ScriptContext* context = script_context_set_.GetByV8Context(v8_context); | 347 ScriptContext* context = script_context_set_.GetByV8Context(v8_context); |
(...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1352 return v8::Handle<v8::Object>(); | 1364 return v8::Handle<v8::Object>(); |
1353 | 1365 |
1354 if (bind_name) | 1366 if (bind_name) |
1355 *bind_name = split.back(); | 1367 *bind_name = split.back(); |
1356 | 1368 |
1357 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) | 1369 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) |
1358 : bind_object; | 1370 : bind_object; |
1359 } | 1371 } |
1360 | 1372 |
1361 } // namespace extensions | 1373 } // namespace extensions |
OLD | NEW |