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

Side by Side Diff: content/browser/geolocation/geolocation_provider_impl.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 (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/browser/geolocation/geolocation_provider_impl.h" 5 #include "content/browser/geolocation/geolocation_provider_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/ptr_util.h"
12 #include "base/memory/singleton.h" 13 #include "base/memory/singleton.h"
13 #include "base/single_thread_task_runner.h" 14 #include "base/single_thread_task_runner.h"
14 #include "content/browser/geolocation/location_arbitrator_impl.h" 15 #include "content/browser/geolocation/location_arbitrator_impl.h"
15 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
16 17
17 namespace content { 18 namespace content {
18 19
19 GeolocationProvider* GeolocationProvider::GetInstance() { 20 GeolocationProvider* GeolocationProvider::GetInstance() {
20 return GeolocationProviderImpl::GetInstance(); 21 return GeolocationProviderImpl::GetInstance();
21 } 22 }
22 23
23 scoped_ptr<GeolocationProvider::Subscription> 24 std::unique_ptr<GeolocationProvider::Subscription>
24 GeolocationProviderImpl::AddLocationUpdateCallback( 25 GeolocationProviderImpl::AddLocationUpdateCallback(
25 const LocationUpdateCallback& callback, 26 const LocationUpdateCallback& callback,
26 bool enable_high_accuracy) { 27 bool enable_high_accuracy) {
27 DCHECK_CURRENTLY_ON(BrowserThread::UI); 28 DCHECK_CURRENTLY_ON(BrowserThread::UI);
28 scoped_ptr<GeolocationProvider::Subscription> subscription; 29 std::unique_ptr<GeolocationProvider::Subscription> subscription;
29 if (enable_high_accuracy) { 30 if (enable_high_accuracy) {
30 subscription = high_accuracy_callbacks_.Add(callback); 31 subscription = high_accuracy_callbacks_.Add(callback);
31 } else { 32 } else {
32 subscription = low_accuracy_callbacks_.Add(callback); 33 subscription = low_accuracy_callbacks_.Add(callback);
33 } 34 }
34 35
35 OnClientsChanged(); 36 OnClientsChanged();
36 if (position_.Validate() || 37 if (position_.Validate() ||
37 position_.error_code != Geoposition::ERROR_CODE_NONE) { 38 position_.error_code != Geoposition::ERROR_CODE_NONE) {
38 callback.Run(position_); 39 callback.Run(position_);
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 DCHECK(OnGeolocationThread()); 163 DCHECK(OnGeolocationThread());
163 DCHECK(!arbitrator_); 164 DCHECK(!arbitrator_);
164 arbitrator_ = CreateArbitrator(); 165 arbitrator_ = CreateArbitrator();
165 } 166 }
166 167
167 void GeolocationProviderImpl::CleanUp() { 168 void GeolocationProviderImpl::CleanUp() {
168 DCHECK(OnGeolocationThread()); 169 DCHECK(OnGeolocationThread());
169 arbitrator_.reset(); 170 arbitrator_.reset();
170 } 171 }
171 172
172 scoped_ptr<LocationArbitrator> GeolocationProviderImpl::CreateArbitrator() { 173 std::unique_ptr<LocationArbitrator>
174 GeolocationProviderImpl::CreateArbitrator() {
173 LocationArbitratorImpl::LocationUpdateCallback callback = base::Bind( 175 LocationArbitratorImpl::LocationUpdateCallback callback = base::Bind(
174 &GeolocationProviderImpl::OnLocationUpdate, base::Unretained(this)); 176 &GeolocationProviderImpl::OnLocationUpdate, base::Unretained(this));
175 return make_scoped_ptr(new LocationArbitratorImpl(callback)); 177 return base::WrapUnique(new LocationArbitratorImpl(callback));
176 } 178 }
177 179
178 } // namespace content 180 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698