OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/render_widget.h" | 5 #include "content/renderer/render_widget.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 gfx::Rect applied_widget_rect() const { return applied_widget_rect_; } | 218 gfx::Rect applied_widget_rect() const { return applied_widget_rect_; } |
219 gfx::Rect original_screen_rect() const { return original_view_screen_rect_; } | 219 gfx::Rect original_screen_rect() const { return original_view_screen_rect_; } |
220 const WebScreenInfo& original_screen_info() { return original_screen_info_; } | 220 const WebScreenInfo& original_screen_info() { return original_screen_info_; } |
221 | 221 |
222 void ChangeEmulationParams( | 222 void ChangeEmulationParams( |
223 const WebDeviceEmulationParams& params); | 223 const WebDeviceEmulationParams& params); |
224 | 224 |
225 // The following methods alter handlers' behavior for messages related to | 225 // The following methods alter handlers' behavior for messages related to |
226 // widget size and position. | 226 // widget size and position. |
227 void OnResizeMessage(const ResizeParams& params); | 227 void OnResizeMessage(const ResizeParams& params); |
| 228 void OnUpdateWindowScreenRectMessage(const gfx::Rect& window_screen_rect); |
228 void OnUpdateScreenRectsMessage(const gfx::Rect& view_screen_rect, | 229 void OnUpdateScreenRectsMessage(const gfx::Rect& view_screen_rect, |
229 const gfx::Rect& window_screen_rect); | 230 const gfx::Rect& window_screen_rect); |
230 void OnShowContextMenu(ContextMenuParams* params); | 231 void OnShowContextMenu(ContextMenuParams* params); |
231 gfx::Rect AdjustValidationMessageAnchor(const gfx::Rect& anchor); | 232 gfx::Rect AdjustValidationMessageAnchor(const gfx::Rect& anchor); |
232 | 233 |
233 private: | 234 private: |
234 void Reapply(); | 235 void Reapply(); |
235 void Apply(bool top_controls_shrink_blink_size, | 236 void Apply(bool top_controls_shrink_blink_size, |
236 float top_controls_height, | 237 float top_controls_height, |
237 gfx::Rect resizer_rect, | 238 gfx::Rect resizer_rect, |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 params.is_fullscreen_granted, | 409 params.is_fullscreen_granted, |
409 params.display_mode); | 410 params.display_mode); |
410 | 411 |
411 if (need_ack) { | 412 if (need_ack) { |
412 widget_->set_next_paint_is_resize_ack(); | 413 widget_->set_next_paint_is_resize_ack(); |
413 if (widget_->compositor_) | 414 if (widget_->compositor_) |
414 widget_->compositor_->SetNeedsRedrawRect(gfx::Rect(widget_->size_)); | 415 widget_->compositor_->SetNeedsRedrawRect(gfx::Rect(widget_->size_)); |
415 } | 416 } |
416 } | 417 } |
417 | 418 |
| 419 void RenderWidget::ScreenMetricsEmulator::OnUpdateWindowScreenRectMessage( |
| 420 const gfx::Rect& window_screen_rect) { |
| 421 original_window_screen_rect_ = window_screen_rect; |
| 422 if (params_.screenPosition == WebDeviceEmulationParams::Desktop) |
| 423 Reapply(); |
| 424 } |
| 425 |
418 void RenderWidget::ScreenMetricsEmulator::OnUpdateScreenRectsMessage( | 426 void RenderWidget::ScreenMetricsEmulator::OnUpdateScreenRectsMessage( |
419 const gfx::Rect& view_screen_rect, | 427 const gfx::Rect& view_screen_rect, |
420 const gfx::Rect& window_screen_rect) { | 428 const gfx::Rect& window_screen_rect) { |
421 original_view_screen_rect_ = view_screen_rect; | 429 original_view_screen_rect_ = view_screen_rect; |
422 original_window_screen_rect_ = window_screen_rect; | 430 original_window_screen_rect_ = window_screen_rect; |
423 if (params_.screenPosition == WebDeviceEmulationParams::Desktop) | 431 if (params_.screenPosition == WebDeviceEmulationParams::Desktop) |
424 Reapply(); | 432 Reapply(); |
425 } | 433 } |
426 | 434 |
427 void RenderWidget::ScreenMetricsEmulator::OnShowContextMenu( | 435 void RenderWidget::ScreenMetricsEmulator::OnShowContextMenu( |
(...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1719 if (screen_metrics_emulator_) { | 1727 if (screen_metrics_emulator_) { |
1720 screen_metrics_emulator_->OnUpdateScreenRectsMessage( | 1728 screen_metrics_emulator_->OnUpdateScreenRectsMessage( |
1721 view_screen_rect, window_screen_rect); | 1729 view_screen_rect, window_screen_rect); |
1722 } else { | 1730 } else { |
1723 view_screen_rect_ = view_screen_rect; | 1731 view_screen_rect_ = view_screen_rect; |
1724 window_screen_rect_ = window_screen_rect; | 1732 window_screen_rect_ = window_screen_rect; |
1725 } | 1733 } |
1726 Send(new ViewHostMsg_UpdateScreenRects_ACK(routing_id())); | 1734 Send(new ViewHostMsg_UpdateScreenRects_ACK(routing_id())); |
1727 } | 1735 } |
1728 | 1736 |
| 1737 void RenderWidget::OnUpdateWindowScreenRect( |
| 1738 const gfx::Rect& window_screen_rect) { |
| 1739 if (screen_metrics_emulator_) { |
| 1740 screen_metrics_emulator_->OnUpdateWindowScreenRectMessage( |
| 1741 window_screen_rect); |
| 1742 } else { |
| 1743 window_screen_rect_ = window_screen_rect; |
| 1744 } |
| 1745 } |
| 1746 |
1729 void RenderWidget::OnSetSurfaceIdNamespace(uint32_t surface_id_namespace) { | 1747 void RenderWidget::OnSetSurfaceIdNamespace(uint32_t surface_id_namespace) { |
1730 if (compositor_) | 1748 if (compositor_) |
1731 compositor_->SetSurfaceIdNamespace(surface_id_namespace); | 1749 compositor_->SetSurfaceIdNamespace(surface_id_namespace); |
1732 } | 1750 } |
1733 | 1751 |
1734 void RenderWidget::OnHandleCompositorProto(const std::vector<uint8_t>& proto) { | 1752 void RenderWidget::OnHandleCompositorProto(const std::vector<uint8_t>& proto) { |
1735 if (compositor_) | 1753 if (compositor_) |
1736 compositor_->OnHandleCompositorProto(proto); | 1754 compositor_->OnHandleCompositorProto(proto); |
1737 } | 1755 } |
1738 | 1756 |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2294 video_hole_frames_.RemoveObserver(frame); | 2312 video_hole_frames_.RemoveObserver(frame); |
2295 } | 2313 } |
2296 #endif // defined(VIDEO_HOLE) | 2314 #endif // defined(VIDEO_HOLE) |
2297 | 2315 |
2298 void RenderWidget::OnWaitNextFrameForTests(int routing_id) { | 2316 void RenderWidget::OnWaitNextFrameForTests(int routing_id) { |
2299 QueueMessage(new ViewHostMsg_WaitForNextFrameForTests_ACK(routing_id), | 2317 QueueMessage(new ViewHostMsg_WaitForNextFrameForTests_ACK(routing_id), |
2300 MESSAGE_DELIVERY_POLICY_WITH_VISUAL_STATE); | 2318 MESSAGE_DELIVERY_POLICY_WITH_VISUAL_STATE); |
2301 } | 2319 } |
2302 | 2320 |
2303 } // namespace content | 2321 } // namespace content |
OLD | NEW |