| OLD | NEW |
| 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 #include <utility> |
| 9 | 10 |
| 10 #include "base/bind.h" | 11 #include "base/bind.h" |
| 11 #include "base/logging.h" | 12 #include "base/logging.h" |
| 12 #include "chromeos/geolocation/geoposition.h" | 13 #include "chromeos/geolocation/geoposition.h" |
| 13 #include "net/url_request/url_request_context_getter.h" | 14 #include "net/url_request/url_request_context_getter.h" |
| 14 | 15 |
| 15 namespace chromeos { | 16 namespace chromeos { |
| 16 | 17 |
| 17 TimeZoneProvider::TimeZoneProvider( | 18 TimeZoneProvider::TimeZoneProvider( |
| 18 net::URLRequestContextGetter* url_context_getter, | 19 net::URLRequestContextGetter* url_context_getter, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 48 scoped_ptr<TimeZoneResponseData> timezone, | 49 scoped_ptr<TimeZoneResponseData> timezone, |
| 49 bool server_error) { | 50 bool server_error) { |
| 50 ScopedVector<TimeZoneRequest>::iterator position = | 51 ScopedVector<TimeZoneRequest>::iterator position = |
| 51 std::find(requests_.begin(), requests_.end(), request); | 52 std::find(requests_.begin(), requests_.end(), request); |
| 52 DCHECK(position != requests_.end()); | 53 DCHECK(position != requests_.end()); |
| 53 if (position != requests_.end()) { | 54 if (position != requests_.end()) { |
| 54 std::swap(*position, *requests_.rbegin()); | 55 std::swap(*position, *requests_.rbegin()); |
| 55 requests_.resize(requests_.size() - 1); | 56 requests_.resize(requests_.size() - 1); |
| 56 } | 57 } |
| 57 | 58 |
| 58 callback.Run(timezone.Pass(), server_error); | 59 callback.Run(std::move(timezone), server_error); |
| 59 } | 60 } |
| 60 | 61 |
| 61 } // namespace chromeos | 62 } // namespace chromeos |
| OLD | NEW |