OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/browser/devtools/protocol/emulation_handler.h" | 5 #include "content/browser/devtools/protocol/emulation_handler.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 params.screenPosition = mobile ? blink::WebDeviceEmulationParams::Mobile : | 214 params.screenPosition = mobile ? blink::WebDeviceEmulationParams::Mobile : |
215 blink::WebDeviceEmulationParams::Desktop; | 215 blink::WebDeviceEmulationParams::Desktop; |
216 if (screen_width && screen_height) | 216 if (screen_width && screen_height) |
217 params.screenSize = blink::WebSize(*screen_width, *screen_height); | 217 params.screenSize = blink::WebSize(*screen_width, *screen_height); |
218 if (position_x && position_y) | 218 if (position_x && position_y) |
219 params.viewPosition = blink::WebPoint(*position_x, *position_y); | 219 params.viewPosition = blink::WebPoint(*position_x, *position_y); |
220 params.deviceScaleFactor = device_scale_factor; | 220 params.deviceScaleFactor = device_scale_factor; |
221 params.viewSize = blink::WebSize(width, height); | 221 params.viewSize = blink::WebSize(width, height); |
222 params.fitToView = fit_window; | 222 params.fitToView = fit_window; |
223 params.scale = optional_scale ? *optional_scale : 1; | 223 params.scale = optional_scale ? *optional_scale : 1; |
224 params.offset = blink::WebFloatPoint( | |
225 optional_offset_x ? *optional_offset_x : 0.f, | |
226 optional_offset_y ? *optional_offset_y : 0.f); | |
227 params.screenOrientationType = orientationType; | 224 params.screenOrientationType = orientationType; |
228 params.screenOrientationAngle = orientationAngle; | 225 params.screenOrientationAngle = orientationAngle; |
229 | 226 |
230 if (device_emulation_enabled_ && params == device_emulation_params_) | 227 if (device_emulation_enabled_ && params == device_emulation_params_) |
231 return Response::OK(); | 228 return Response::OK(); |
232 | 229 |
233 device_emulation_enabled_ = true; | 230 device_emulation_enabled_ = true; |
234 device_emulation_params_ = params; | 231 device_emulation_params_ = params; |
235 UpdateDeviceEmulationState(); | 232 UpdateDeviceEmulationState(); |
236 return Response::OK(); | 233 return Response::OK(); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 widget_host->GetRoutingID(), device_emulation_params_)); | 285 widget_host->GetRoutingID(), device_emulation_params_)); |
289 } else { | 286 } else { |
290 widget_host->Send(new ViewMsg_DisableDeviceEmulation( | 287 widget_host->Send(new ViewMsg_DisableDeviceEmulation( |
291 widget_host->GetRoutingID())); | 288 widget_host->GetRoutingID())); |
292 } | 289 } |
293 } | 290 } |
294 | 291 |
295 } // namespace emulation | 292 } // namespace emulation |
296 } // namespace devtools | 293 } // namespace devtools |
297 } // namespace content | 294 } // namespace content |
OLD | NEW |