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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 return; | 283 return; |
284 | 284 |
285 BrowserPluginHostMsg_ResizeGuest_Params params; | 285 BrowserPluginHostMsg_ResizeGuest_Params params; |
286 PopulateResizeGuestParameters(plugin_size(), ¶ms); | 286 PopulateResizeGuestParameters(plugin_size(), ¶ms); |
287 BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_ResizeGuest( | 287 BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_ResizeGuest( |
288 render_view_routing_id_, | 288 render_view_routing_id_, |
289 browser_plugin_instance_id_, | 289 browser_plugin_instance_id_, |
290 params)); | 290 params)); |
291 } | 291 } |
292 | 292 |
293 void BrowserPlugin::UpdateGuestFocusState() { | 293 void BrowserPlugin::UpdateGuestFocusState(blink::WebFocusType focus_type) { |
294 if (!attached()) | 294 if (!attached()) |
295 return; | 295 return; |
296 bool should_be_focused = ShouldGuestBeFocused(); | 296 bool should_be_focused = ShouldGuestBeFocused(); |
297 BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_SetFocus( | 297 BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_SetFocus( |
298 render_view_routing_id_, | 298 render_view_routing_id_, |
299 browser_plugin_instance_id_, | 299 browser_plugin_instance_id_, |
300 should_be_focused)); | 300 should_be_focused, |
| 301 focus_type)); |
301 } | 302 } |
302 | 303 |
303 bool BrowserPlugin::ShouldGuestBeFocused() const { | 304 bool BrowserPlugin::ShouldGuestBeFocused() const { |
304 bool embedder_focused = false; | 305 bool embedder_focused = false; |
305 RenderViewImpl* render_view = | 306 RenderViewImpl* render_view = |
306 RenderViewImpl::FromRoutingID(render_view_routing_id()); | 307 RenderViewImpl::FromRoutingID(render_view_routing_id()); |
307 if (render_view) | 308 if (render_view) |
308 embedder_focused = render_view->has_focus(); | 309 embedder_focused = render_view->has_focus(); |
309 return plugin_focused_ && embedder_focused; | 310 return plugin_focused_ && embedder_focused; |
310 } | 311 } |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 const gfx::Size& view_size, | 477 const gfx::Size& view_size, |
477 BrowserPluginHostMsg_ResizeGuest_Params* params) { | 478 BrowserPluginHostMsg_ResizeGuest_Params* params) { |
478 params->view_size = view_size; | 479 params->view_size = view_size; |
479 params->scale_factor = GetDeviceScaleFactor(); | 480 params->scale_factor = GetDeviceScaleFactor(); |
480 if (last_device_scale_factor_ != params->scale_factor) { | 481 if (last_device_scale_factor_ != params->scale_factor) { |
481 last_device_scale_factor_ = params->scale_factor; | 482 last_device_scale_factor_ = params->scale_factor; |
482 params->repaint = true; | 483 params->repaint = true; |
483 } | 484 } |
484 } | 485 } |
485 | 486 |
486 void BrowserPlugin::updateFocus(bool focused) { | 487 void BrowserPlugin::updateFocus(bool focused, blink::WebFocusType focus_type) { |
487 plugin_focused_ = focused; | 488 plugin_focused_ = focused; |
488 UpdateGuestFocusState(); | 489 UpdateGuestFocusState(focus_type); |
489 } | 490 } |
490 | 491 |
491 void BrowserPlugin::updateVisibility(bool visible) { | 492 void BrowserPlugin::updateVisibility(bool visible) { |
492 if (visible_ == visible) | 493 if (visible_ == visible) |
493 return; | 494 return; |
494 | 495 |
495 visible_ = visible; | 496 visible_ = visible; |
496 if (!attached()) | 497 if (!attached()) |
497 return; | 498 return; |
498 | 499 |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 const blink::WebMouseEvent& event) { | 667 const blink::WebMouseEvent& event) { |
667 BrowserPluginManager::Get()->Send( | 668 BrowserPluginManager::Get()->Send( |
668 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_, | 669 new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_, |
669 browser_plugin_instance_id_, | 670 browser_plugin_instance_id_, |
670 plugin_rect_, | 671 plugin_rect_, |
671 &event)); | 672 &event)); |
672 return true; | 673 return true; |
673 } | 674 } |
674 | 675 |
675 } // namespace content | 676 } // namespace content |
OLD | NEW |