| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/settings/device_oauth2_token_service.h" | 5 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 12 #include "base/location.h" |
| 12 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 13 #include "base/message_loop/message_loop.h" | 14 #include "base/single_thread_task_runner.h" |
| 15 #include "base/threading/thread_task_runner_handle.h" |
| 14 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 15 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
| 16 #include "components/prefs/pref_registry_simple.h" | 18 #include "components/prefs/pref_registry_simple.h" |
| 17 #include "google_apis/gaia/google_service_auth_error.h" | 19 #include "google_apis/gaia/google_service_auth_error.h" |
| 18 | 20 |
| 19 namespace chromeos { | 21 namespace chromeos { |
| 20 | 22 |
| 21 struct DeviceOAuth2TokenService::PendingRequest { | 23 struct DeviceOAuth2TokenService::PendingRequest { |
| 22 PendingRequest(const base::WeakPtr<RequestImpl>& request, | 24 PendingRequest(const base::WeakPtr<RequestImpl>& request, |
| 23 const std::string& client_id, | 25 const std::string& client_id, |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 } else { | 128 } else { |
| 127 FailRequest(scoped_request->request.get(), error); | 129 FailRequest(scoped_request->request.get(), error); |
| 128 } | 130 } |
| 129 } | 131 } |
| 130 } | 132 } |
| 131 | 133 |
| 132 void DeviceOAuth2TokenService::FailRequest( | 134 void DeviceOAuth2TokenService::FailRequest( |
| 133 RequestImpl* request, | 135 RequestImpl* request, |
| 134 GoogleServiceAuthError::State error) { | 136 GoogleServiceAuthError::State error) { |
| 135 GoogleServiceAuthError auth_error(error); | 137 GoogleServiceAuthError auth_error(error); |
| 136 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind( | 138 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 137 &RequestImpl::InformConsumer, | 139 FROM_HERE, base::Bind(&RequestImpl::InformConsumer, request->AsWeakPtr(), |
| 138 request->AsWeakPtr(), | 140 auth_error, std::string(), base::Time())); |
| 139 auth_error, | |
| 140 std::string(), | |
| 141 base::Time())); | |
| 142 } | 141 } |
| 143 | 142 |
| 144 } // namespace chromeos | 143 } // namespace chromeos |
| OLD | NEW |