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

Side by Side Diff: content/browser/browser_plugin/browser_plugin_guest.cc

Issue 11968054: <webview>: Implement ExecuteScript (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed nits Created 7 years, 11 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 | Annotate | Revision Log
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 "content/browser/browser_plugin/browser_plugin_guest.h" 5 #include "content/browser/browser_plugin/browser_plugin_guest.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "content/browser/browser_plugin/browser_plugin_embedder.h" 10 #include "content/browser/browser_plugin/browser_plugin_embedder.h"
11 #include "content/browser/browser_plugin/browser_plugin_guest_helper.h" 11 #include "content/browser/browser_plugin/browser_plugin_guest_helper.h"
12 #include "content/browser/browser_plugin/browser_plugin_host_factory.h" 12 #include "content/browser/browser_plugin/browser_plugin_host_factory.h"
13 #include "content/browser/renderer_host/render_view_host_impl.h" 13 #include "content/browser/renderer_host/render_view_host_impl.h"
14 #include "content/browser/renderer_host/render_widget_host_impl.h" 14 #include "content/browser/renderer_host/render_widget_host_impl.h"
15 #include "content/browser/web_contents/web_contents_impl.h" 15 #include "content/browser/web_contents/web_contents_impl.h"
16 #include "content/common/browser_plugin_messages.h" 16 #include "content/common/browser_plugin_messages.h"
17 #include "content/common/content_constants_internal.h" 17 #include "content/common/content_constants_internal.h"
18 #include "content/common/drag_messages.h" 18 #include "content/common/drag_messages.h"
19 #include "content/common/view_messages.h" 19 #include "content/common/view_messages.h"
20 #include "content/port/browser/render_view_host_delegate_view.h" 20 #include "content/port/browser/render_view_host_delegate_view.h"
21 #include "content/public/browser/content_browser_client.h"
21 #include "content/public/browser/notification_service.h" 22 #include "content/public/browser/notification_service.h"
22 #include "content/public/browser/notification_types.h" 23 #include "content/public/browser/notification_types.h"
23 #include "content/public/browser/render_process_host.h" 24 #include "content/public/browser/render_process_host.h"
24 #include "content/public/browser/render_widget_host_view.h" 25 #include "content/public/browser/render_widget_host_view.h"
25 #include "content/public/browser/resource_request_details.h" 26 #include "content/public/browser/resource_request_details.h"
26 #include "content/public/browser/user_metrics.h" 27 #include "content/public/browser/user_metrics.h"
27 #include "content/public/browser/web_contents_view.h" 28 #include "content/public/browser/web_contents_view.h"
28 #include "content/public/common/result_codes.h" 29 #include "content/public/common/result_codes.h"
29 #include "content/browser/browser_plugin/browser_plugin_host_factory.h" 30 #include "content/browser/browser_plugin/browser_plugin_host_factory.h"
30 #include "net/base/net_errors.h" 31 #include "net/base/net_errors.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 const BrowserPluginHostMsg_CreateGuest_Params& params, 92 const BrowserPluginHostMsg_CreateGuest_Params& params,
92 content::RenderViewHost* render_view_host) { 93 content::RenderViewHost* render_view_host) {
93 // |render_view_host| manages the ownership of this BrowserPluginGuestHelper. 94 // |render_view_host| manages the ownership of this BrowserPluginGuestHelper.
94 new BrowserPluginGuestHelper(this, render_view_host); 95 new BrowserPluginGuestHelper(this, render_view_host);
95 96
96 notification_registrar_.Add( 97 notification_registrar_.Add(
97 this, content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT, 98 this, content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT,
98 content::Source<content::WebContents>(web_contents())); 99 content::Source<content::WebContents>(web_contents()));
99 100
100 OnSetSize(instance_id_, params.auto_size_params, params.resize_guest_params); 101 OnSetSize(instance_id_, params.auto_size_params, params.resize_guest_params);
102
103 GetContentClient()->browser()->GuestWebContentsCreated(
104 web_contents(), embedder_web_contents_);
101 } 105 }
102 106
103 BrowserPluginGuest::~BrowserPluginGuest() { 107 BrowserPluginGuest::~BrowserPluginGuest() {
104 } 108 }
105 109
106 // static 110 // static
107 BrowserPluginGuest* BrowserPluginGuest::Create( 111 BrowserPluginGuest* BrowserPluginGuest::Create(
108 int instance_id, 112 int instance_id,
109 WebContentsImpl* web_contents, 113 WebContentsImpl* web_contents,
110 const BrowserPluginHostMsg_CreateGuest_Params& params) { 114 const BrowserPluginHostMsg_CreateGuest_Params& params) {
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 int64 frame_id, 300 int64 frame_id,
297 bool is_main_frame, 301 bool is_main_frame,
298 const GURL& url, 302 const GURL& url,
299 PageTransition transition_type, 303 PageTransition transition_type,
300 RenderViewHost* render_view_host) { 304 RenderViewHost* render_view_host) {
301 // Inform its embedder of the updated URL. 305 // Inform its embedder of the updated URL.
302 BrowserPluginMsg_LoadCommit_Params params; 306 BrowserPluginMsg_LoadCommit_Params params;
303 params.url = url; 307 params.url = url;
304 params.is_top_level = is_main_frame; 308 params.is_top_level = is_main_frame;
305 params.process_id = render_view_host->GetProcess()->GetID(); 309 params.process_id = render_view_host->GetProcess()->GetID();
310 params.route_id = render_view_host->GetRoutingID();
306 params.current_entry_index = 311 params.current_entry_index =
307 web_contents()->GetController().GetCurrentEntryIndex(); 312 web_contents()->GetController().GetCurrentEntryIndex();
308 params.entry_count = 313 params.entry_count =
309 web_contents()->GetController().GetEntryCount(); 314 web_contents()->GetController().GetEntryCount();
310 SendMessageToEmbedder( 315 SendMessageToEmbedder(
311 new BrowserPluginMsg_LoadCommit(embedder_routing_id(), 316 new BrowserPluginMsg_LoadCommit(embedder_routing_id(),
312 instance_id(), 317 instance_id(),
313 params)); 318 params));
314 RecordAction(UserMetricsAction("BrowserPlugin.Guest.DidNavigate")); 319 RecordAction(UserMetricsAction("BrowserPlugin.Guest.DidNavigate"));
315 } 320 }
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 relay_params.scroll_delta = params.scroll_delta; 713 relay_params.scroll_delta = params.scroll_delta;
709 relay_params.scroll_rect = params.scroll_rect; 714 relay_params.scroll_rect = params.scroll_rect;
710 relay_params.copy_rects = params.copy_rects; 715 relay_params.copy_rects = params.copy_rects;
711 716
712 SendMessageToEmbedder(new BrowserPluginMsg_UpdateRect(embedder_routing_id(), 717 SendMessageToEmbedder(new BrowserPluginMsg_UpdateRect(embedder_routing_id(),
713 instance_id(), 718 instance_id(),
714 relay_params)); 719 relay_params));
715 } 720 }
716 721
717 } // namespace content 722 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698