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

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: add (c) header Created 6 years, 3 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"
11 #include "content/common/browser_plugin/browser_plugin_constants.h" 11 #include "content/common/browser_plugin/browser_plugin_constants.h"
12 #include "content/common/browser_plugin/browser_plugin_messages.h" 12 #include "content/common/browser_plugin/browser_plugin_messages.h"
13 #include "content/common/view_messages.h" 13 #include "content/common/view_messages.h"
14 #include "content/public/common/content_client.h" 14 #include "content/public/common/content_client.h"
15 #include "content/public/common/content_switches.h" 15 #include "content/public/common/content_switches.h"
16 #include "content/public/renderer/browser_plugin_delegate.h"
16 #include "content/public/renderer/content_renderer_client.h" 17 #include "content/public/renderer/content_renderer_client.h"
17 #include "content/renderer/browser_plugin/browser_plugin_bindings.h" 18 #include "content/renderer/browser_plugin/browser_plugin_bindings.h"
18 #include "content/renderer/browser_plugin/browser_plugin_manager.h" 19 #include "content/renderer/browser_plugin/browser_plugin_manager.h"
19 #include "content/renderer/child_frame_compositing_helper.h" 20 #include "content/renderer/child_frame_compositing_helper.h"
20 #include "content/renderer/cursor_utils.h" 21 #include "content/renderer/cursor_utils.h"
21 #include "content/renderer/drop_data_builder.h" 22 #include "content/renderer/drop_data_builder.h"
22 #include "content/renderer/render_thread_impl.h" 23 #include "content/renderer/render_thread_impl.h"
23 #include "content/renderer/sad_plugin.h" 24 #include "content/renderer/sad_plugin.h"
24 #include "third_party/WebKit/public/platform/WebRect.h" 25 #include "third_party/WebKit/public/platform/WebRect.h"
25 #include "third_party/WebKit/public/web/WebBindings.h" 26 #include "third_party/WebKit/public/web/WebBindings.h"
(...skipping 11 matching lines...) Expand all
37 using blink::WebPluginParams; 38 using blink::WebPluginParams;
38 using blink::WebPoint; 39 using blink::WebPoint;
39 using blink::WebRect; 40 using blink::WebRect;
40 using blink::WebURL; 41 using blink::WebURL;
41 using blink::WebVector; 42 using blink::WebVector;
42 43
43 namespace content { 44 namespace content {
44 45
45 BrowserPlugin::BrowserPlugin(RenderViewImpl* render_view, 46 BrowserPlugin::BrowserPlugin(RenderViewImpl* render_view,
46 blink::WebFrame* frame, 47 blink::WebFrame* frame,
47 bool auto_navigate) 48 BrowserPluginDelegate* delegate)
48 : attached_(false), 49 : attached_(false),
49 attach_pending_(false), 50 attach_pending_(false),
50 render_view_(render_view->AsWeakPtr()), 51 render_view_(render_view->AsWeakPtr()),
51 render_view_routing_id_(render_view->GetRoutingID()), 52 render_view_routing_id_(render_view->GetRoutingID()),
52 container_(NULL), 53 container_(NULL),
53 paint_ack_received_(true), 54 paint_ack_received_(true),
54 last_device_scale_factor_(GetDeviceScaleFactor()), 55 last_device_scale_factor_(GetDeviceScaleFactor()),
55 sad_guest_(NULL), 56 sad_guest_(NULL),
56 guest_crashed_(false), 57 guest_crashed_(false),
57 content_window_routing_id_(MSG_ROUTING_NONE), 58 content_window_routing_id_(MSG_ROUTING_NONE),
58 plugin_focused_(false), 59 plugin_focused_(false),
59 visible_(true), 60 visible_(true),
60 auto_navigate_(auto_navigate),
61 mouse_locked_(false), 61 mouse_locked_(false),
62 browser_plugin_manager_(render_view->GetBrowserPluginManager()), 62 browser_plugin_manager_(render_view->GetBrowserPluginManager()),
63 browser_plugin_instance_id_(browser_plugin::kInstanceIDNone), 63 browser_plugin_instance_id_(browser_plugin::kInstanceIDNone),
64 delegate_(delegate),
64 weak_ptr_factory_(this) { 65 weak_ptr_factory_(this) {
65 } 66 }
66 67
67 BrowserPlugin::~BrowserPlugin() { 68 BrowserPlugin::~BrowserPlugin() {
68 browser_plugin_manager()->RemoveBrowserPlugin(browser_plugin_instance_id_); 69 browser_plugin_manager()->RemoveBrowserPlugin(browser_plugin_instance_id_);
69 70
70 if (!ready()) 71 if (!ready())
71 return; 72 return;
72 73
73 browser_plugin_manager()->Send( 74 browser_plugin_manager()->Send(
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 npp_.reset(new NPP_t); 391 npp_.reset(new NPP_t);
391 container->allowScriptObjects(); 392 container->allowScriptObjects();
392 393
393 bindings_.reset(new BrowserPluginBindings(this)); 394 bindings_.reset(new BrowserPluginBindings(this));
394 container_ = container; 395 container_ = container;
395 container_->setWantsWheelEvents(true); 396 container_->setWantsWheelEvents(true);
396 397
397 // This is a way to notify observers of our attributes that this plugin is 398 // This is a way to notify observers of our attributes that this plugin is
398 // available in render tree. 399 // available in render tree.
399 browser_plugin_instance_id_ = browser_plugin_manager()->GetNextInstanceID(); 400 browser_plugin_instance_id_ = browser_plugin_manager()->GetNextInstanceID();
401
402 if (delegate_)
403 delegate_->SetElementInstanceID(browser_plugin_instance_id_);
Fady Samuel 2014/09/02 15:08:25 Given that we make use of the element instance ID
lazyboy 2014/09/02 20:17:22 Done #2.
404
400 UpdateDOMAttribute("internalinstanceid", 405 UpdateDOMAttribute("internalinstanceid",
Fady Samuel 2014/09/02 15:08:25 You don't have to do this in this CL but it occurs
lazyboy 2014/09/02 20:17:22 Added TODO.
401 base::IntToString(browser_plugin_instance_id_)); 406 base::IntToString(browser_plugin_instance_id_));
402 407
403 browser_plugin_manager()->AddBrowserPlugin(browser_plugin_instance_id_, this); 408 browser_plugin_manager()->AddBrowserPlugin(browser_plugin_instance_id_, this);
404 return true; 409 return true;
405 } 410 }
406 411
407 void BrowserPlugin::EnableCompositing(bool enable) { 412 void BrowserPlugin::EnableCompositing(bool enable) {
408 bool enabled = !!compositing_helper_.get(); 413 bool enabled = !!compositing_helper_.get();
409 if (enabled == enable) 414 if (enabled == enable)
410 return; 415 return;
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 mask, 697 mask,
693 position)); 698 position));
694 return true; 699 return true;
695 } 700 }
696 701
697 void BrowserPlugin::didReceiveResponse( 702 void BrowserPlugin::didReceiveResponse(
698 const blink::WebURLResponse& response) { 703 const blink::WebURLResponse& response) {
699 } 704 }
700 705
701 void BrowserPlugin::didReceiveData(const char* data, int data_length) { 706 void BrowserPlugin::didReceiveData(const char* data, int data_length) {
702 if (auto_navigate_) { 707 if (delegate_)
703 std::string value(data, data_length); 708 delegate_->DidReceiveData(data, data_length);
704 html_string_ += value;
705 }
706 } 709 }
707 710
708 void BrowserPlugin::didFinishLoading() { 711 void BrowserPlugin::didFinishLoading() {
709 if (auto_navigate_) { 712 if (delegate_)
710 // TODO(lazyboy): Make |auto_navigate_| stuff work. 713 delegate_->DidFinishLoading();
711 UpdateDOMAttribute(content::browser_plugin::kAttributeSrc, html_string_);
712 }
713 } 714 }
714 715
715 void BrowserPlugin::didFailLoading(const blink::WebURLError& error) { 716 void BrowserPlugin::didFailLoading(const blink::WebURLError& error) {
716 } 717 }
717 718
718 void BrowserPlugin::didFinishLoadingFrameRequest(const blink::WebURL& url, 719 void BrowserPlugin::didFinishLoadingFrameRequest(const blink::WebURL& url,
719 void* notify_data) { 720 void* notify_data) {
720 } 721 }
721 722
722 void BrowserPlugin::didFailLoadingFrameRequest( 723 void BrowserPlugin::didFailLoadingFrameRequest(
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 const blink::WebMouseEvent& event) { 810 const blink::WebMouseEvent& event) {
810 browser_plugin_manager()->Send( 811 browser_plugin_manager()->Send(
811 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_, 812 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_,
812 browser_plugin_instance_id_, 813 browser_plugin_instance_id_,
813 plugin_rect_, 814 plugin_rect_,
814 &event)); 815 &event));
815 return true; 816 return true;
816 } 817 }
817 818
818 } // namespace content 819 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698