OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/bind_helpers.h" | 5 #include "base/bind_helpers.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "content/browser/browser_plugin/browser_plugin_guest.h" | 9 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
10 #include "content/browser/frame_host/render_widget_host_view_guest.h" | 10 #include "content/browser/frame_host/render_widget_host_view_guest.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 void RenderWidgetHostViewGuest::WasShown() { | 77 void RenderWidgetHostViewGuest::WasShown() { |
78 // If the WebContents associated with us showed an interstitial page in the | 78 // If the WebContents associated with us showed an interstitial page in the |
79 // beginning, the teardown path might call WasShown() while |host_| is in | 79 // beginning, the teardown path might call WasShown() while |host_| is in |
80 // the process of destruction. Avoid calling WasShown below in this case. | 80 // the process of destruction. Avoid calling WasShown below in this case. |
81 // TODO(lazyboy): We shouldn't be showing interstitial pages in guests in the | 81 // TODO(lazyboy): We shouldn't be showing interstitial pages in guests in the |
82 // first place: http://crbug.com/273089. | 82 // first place: http://crbug.com/273089. |
83 // | 83 // |
84 // |guest_| is NULL during test. | 84 // |guest_| is NULL during test. |
85 if ((guest_ && guest_->is_in_destruction()) || !host_->is_hidden()) | 85 if ((guest_ && guest_->is_in_destruction()) || !host_->is_hidden()) |
86 return; | 86 return; |
87 // Make sure the size of this view matches the size of the WebContentsView. | |
88 SetSize(guest_->web_contents()->GetViewBounds().size()); | |
87 host_->WasShown(ui::LatencyInfo()); | 89 host_->WasShown(ui::LatencyInfo()); |
88 } | 90 } |
89 | 91 |
90 void RenderWidgetHostViewGuest::WasHidden() { | 92 void RenderWidgetHostViewGuest::WasHidden() { |
91 // |guest_| is NULL during test. | 93 // |guest_| is NULL during test. |
92 if ((guest_ && guest_->is_in_destruction()) || host_->is_hidden()) | 94 if ((guest_ && guest_->is_in_destruction()) || host_->is_hidden()) |
93 return; | 95 return; |
94 host_->WasHidden(); | 96 host_->WasHidden(); |
95 } | 97 } |
96 | 98 |
97 void RenderWidgetHostViewGuest::SetSize(const gfx::Size& size) { | 99 void RenderWidgetHostViewGuest::SetSize(const gfx::Size& size) { |
98 size_ = size; | 100 size_ = size; |
99 host_->WasResized(); | 101 host_->WasResized(); |
100 } | 102 } |
101 | 103 |
102 void RenderWidgetHostViewGuest::SetBounds(const gfx::Rect& rect) { | 104 void RenderWidgetHostViewGuest::SetBounds(const gfx::Rect& rect) { |
103 SetSize(rect.size()); | 105 SetSize(rect.size()); |
104 } | 106 } |
105 | 107 |
108 void RenderWidgetHostViewGuest::Focus() { | |
109 if (guest_) | |
lazyboy
2014/09/09 07:04:45
Can you explain a bit why this change and HasFocus
Fady Samuel
2014/09/09 17:14:49
Done. InterstitialPage calls Focus directly: https
| |
110 guest_->SetFocus(host_, true); | |
111 } | |
112 | |
113 bool RenderWidgetHostViewGuest::HasFocus() const { | |
114 if (!guest_) | |
115 return false; | |
116 return guest_->focused(); | |
117 } | |
118 | |
106 #if defined(USE_AURA) | 119 #if defined(USE_AURA) |
107 void RenderWidgetHostViewGuest::ProcessAckedTouchEvent( | 120 void RenderWidgetHostViewGuest::ProcessAckedTouchEvent( |
108 const TouchEventWithLatencyInfo& touch, InputEventAckState ack_result) { | 121 const TouchEventWithLatencyInfo& touch, InputEventAckState ack_result) { |
109 // TODO(fsamuel): Currently we will only take this codepath if the guest has | 122 // TODO(fsamuel): Currently we will only take this codepath if the guest has |
110 // requested touch events. A better solution is to always forward touchpresses | 123 // requested touch events. A better solution is to always forward touchpresses |
111 // to the embedder process to target a BrowserPlugin, and then route all | 124 // to the embedder process to target a BrowserPlugin, and then route all |
112 // subsequent touch points of that touchdown to the appropriate guest until | 125 // subsequent touch points of that touchdown to the appropriate guest until |
113 // that touch point is released. | 126 // that touch point is released. |
114 ScopedVector<ui::TouchEvent> events; | 127 ScopedVector<ui::TouchEvent> events; |
115 if (!MakeUITouchEventsFromWebTouchEvents(touch, &events, LOCAL_COORDINATES)) | 128 if (!MakeUITouchEventsFromWebTouchEvents(touch, &events, LOCAL_COORDINATES)) |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
257 return gfx::NativeViewAccessible(); | 270 return gfx::NativeViewAccessible(); |
258 return rwhv->GetNativeViewAccessible(); | 271 return rwhv->GetNativeViewAccessible(); |
259 } | 272 } |
260 | 273 |
261 void RenderWidgetHostViewGuest::MovePluginWindows( | 274 void RenderWidgetHostViewGuest::MovePluginWindows( |
262 const std::vector<WebPluginGeometry>& moves) { | 275 const std::vector<WebPluginGeometry>& moves) { |
263 platform_view_->MovePluginWindows(moves); | 276 platform_view_->MovePluginWindows(moves); |
264 } | 277 } |
265 | 278 |
266 void RenderWidgetHostViewGuest::UpdateCursor(const WebCursor& cursor) { | 279 void RenderWidgetHostViewGuest::UpdateCursor(const WebCursor& cursor) { |
267 platform_view_->UpdateCursor(cursor); | 280 if (!guest_) |
281 return; | |
282 guest_->SendMessageToEmbedder( | |
lazyboy
2014/09/09 07:04:45
Same for this one, probably add a comment right he
Fady Samuel
2014/09/09 17:14:49
Done.
| |
283 new BrowserPluginMsg_SetCursor(guest_->browser_plugin_instance_id(), | |
284 cursor)); | |
285 | |
268 } | 286 } |
269 | 287 |
270 void RenderWidgetHostViewGuest::SetIsLoading(bool is_loading) { | 288 void RenderWidgetHostViewGuest::SetIsLoading(bool is_loading) { |
271 platform_view_->SetIsLoading(is_loading); | 289 platform_view_->SetIsLoading(is_loading); |
272 } | 290 } |
273 | 291 |
274 void RenderWidgetHostViewGuest::TextInputStateChanged( | 292 void RenderWidgetHostViewGuest::TextInputStateChanged( |
275 const ViewHostMsg_TextInputState_Params& params) { | 293 const ViewHostMsg_TextInputState_Params& params) { |
276 if (!guest_) | 294 if (!guest_) |
277 return; | 295 return; |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
576 } | 594 } |
577 | 595 |
578 if (blink::WebInputEvent::isGestureEventType(event->type)) { | 596 if (blink::WebInputEvent::isGestureEventType(event->type)) { |
579 host_->ForwardGestureEvent( | 597 host_->ForwardGestureEvent( |
580 *static_cast<const blink::WebGestureEvent*>(event)); | 598 *static_cast<const blink::WebGestureEvent*>(event)); |
581 return; | 599 return; |
582 } | 600 } |
583 } | 601 } |
584 | 602 |
585 } // namespace content | 603 } // namespace content |
OLD | NEW |