OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef CONTENT_RENDERER_DEVTOOLS_RENDER_WIDGET_SCREEN_METRICS_EMULATOR_H_ | 5 #ifndef CONTENT_RENDERER_DEVTOOLS_RENDER_WIDGET_SCREEN_METRICS_EMULATOR_H_ |
6 #define CONTENT_RENDERER_DEVTOOLS_RENDER_WIDGET_SCREEN_METRICS_EMULATOR_H_ | 6 #define CONTENT_RENDERER_DEVTOOLS_RENDER_WIDGET_SCREEN_METRICS_EMULATOR_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "content/common/resize_params.h" | 9 #include "content/common/resize_params.h" |
10 #include "third_party/WebKit/public/web/WebDeviceEmulationParams.h" | 10 #include "third_party/WebKit/public/web/WebDeviceEmulationParams.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 void ChangeEmulationParams(const blink::WebDeviceEmulationParams& params); | 52 void ChangeEmulationParams(const blink::WebDeviceEmulationParams& params); |
53 | 53 |
54 // The following methods alter handlers' behavior for messages related to | 54 // The following methods alter handlers' behavior for messages related to |
55 // widget size and position. | 55 // widget size and position. |
56 void OnResize(const ResizeParams& params); | 56 void OnResize(const ResizeParams& params); |
57 void OnUpdateScreenRects(const gfx::Rect& view_screen_rect, | 57 void OnUpdateScreenRects(const gfx::Rect& view_screen_rect, |
58 const gfx::Rect& window_screen_rect); | 58 const gfx::Rect& window_screen_rect); |
59 void OnShowContextMenu(ContextMenuParams* params); | 59 void OnShowContextMenu(ContextMenuParams* params); |
60 gfx::Rect AdjustValidationMessageAnchor(const gfx::Rect& anchor); | 60 gfx::Rect AdjustValidationMessageAnchor(const gfx::Rect& anchor); |
61 | 61 |
62 private: | 62 // Apply parameters to the render widget. |
63 // Apply original_resize_params_ | |
64 void Apply(); | 63 void Apply(); |
65 | 64 |
| 65 private: |
66 RenderWidgetScreenMetricsEmulatorDelegate* const delegate_; | 66 RenderWidgetScreenMetricsEmulatorDelegate* const delegate_; |
67 | 67 |
68 // Parameters as passed by RenderWidget::EnableScreenMetricsEmulation. | 68 // Parameters as passed by RenderWidget::EnableScreenMetricsEmulation. |
69 blink::WebDeviceEmulationParams emulation_params_; | 69 blink::WebDeviceEmulationParams emulation_params_; |
70 | 70 |
71 // The computed scale and offset used to fit widget into browser window. | 71 // The computed scale and offset used to fit widget into browser window. |
72 float scale_; | 72 float scale_; |
73 gfx::PointF offset_; | 73 gfx::PointF offset_; |
74 | 74 |
75 // Widget rect as passed to webwidget. | 75 // Widget rect as passed to webwidget. |
76 gfx::Rect applied_widget_rect_; | 76 gfx::Rect applied_widget_rect_; |
77 | 77 |
78 // Original values to restore back after emulation ends. | 78 // Original values to restore back after emulation ends. |
79 ResizeParams original_resize_params_; | 79 ResizeParams original_resize_params_; |
80 gfx::Rect original_view_screen_rect_; | 80 gfx::Rect original_view_screen_rect_; |
81 gfx::Rect original_window_screen_rect_; | 81 gfx::Rect original_window_screen_rect_; |
82 | 82 |
83 DISALLOW_COPY_AND_ASSIGN(RenderWidgetScreenMetricsEmulator); | 83 DISALLOW_COPY_AND_ASSIGN(RenderWidgetScreenMetricsEmulator); |
84 }; | 84 }; |
85 | 85 |
86 } // namespace content | 86 } // namespace content |
87 | 87 |
88 #endif // CONTENT_RENDERER_DEVTOOLS_RENDER_WIDGET_SCREEN_METRICS_EMULATOR_H_ | 88 #endif // CONTENT_RENDERER_DEVTOOLS_RENDER_WIDGET_SCREEN_METRICS_EMULATOR_H_ |
OLD | NEW |