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

Side by Side Diff: content/renderer/browser_plugin/browser_plugin.cc

Issue 376033002: Adding MimeHandlerView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pending-zork-patch2
Patch Set: remove some printfs. Created 6 years, 5 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/renderer/browser_plugin/browser_plugin.h" 5 #include "content/renderer/browser_plugin/browser_plugin.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 paint_ack_received_(true), 53 paint_ack_received_(true),
54 last_device_scale_factor_(1.0f), 54 last_device_scale_factor_(1.0f),
55 sad_guest_(NULL), 55 sad_guest_(NULL),
56 guest_crashed_(false), 56 guest_crashed_(false),
57 is_auto_size_state_dirty_(false), 57 is_auto_size_state_dirty_(false),
58 content_window_routing_id_(MSG_ROUTING_NONE), 58 content_window_routing_id_(MSG_ROUTING_NONE),
59 plugin_focused_(false), 59 plugin_focused_(false),
60 visible_(true), 60 visible_(true),
61 auto_navigate_(auto_navigate), 61 auto_navigate_(auto_navigate),
62 mouse_locked_(false), 62 mouse_locked_(false),
63 attach_called_(false),
64 seen_src_(false),
63 browser_plugin_manager_(render_view->GetBrowserPluginManager()), 65 browser_plugin_manager_(render_view->GetBrowserPluginManager()),
64 embedder_frame_url_(frame->document().url()), 66 embedder_frame_url_(frame->document().url()),
65 weak_ptr_factory_(this) { 67 weak_ptr_factory_(this) {
66 } 68 }
67 69
68 BrowserPlugin::~BrowserPlugin() { 70 BrowserPlugin::~BrowserPlugin() {
69 // If the BrowserPlugin has never navigated then the browser process and 71 // If the BrowserPlugin has never navigated then the browser process and
70 // BrowserPluginManager don't know about it and so there is nothing to do 72 // BrowserPluginManager don't know about it and so there is nothing to do
71 // here. 73 // here.
72 if (!HasGuestInstanceID()) 74 if (!HasGuestInstanceID())
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 GetSizeParams(NULL, &resize_guest_params, true); 260 GetSizeParams(NULL, &resize_guest_params, true);
259 } 261 }
260 paint_ack_received_ = false; 262 paint_ack_received_ = false;
261 browser_plugin_manager()->Send( 263 browser_plugin_manager()->Send(
262 new BrowserPluginHostMsg_SetAutoSize(render_view_routing_id_, 264 new BrowserPluginHostMsg_SetAutoSize(render_view_routing_id_,
263 guest_instance_id_, 265 guest_instance_id_,
264 auto_size_params, 266 auto_size_params,
265 resize_guest_params)); 267 resize_guest_params));
266 } 268 }
267 269
270 void BrowserPlugin::AttachToPlugin(
271 int instance_id) {
272 printf("AttachToPlugin: attach_called_ to true\n");
273 attach_called_ = true;
274 pending_instance_id_ = instance_id;
275 MaybeAttach();
276 }
277
268 void BrowserPlugin::Attach(int guest_instance_id, 278 void BrowserPlugin::Attach(int guest_instance_id,
269 scoped_ptr<base::DictionaryValue> extra_params) { 279 scoped_ptr<base::DictionaryValue> extra_params) {
280 printf("BP::Attach\n");
270 CHECK(guest_instance_id != browser_plugin::kInstanceIDNone); 281 CHECK(guest_instance_id != browser_plugin::kInstanceIDNone);
271 282
272 // If this BrowserPlugin is already attached to a guest, then do nothing. 283 // If this BrowserPlugin is already attached to a guest, then do nothing.
273 if (HasGuestInstanceID()) 284 if (HasGuestInstanceID())
274 return; 285 return;
275 286
276 // This API may be called directly without setting the src attribute. 287 // This API may be called directly without setting the src attribute.
277 // In that case, we need to make sure we don't allocate another instance ID. 288 // In that case, we need to make sure we don't allocate another instance ID.
278 guest_instance_id_ = guest_instance_id; 289 guest_instance_id_ = guest_instance_id;
279 browser_plugin_manager()->AddBrowserPlugin(guest_instance_id, this); 290 browser_plugin_manager()->AddBrowserPlugin(guest_instance_id, this);
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 } 854 }
844 855
845 void BrowserPlugin::didReceiveData(const char* data, int data_length) { 856 void BrowserPlugin::didReceiveData(const char* data, int data_length) {
846 if (auto_navigate_) { 857 if (auto_navigate_) {
847 std::string value(data, data_length); 858 std::string value(data, data_length);
848 html_string_ += value; 859 html_string_ += value;
849 } 860 }
850 } 861 }
851 862
852 void BrowserPlugin::didFinishLoading() { 863 void BrowserPlugin::didFinishLoading() {
864 printf("BP::didFinishLoading\n");
865 printf("html_string_: %s\n", html_string_.c_str());
853 if (auto_navigate_) { 866 if (auto_navigate_) {
867 seen_src_ = true;
868 printf("Set seen_src_ to true\n");
869 MaybeAttach();
854 // TODO(lazyboy): Make |auto_navigate_| stuff work. 870 // TODO(lazyboy): Make |auto_navigate_| stuff work.
855 UpdateDOMAttribute(content::browser_plugin::kAttributeSrc, html_string_); 871 //UpdateDOMAttribute(content::browser_plugin::kAttributeSrc, html_string_);
856 } 872 }
857 } 873 }
858 874
875 void BrowserPlugin::MaybeAttach() {
876 printf("MaybeAttach: seen_src_ = %d, attach_called_: %d\n",
877 seen_src_, attach_called_);
878 if (seen_src_ && attach_called_) {
Fady Samuel 2014/07/09 14:54:17 I'd love to move autonavigate code out of content
lazyboy 2014/07/10 04:11:00 We need a renderer side counterpart in chrome/ for
Fady Samuel 2014/07/10 15:13:42 I think that's fine. Let's get something working a
879 // We have all we need.
880 printf("pending_instance_id_: %d\n", pending_instance_id_);
881 base::DictionaryValue* v = new base::DictionaryValue();
882 v->SetString("src", html_string_);
883 Attach(pending_instance_id_, make_scoped_ptr(v));
884 }
885 }
886
859 void BrowserPlugin::didFailLoading(const blink::WebURLError& error) { 887 void BrowserPlugin::didFailLoading(const blink::WebURLError& error) {
860 } 888 }
861 889
862 void BrowserPlugin::didFinishLoadingFrameRequest(const blink::WebURL& url, 890 void BrowserPlugin::didFinishLoadingFrameRequest(const blink::WebURL& url,
863 void* notify_data) { 891 void* notify_data) {
864 } 892 }
865 893
866 void BrowserPlugin::didFailLoadingFrameRequest( 894 void BrowserPlugin::didFailLoadingFrameRequest(
867 const blink::WebURL& url, 895 const blink::WebURL& url,
868 void* notify_data, 896 void* notify_data,
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 const blink::WebMouseEvent& event) { 981 const blink::WebMouseEvent& event) {
954 browser_plugin_manager()->Send( 982 browser_plugin_manager()->Send(
955 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_, 983 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_,
956 guest_instance_id_, 984 guest_instance_id_,
957 plugin_rect_, 985 plugin_rect_,
958 &event)); 986 &event));
959 return true; 987 return true;
960 } 988 }
961 989
962 } // namespace content 990 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698