Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Side by Side Diff: content/browser/devtools/protocol/emulation_handler.cc

Issue 2237433004: Adds DevTools commands for forced viewport override. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adress Dmitry's comments + sync. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/renderer/devtools/render_widget_screen_metrics_emulator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | content/renderer/devtools/render_widget_screen_metrics_emulator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698