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

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

Issue 790793008: chromeos: Remove unused private data members (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 | « chromeos/timezone/timezone_provider.h ('k') | chromeos/timezone/timezone_request.h » ('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 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 "chromeos/timezone/timezone_provider.h" 5 #include "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 10 matching lines...) Expand all
21 const GURL& url) 21 const GURL& url)
22 : url_context_getter_(url_context_getter), url_(url) { 22 : url_context_getter_(url_context_getter), url_(url) {
23 } 23 }
24 24
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,
32 base::TimeDelta timeout, 31 base::TimeDelta timeout,
33 TimeZoneRequest::TimeZoneResponseCallback callback) { 32 TimeZoneRequest::TimeZoneResponseCallback callback) {
34 TimeZoneRequest* request(new TimeZoneRequest( 33 TimeZoneRequest* request(new TimeZoneRequest(
35 url_context_getter_.get(), url_, position, sensor, timeout)); 34 url_context_getter_.get(), url_, position,timeout));
36 requests_.push_back(request); 35 requests_.push_back(request);
37 36
38 // TimeZoneProvider owns all requests. It is safe to pass unretained "this" 37 // TimeZoneProvider owns all requests. It is safe to pass unretained "this"
39 // because destruction of TimeZoneProvider cancels all requests. 38 // because destruction of TimeZoneProvider cancels all requests.
40 TimeZoneRequest::TimeZoneResponseCallback callback_tmp( 39 TimeZoneRequest::TimeZoneResponseCallback callback_tmp(
41 base::Bind(&TimeZoneProvider::OnTimezoneResponse, 40 base::Bind(&TimeZoneProvider::OnTimezoneResponse,
42 base::Unretained(this), 41 base::Unretained(this),
43 request, 42 request,
44 callback)); 43 callback));
45 request->MakeRequest(callback_tmp); 44 request->MakeRequest(callback_tmp);
46 } 45 }
47 46
48 void TimeZoneProvider::OnTimezoneResponse( 47 void TimeZoneProvider::OnTimezoneResponse(
49 TimeZoneRequest* request, 48 TimeZoneRequest* request,
50 TimeZoneRequest::TimeZoneResponseCallback callback, 49 TimeZoneRequest::TimeZoneResponseCallback callback,
51 scoped_ptr<TimeZoneResponseData> timezone, 50 scoped_ptr<TimeZoneResponseData> timezone,
52 bool server_error) { 51 bool server_error) {
53 ScopedVector<TimeZoneRequest>::iterator new_end = 52 ScopedVector<TimeZoneRequest>::iterator new_end =
54 std::remove(requests_.begin(), requests_.end(), request); 53 std::remove(requests_.begin(), requests_.end(), request);
55 DCHECK_EQ(std::distance(new_end, requests_.end()), 1); 54 DCHECK_EQ(std::distance(new_end, requests_.end()), 1);
56 requests_.erase(new_end, requests_.end()); 55 requests_.erase(new_end, requests_.end());
57 56
58 callback.Run(timezone.Pass(), server_error); 57 callback.Run(timezone.Pass(), server_error);
59 } 58 }
60 59
61 } // namespace chromeos 60 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/timezone/timezone_provider.h ('k') | chromeos/timezone/timezone_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698