Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(376)

Side by Side Diff: chrome/renderer/chrome_content_renderer_client.cc

Issue 985643004: Make ContentRendererClient::DidCreateScriptContext take a WebLocalFrame. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: namespace Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/chrome_content_renderer_client.h" 5 #include "chrome/renderer/chrome_content_renderer_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/crash_logging.h" 8 #include "base/debug/crash_logging.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 using base::UserMetricsAction; 156 using base::UserMetricsAction;
157 using content::PluginInstanceThrottler; 157 using content::PluginInstanceThrottler;
158 using content::RenderFrame; 158 using content::RenderFrame;
159 using content::RenderThread; 159 using content::RenderThread;
160 using content::WebPluginInfo; 160 using content::WebPluginInfo;
161 using extensions::Extension; 161 using extensions::Extension;
162 using blink::WebCache; 162 using blink::WebCache;
163 using blink::WebConsoleMessage; 163 using blink::WebConsoleMessage;
164 using blink::WebDataSource; 164 using blink::WebDataSource;
165 using blink::WebDocument; 165 using blink::WebDocument;
166 using blink::WebFrame;
167 using blink::WebLocalFrame;
168 using blink::WebPlugin; 166 using blink::WebPlugin;
169 using blink::WebPluginParams; 167 using blink::WebPluginParams;
170 using blink::WebSecurityOrigin; 168 using blink::WebSecurityOrigin;
171 using blink::WebSecurityPolicy; 169 using blink::WebSecurityPolicy;
172 using blink::WebString; 170 using blink::WebString;
173 using blink::WebURL; 171 using blink::WebURL;
174 using blink::WebURLError; 172 using blink::WebURLError;
175 using blink::WebURLRequest; 173 using blink::WebURLRequest;
176 using blink::WebURLResponse; 174 using blink::WebURLResponse;
177 using blink::WebVector; 175 using blink::WebVector;
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 ChromeContentRendererClient::CreatePluginPlaceholder( 624 ChromeContentRendererClient::CreatePluginPlaceholder(
627 content::RenderFrame* render_frame, 625 content::RenderFrame* render_frame,
628 blink::WebLocalFrame* frame, 626 blink::WebLocalFrame* frame,
629 const blink::WebPluginParams& orig_params) { 627 const blink::WebPluginParams& orig_params) {
630 return CreateShadowDOMPlaceholderForPluginInfo( 628 return CreateShadowDOMPlaceholderForPluginInfo(
631 render_frame, frame, orig_params); 629 render_frame, frame, orig_params);
632 } 630 }
633 631
634 bool ChromeContentRendererClient::OverrideCreatePlugin( 632 bool ChromeContentRendererClient::OverrideCreatePlugin(
635 content::RenderFrame* render_frame, 633 content::RenderFrame* render_frame,
636 WebLocalFrame* frame, 634 blink::WebLocalFrame* frame,
637 const WebPluginParams& params, 635 const WebPluginParams& params,
638 WebPlugin** plugin) { 636 WebPlugin** plugin) {
639 std::string orig_mime_type = params.mimeType.utf8(); 637 std::string orig_mime_type = params.mimeType.utf8();
640 #if defined(ENABLE_EXTENSIONS) 638 #if defined(ENABLE_EXTENSIONS)
641 if (orig_mime_type == content::kBrowserPluginMimeType) { 639 if (orig_mime_type == content::kBrowserPluginMimeType) {
642 bool guest_view_api_available = false; 640 bool guest_view_api_available = false;
643 extension_dispatcher_->script_context_set().ForEach( 641 extension_dispatcher_->script_context_set().ForEach(
644 render_frame->GetRenderView(), 642 render_frame->GetRenderView(),
645 base::Bind(&IsGuestViewApiAvailableToScriptContext, 643 base::Bind(&IsGuestViewApiAvailableToScriptContext,
646 &guest_view_api_available)); 644 &guest_view_api_available));
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 return; 681 return;
684 } 682 }
685 683
686 // Lifetime is tied to |render_frame| via content::RenderFrameObserver. 684 // Lifetime is tied to |render_frame| via content::RenderFrameObserver.
687 new prerender::PrerenderMediaLoadDeferrer(render_frame, closure); 685 new prerender::PrerenderMediaLoadDeferrer(render_frame, closure);
688 #endif 686 #endif
689 } 687 }
690 688
691 WebPlugin* ChromeContentRendererClient::CreatePlugin( 689 WebPlugin* ChromeContentRendererClient::CreatePlugin(
692 content::RenderFrame* render_frame, 690 content::RenderFrame* render_frame,
693 WebLocalFrame* frame, 691 blink::WebLocalFrame* frame,
694 const WebPluginParams& original_params, 692 const WebPluginParams& original_params,
695 const ChromeViewHostMsg_GetPluginInfo_Output& output) { 693 const ChromeViewHostMsg_GetPluginInfo_Output& output) {
696 const ChromeViewHostMsg_GetPluginInfo_Status& status = output.status; 694 const ChromeViewHostMsg_GetPluginInfo_Status& status = output.status;
697 const WebPluginInfo& info = output.plugin; 695 const WebPluginInfo& info = output.plugin;
698 const std::string& actual_mime_type = output.actual_mime_type; 696 const std::string& actual_mime_type = output.actual_mime_type;
699 const base::string16& group_name = output.group_name; 697 const base::string16& group_name = output.group_name;
700 const std::string& identifier = output.group_identifier; 698 const std::string& identifier = output.group_identifier;
701 ChromeViewHostMsg_GetPluginInfo_Status::Value status_value = status.value; 699 ChromeViewHostMsg_GetPluginInfo_Status::Value status_value = status.value;
702 GURL url(original_params.url); 700 GURL url(original_params.url);
703 std::string orig_mime_type = original_params.mimeType.utf8(); 701 std::string orig_mime_type = original_params.mimeType.utf8();
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 case extensions::Feature::CONTENT_SCRIPT_CONTEXT: 1233 case extensions::Feature::CONTENT_SCRIPT_CONTEXT:
1236 return true; 1234 return true;
1237 case extensions::Feature::BLESSED_WEB_PAGE_CONTEXT: 1235 case extensions::Feature::BLESSED_WEB_PAGE_CONTEXT:
1238 return !current_context->web_frame()->parent(); 1236 return !current_context->web_frame()->parent();
1239 } 1237 }
1240 NOTREACHED(); 1238 NOTREACHED();
1241 #endif 1239 #endif
1242 return false; 1240 return false;
1243 } 1241 }
1244 1242
1245 bool ChromeContentRendererClient::ShouldFork(WebFrame* frame, 1243 bool ChromeContentRendererClient::ShouldFork(blink::WebFrame* frame,
1246 const GURL& url, 1244 const GURL& url,
1247 const std::string& http_method, 1245 const std::string& http_method,
1248 bool is_initial_navigation, 1246 bool is_initial_navigation,
1249 bool is_server_redirect, 1247 bool is_server_redirect,
1250 bool* send_referrer) { 1248 bool* send_referrer) {
1251 DCHECK(!frame->parent()); 1249 DCHECK(!frame->parent());
1252 1250
1253 // If this is the Instant process, fork all navigations originating from the 1251 // If this is the Instant process, fork all navigations originating from the
1254 // renderer. The destination page will then be bucketed back to this Instant 1252 // renderer. The destination page will then be bucketed back to this Instant
1255 // process if it is an Instant url, or to another process if not. Conversely, 1253 // process if it is an Instant url, or to another process if not. Conversely,
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1377 if (url.host() == chrome::kChromeUIThumbnailHost) 1375 if (url.host() == chrome::kChromeUIThumbnailHost)
1378 return search_box->GenerateThumbnailURLFromTransientURL(url, new_url); 1376 return search_box->GenerateThumbnailURLFromTransientURL(url, new_url);
1379 else if (url.host() == chrome::kChromeUIFaviconHost) 1377 else if (url.host() == chrome::kChromeUIFaviconHost)
1380 return search_box->GenerateFaviconURLFromTransientURL(url, new_url); 1378 return search_box->GenerateFaviconURLFromTransientURL(url, new_url);
1381 } 1379 }
1382 1380
1383 return false; 1381 return false;
1384 } 1382 }
1385 1383
1386 void ChromeContentRendererClient::DidCreateScriptContext( 1384 void ChromeContentRendererClient::DidCreateScriptContext(
1387 WebFrame* frame, v8::Handle<v8::Context> context, int extension_group, 1385 blink::WebLocalFrame* frame,
1386 v8::Handle<v8::Context> context,
1387 int extension_group,
1388 int world_id) { 1388 int world_id) {
1389 #if defined(ENABLE_EXTENSIONS) 1389 #if defined(ENABLE_EXTENSIONS)
1390 extension_dispatcher_->DidCreateScriptContext( 1390 extension_dispatcher_->DidCreateScriptContext(
1391 frame, context, extension_group, world_id); 1391 frame, context, extension_group, world_id);
1392 #endif 1392 #endif
1393 } 1393 }
1394 1394
1395 unsigned long long ChromeContentRendererClient::VisitedLinkHash( 1395 unsigned long long ChromeContentRendererClient::VisitedLinkHash(
1396 const char* canonical_url, size_t length) { 1396 const char* canonical_url, size_t length) {
1397 return visited_link_slave_->ComputeURLFingerprint(canonical_url, length); 1397 return visited_link_slave_->ComputeURLFingerprint(canonical_url, length);
(...skipping 26 matching lines...) Expand all
1424 new extensions::RendererPermissionsPolicyDelegate( 1424 new extensions::RendererPermissionsPolicyDelegate(
1425 extension_dispatcher_.get())); 1425 extension_dispatcher_.get()));
1426 } 1426 }
1427 1427
1428 extensions::Dispatcher* 1428 extensions::Dispatcher*
1429 ChromeContentRendererClient::GetExtensionDispatcherForTest() { 1429 ChromeContentRendererClient::GetExtensionDispatcherForTest() {
1430 return extension_dispatcher_.get(); 1430 return extension_dispatcher_.get();
1431 } 1431 }
1432 1432
1433 bool ChromeContentRendererClient::CrossesExtensionExtents( 1433 bool ChromeContentRendererClient::CrossesExtensionExtents(
1434 WebFrame* frame, 1434 blink::WebFrame* frame,
1435 const GURL& new_url, 1435 const GURL& new_url,
1436 const extensions::ExtensionSet& extensions, 1436 const extensions::ExtensionSet& extensions,
1437 bool is_extension_url, 1437 bool is_extension_url,
1438 bool is_initial_navigation) { 1438 bool is_initial_navigation) {
1439 GURL old_url(frame->top()->document().url()); 1439 GURL old_url(frame->top()->document().url());
1440 1440
1441 // If old_url is still empty and this is an initial navigation, then this is 1441 // If old_url is still empty and this is an initial navigation, then this is
1442 // a window.open operation. We should look at the opener URL. 1442 // a window.open operation. We should look at the opener URL.
1443 if (is_initial_navigation && old_url.is_empty() && frame->opener()) { 1443 if (is_initial_navigation && old_url.is_empty() && frame->opener()) {
1444 // If we're about to open a normal web page from a same-origin opener stuck 1444 // If we're about to open a normal web page from a same-origin opener stuck
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1646 if (mime_type == content::kBrowserPluginMimeType) { 1646 if (mime_type == content::kBrowserPluginMimeType) {
1647 return new extensions::ExtensionsGuestViewContainer(render_frame); 1647 return new extensions::ExtensionsGuestViewContainer(render_frame);
1648 } else { 1648 } else {
1649 return new extensions::MimeHandlerViewContainer( 1649 return new extensions::MimeHandlerViewContainer(
1650 render_frame, mime_type, original_url); 1650 render_frame, mime_type, original_url);
1651 } 1651 }
1652 #else 1652 #else
1653 return NULL; 1653 return NULL;
1654 #endif 1654 #endif
1655 } 1655 }
OLDNEW
« no previous file with comments | « chrome/renderer/chrome_content_renderer_client.h ('k') | content/public/renderer/content_renderer_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698