| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_api.h" | 5 #include "chrome/browser/extensions/api/identity/identity_api.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 infos->Append(account_info.ToValue().release()); | 281 infos->Append(account_info.ToValue().release()); |
| 282 } | 282 } |
| 283 | 283 |
| 284 return RespondNow(OneArgument(infos)); | 284 return RespondNow(OneArgument(infos)); |
| 285 } | 285 } |
| 286 | 286 |
| 287 IdentityGetAuthTokenFunction::IdentityGetAuthTokenFunction() | 287 IdentityGetAuthTokenFunction::IdentityGetAuthTokenFunction() |
| 288 : OAuth2TokenService::Consumer("extensions_identity_api"), | 288 : OAuth2TokenService::Consumer("extensions_identity_api"), |
| 289 should_prompt_for_scopes_(false), | 289 should_prompt_for_scopes_(false), |
| 290 should_prompt_for_signin_(false) { | 290 should_prompt_for_signin_(false) { |
| 291 TRACE_EVENT_ASYNC_BEGIN1("identity", | |
| 292 "IdentityGetAuthTokenFunction", | |
| 293 this, | |
| 294 "extension", | |
| 295 extension()->id()); | |
| 296 } | 291 } |
| 297 | 292 |
| 298 IdentityGetAuthTokenFunction::~IdentityGetAuthTokenFunction() { | 293 IdentityGetAuthTokenFunction::~IdentityGetAuthTokenFunction() { |
| 299 TRACE_EVENT_ASYNC_END0("identity", "IdentityGetAuthTokenFunction", this); | 294 TRACE_EVENT_ASYNC_END0("identity", "IdentityGetAuthTokenFunction", this); |
| 300 } | 295 } |
| 301 | 296 |
| 302 bool IdentityGetAuthTokenFunction::RunAsync() { | 297 bool IdentityGetAuthTokenFunction::RunAsync() { |
| 298 TRACE_EVENT_ASYNC_BEGIN1("identity", |
| 299 "IdentityGetAuthTokenFunction", |
| 300 this, |
| 301 "extension", |
| 302 extension()->id()); |
| 303 |
| 303 if (GetProfile()->IsOffTheRecord()) { | 304 if (GetProfile()->IsOffTheRecord()) { |
| 304 error_ = identity_constants::kOffTheRecord; | 305 error_ = identity_constants::kOffTheRecord; |
| 305 return false; | 306 return false; |
| 306 } | 307 } |
| 307 | 308 |
| 308 scoped_ptr<identity::GetAuthToken::Params> params( | 309 scoped_ptr<identity::GetAuthToken::Params> params( |
| 309 identity::GetAuthToken::Params::Create(*args_)); | 310 identity::GetAuthToken::Params::Create(*args_)); |
| 310 EXTENSION_FUNCTION_VALIDATE(params.get()); | 311 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 311 bool interactive = params->details.get() && | 312 bool interactive = params->details.get() && |
| 312 params->details->interactive.get() && | 313 params->details->interactive.get() && |
| (...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 943 void IdentityLaunchWebAuthFlowFunction::OnAuthFlowURLChange( | 944 void IdentityLaunchWebAuthFlowFunction::OnAuthFlowURLChange( |
| 944 const GURL& redirect_url) { | 945 const GURL& redirect_url) { |
| 945 if (redirect_url.GetWithEmptyPath() == final_url_prefix_) { | 946 if (redirect_url.GetWithEmptyPath() == final_url_prefix_) { |
| 946 SetResult(new base::StringValue(redirect_url.spec())); | 947 SetResult(new base::StringValue(redirect_url.spec())); |
| 947 SendResponse(true); | 948 SendResponse(true); |
| 948 Release(); // Balanced in RunAsync. | 949 Release(); // Balanced in RunAsync. |
| 949 } | 950 } |
| 950 } | 951 } |
| 951 | 952 |
| 952 } // namespace extensions | 953 } // namespace extensions |
| OLD | NEW |