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

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

Issue 1874893002: Convert //content/browser from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 UpdateDeviceEmulationState(); 78 UpdateDeviceEmulationState();
79 } 79 }
80 80
81 Response EmulationHandler::SetGeolocationOverride( 81 Response EmulationHandler::SetGeolocationOverride(
82 double* latitude, double* longitude, double* accuracy) { 82 double* latitude, double* longitude, double* accuracy) {
83 if (!GetWebContents()) 83 if (!GetWebContents())
84 return Response::InternalError("Could not connect to view"); 84 return Response::InternalError("Could not connect to view");
85 85
86 GeolocationServiceContext* geolocation_context = 86 GeolocationServiceContext* geolocation_context =
87 GetWebContents()->GetGeolocationServiceContext(); 87 GetWebContents()->GetGeolocationServiceContext();
88 scoped_ptr<Geoposition> geoposition(new Geoposition()); 88 std::unique_ptr<Geoposition> geoposition(new Geoposition());
89 if (latitude && longitude && accuracy) { 89 if (latitude && longitude && accuracy) {
90 geoposition->latitude = *latitude; 90 geoposition->latitude = *latitude;
91 geoposition->longitude = *longitude; 91 geoposition->longitude = *longitude;
92 geoposition->accuracy = *accuracy; 92 geoposition->accuracy = *accuracy;
93 geoposition->timestamp = base::Time::Now(); 93 geoposition->timestamp = base::Time::Now();
94 if (!geoposition->Validate()) { 94 if (!geoposition->Validate()) {
95 return Response::InternalError("Invalid geolocation"); 95 return Response::InternalError("Invalid geolocation");
96 } 96 }
97 } else { 97 } else {
98 geoposition->error_code = Geoposition::ERROR_CODE_POSITION_UNAVAILABLE; 98 geoposition->error_code = Geoposition::ERROR_CODE_POSITION_UNAVAILABLE;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 double device_scale_factor, 139 double device_scale_factor,
140 bool mobile, 140 bool mobile,
141 bool fit_window, 141 bool fit_window,
142 const double* optional_scale, 142 const double* optional_scale,
143 const double* optional_offset_x, 143 const double* optional_offset_x,
144 const double* optional_offset_y, 144 const double* optional_offset_y,
145 const int* screen_width, 145 const int* screen_width,
146 const int* screen_height, 146 const int* screen_height,
147 const int* position_x, 147 const int* position_x,
148 const int* position_y, 148 const int* position_y,
149 const scoped_ptr<base::DictionaryValue>& screen_orientation) { 149 const std::unique_ptr<base::DictionaryValue>& screen_orientation) {
150 const static int max_size = 10000000; 150 const static int max_size = 10000000;
151 const static double max_scale = 10; 151 const static double max_scale = 10;
152 const static int max_orientation_angle = 360; 152 const static int max_orientation_angle = 360;
153 153
154 if (!host_) 154 if (!host_)
155 return Response::InternalError("Could not connect to view"); 155 return Response::InternalError("Could not connect to view");
156 156
157 if (screen_width && screen_height && 157 if (screen_width && screen_height &&
158 (*screen_width < 0 || *screen_height < 0 || 158 (*screen_width < 0 || *screen_height < 0 ||
159 *screen_width > max_size || *screen_height > max_size)) { 159 *screen_width > max_size || *screen_height > max_size)) {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 widget_host->GetRoutingID(), device_emulation_params_)); 271 widget_host->GetRoutingID(), device_emulation_params_));
272 } else { 272 } else {
273 widget_host->Send(new ViewMsg_DisableDeviceEmulation( 273 widget_host->Send(new ViewMsg_DisableDeviceEmulation(
274 widget_host->GetRoutingID())); 274 widget_host->GetRoutingID()));
275 } 275 }
276 } 276 }
277 277
278 } // namespace emulation 278 } // namespace emulation
279 } // namespace devtools 279 } // namespace devtools
280 } // namespace content 280 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/devtools/protocol/emulation_handler.h ('k') | content/browser/devtools/protocol/input_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698