OLD | NEW |
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 attach_pending_(false), | 63 attach_pending_(false), |
64 render_view_(render_view->AsWeakPtr()), | 64 render_view_(render_view->AsWeakPtr()), |
65 render_view_routing_id_(render_view->GetRoutingID()), | 65 render_view_routing_id_(render_view->GetRoutingID()), |
66 container_(NULL), | 66 container_(NULL), |
67 last_device_scale_factor_(GetDeviceScaleFactor()), | 67 last_device_scale_factor_(GetDeviceScaleFactor()), |
68 sad_guest_(NULL), | 68 sad_guest_(NULL), |
69 guest_crashed_(false), | 69 guest_crashed_(false), |
70 plugin_focused_(false), | 70 plugin_focused_(false), |
71 visible_(true), | 71 visible_(true), |
72 mouse_locked_(false), | 72 mouse_locked_(false), |
| 73 ready_(false), |
73 browser_plugin_manager_(render_view->GetBrowserPluginManager()), | 74 browser_plugin_manager_(render_view->GetBrowserPluginManager()), |
74 browser_plugin_instance_id_(browser_plugin::kInstanceIDNone), | 75 browser_plugin_instance_id_(browser_plugin::kInstanceIDNone), |
75 contents_opaque_(true), | 76 contents_opaque_(true), |
76 delegate_(delegate.Pass()), | 77 delegate_(delegate.Pass()), |
77 weak_ptr_factory_(this) { | 78 weak_ptr_factory_(this) { |
78 browser_plugin_instance_id_ = browser_plugin_manager()->GetNextInstanceID(); | 79 browser_plugin_instance_id_ = browser_plugin_manager()->GetNextInstanceID(); |
79 | 80 |
80 if (delegate_) | 81 if (delegate_) |
81 delegate_->SetElementInstanceID(browser_plugin_instance_id_); | 82 delegate_->SetElementInstanceID(browser_plugin_instance_id_); |
82 } | 83 } |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 } | 427 } |
427 | 428 |
428 void BrowserPlugin::updateGeometry( | 429 void BrowserPlugin::updateGeometry( |
429 const WebRect& window_rect, | 430 const WebRect& window_rect, |
430 const WebRect& clip_rect, | 431 const WebRect& clip_rect, |
431 const WebVector<WebRect>& cut_outs_rects, | 432 const WebVector<WebRect>& cut_outs_rects, |
432 bool is_visible) { | 433 bool is_visible) { |
433 int old_width = width(); | 434 int old_width = width(); |
434 int old_height = height(); | 435 int old_height = height(); |
435 plugin_rect_ = window_rect; | 436 plugin_rect_ = window_rect; |
| 437 if (!ready_) { |
| 438 if (delegate_) |
| 439 delegate_->Ready(); |
| 440 ready_ = true; |
| 441 } |
436 if (!attached()) | 442 if (!attached()) |
437 return; | 443 return; |
438 | 444 |
439 if (old_width == window_rect.width && old_height == window_rect.height) { | 445 if (old_width == window_rect.width && old_height == window_rect.height) { |
440 // Let the browser know about the updated view rect. | 446 // Let the browser know about the updated view rect. |
441 browser_plugin_manager()->Send(new BrowserPluginHostMsg_UpdateGeometry( | 447 browser_plugin_manager()->Send(new BrowserPluginHostMsg_UpdateGeometry( |
442 render_view_routing_id_, browser_plugin_instance_id_, plugin_rect_)); | 448 render_view_routing_id_, browser_plugin_instance_id_, plugin_rect_)); |
443 return; | 449 return; |
444 } | 450 } |
445 | 451 |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 const blink::WebMouseEvent& event) { | 650 const blink::WebMouseEvent& event) { |
645 browser_plugin_manager()->Send( | 651 browser_plugin_manager()->Send( |
646 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_, | 652 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_, |
647 browser_plugin_instance_id_, | 653 browser_plugin_instance_id_, |
648 plugin_rect_, | 654 plugin_rect_, |
649 &event)); | 655 &event)); |
650 return true; | 656 return true; |
651 } | 657 } |
652 | 658 |
653 } // namespace content | 659 } // namespace content |
OLD | NEW |