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

Side by Side Diff: chrome/browser/chromeos/timezone/timezone_provider.cc

Issue 555253005: Remove implicit conversions from scoped_refptr to T* in c/b/chromeos (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/chromeos/timezone/timezone_provider.h" 5 #include "chrome/browser/chromeos/timezone/timezone_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 14 matching lines...) Expand all
25 TimeZoneProvider::~TimeZoneProvider() { 25 TimeZoneProvider::~TimeZoneProvider() {
26 DCHECK(thread_checker_.CalledOnValidThread()); 26 DCHECK(thread_checker_.CalledOnValidThread());
27 } 27 }
28 28
29 void TimeZoneProvider::RequestTimezone( 29 void TimeZoneProvider::RequestTimezone(
30 const Geoposition& position, 30 const Geoposition& position,
31 bool sensor, 31 bool sensor,
32 base::TimeDelta timeout, 32 base::TimeDelta timeout,
33 TimeZoneRequest::TimeZoneResponseCallback callback) { 33 TimeZoneRequest::TimeZoneResponseCallback callback) {
34 TimeZoneRequest* request(new TimeZoneRequest( 34 TimeZoneRequest* request(new TimeZoneRequest(
35 url_context_getter_, url_, position, sensor, timeout)); 35 url_context_getter_.get(), url_, position, sensor, timeout));
36 requests_.push_back(request); 36 requests_.push_back(request);
37 37
38 // TimeZoneProvider owns all requests. It is safe to pass unretained "this" 38 // TimeZoneProvider owns all requests. It is safe to pass unretained "this"
39 // because destruction of TimeZoneProvider cancels all requests. 39 // because destruction of TimeZoneProvider cancels all requests.
40 TimeZoneRequest::TimeZoneResponseCallback callback_tmp( 40 TimeZoneRequest::TimeZoneResponseCallback callback_tmp(
41 base::Bind(&TimeZoneProvider::OnTimezoneResponse, 41 base::Bind(&TimeZoneProvider::OnTimezoneResponse,
42 base::Unretained(this), 42 base::Unretained(this),
43 request, 43 request,
44 callback)); 44 callback));
45 request->MakeRequest(callback_tmp); 45 request->MakeRequest(callback_tmp);
46 } 46 }
47 47
48 void TimeZoneProvider::OnTimezoneResponse( 48 void TimeZoneProvider::OnTimezoneResponse(
49 TimeZoneRequest* request, 49 TimeZoneRequest* request,
50 TimeZoneRequest::TimeZoneResponseCallback callback, 50 TimeZoneRequest::TimeZoneResponseCallback callback,
51 scoped_ptr<TimeZoneResponseData> timezone, 51 scoped_ptr<TimeZoneResponseData> timezone,
52 bool server_error) { 52 bool server_error) {
53 ScopedVector<TimeZoneRequest>::iterator new_end = 53 ScopedVector<TimeZoneRequest>::iterator new_end =
54 std::remove(requests_.begin(), requests_.end(), request); 54 std::remove(requests_.begin(), requests_.end(), request);
55 DCHECK_EQ(std::distance(new_end, requests_.end()), 1); 55 DCHECK_EQ(std::distance(new_end, requests_.end()), 1);
56 requests_.erase(new_end, requests_.end()); 56 requests_.erase(new_end, requests_.end());
57 57
58 callback.Run(timezone.Pass(), server_error); 58 callback.Run(timezone.Pass(), server_error);
59 } 59 }
60 60
61 } // namespace chromeos 61 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/preferences.cc ('k') | chrome/browser/chromeos/timezone/timezone_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698