| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/extensions/api/identity/identity_get_auth_token_functio
n.h" | 5 #include "chrome/browser/extensions/api/identity/identity_get_auth_token_functio
n.h" |
| 6 | 6 |
| 7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 8 #include "chrome/browser/extensions/api/identity/identity_api.h" | 8 #include "chrome/browser/extensions/api/identity/identity_api.h" |
| 9 #include "chrome/browser/extensions/api/identity/identity_constants.h" | 9 #include "chrome/browser/extensions/api/identity/identity_constants.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 extensions::IdentityAPI::GetFactoryInstance() | 179 extensions::IdentityAPI::GetFactoryInstance() |
| 180 ->Get(GetProfile()) | 180 ->Get(GetProfile()) |
| 181 ->set_get_auth_token_function(nullptr); | 181 ->set_get_auth_token_function(nullptr); |
| 182 | 182 |
| 183 SendResponse(success); | 183 SendResponse(success); |
| 184 Release(); // Balanced in StartAsyncRun | 184 Release(); // Balanced in StartAsyncRun |
| 185 } | 185 } |
| 186 | 186 |
| 187 void IdentityGetAuthTokenFunction::CompleteFunctionWithResult( | 187 void IdentityGetAuthTokenFunction::CompleteFunctionWithResult( |
| 188 const std::string& access_token) { | 188 const std::string& access_token) { |
| 189 SetResult(base::MakeUnique<base::StringValue>(access_token)); | 189 SetResult(base::MakeUnique<base::Value>(access_token)); |
| 190 CompleteAsyncRun(true); | 190 CompleteAsyncRun(true); |
| 191 } | 191 } |
| 192 | 192 |
| 193 void IdentityGetAuthTokenFunction::CompleteFunctionWithError( | 193 void IdentityGetAuthTokenFunction::CompleteFunctionWithError( |
| 194 const std::string& error) { | 194 const std::string& error) { |
| 195 TRACE_EVENT_ASYNC_STEP_PAST1("identity", | 195 TRACE_EVENT_ASYNC_STEP_PAST1("identity", |
| 196 "IdentityGetAuthTokenFunction", | 196 "IdentityGetAuthTokenFunction", |
| 197 this, | 197 this, |
| 198 "CompleteFunctionWithError", | 198 "CompleteFunctionWithError", |
| 199 "error", | 199 "error", |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 // Component apps using auto_approve may use Chrome's client ID by | 638 // Component apps using auto_approve may use Chrome's client ID by |
| 639 // omitting the field. | 639 // omitting the field. |
| 640 if (client_id.empty() && extension()->location() == Manifest::COMPONENT && | 640 if (client_id.empty() && extension()->location() == Manifest::COMPONENT && |
| 641 oauth2_info.auto_approve) { | 641 oauth2_info.auto_approve) { |
| 642 client_id = GaiaUrls::GetInstance()->oauth2_chrome_client_id(); | 642 client_id = GaiaUrls::GetInstance()->oauth2_chrome_client_id(); |
| 643 } | 643 } |
| 644 return client_id; | 644 return client_id; |
| 645 } | 645 } |
| 646 | 646 |
| 647 } // namespace extensions | 647 } // namespace extensions |
| OLD | NEW |