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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 CompleteMintTokenFlow(); | 559 CompleteMintTokenFlow(); |
560 | 560 |
561 should_prompt_for_signin_ = false; | 561 should_prompt_for_signin_ = false; |
562 // Existing grant was revoked and we used NO_FORCE, so we got info back | 562 // Existing grant was revoked and we used NO_FORCE, so we got info back |
563 // instead. Start a consent UI if we can. | 563 // instead. Start a consent UI if we can. |
564 issue_advice_ = issue_advice; | 564 issue_advice_ = issue_advice; |
565 StartMintTokenFlow(IdentityMintRequestQueue::MINT_TYPE_INTERACTIVE); | 565 StartMintTokenFlow(IdentityMintRequestQueue::MINT_TYPE_INTERACTIVE); |
566 } | 566 } |
567 | 567 |
568 void IdentityGetAuthTokenFunction::SigninSuccess() { | 568 void IdentityGetAuthTokenFunction::SigninSuccess() { |
| 569 // If there was no account associated this profile before the |
| 570 // sign-in, we may not have an account_id in the token_key yet. |
| 571 if (token_key_->account_id.empty()) { |
| 572 token_key_->account_id = GetPrimaryAccountId(GetProfile()); |
| 573 } |
| 574 |
569 StartMintTokenFlow(IdentityMintRequestQueue::MINT_TYPE_NONINTERACTIVE); | 575 StartMintTokenFlow(IdentityMintRequestQueue::MINT_TYPE_NONINTERACTIVE); |
570 } | 576 } |
571 | 577 |
572 void IdentityGetAuthTokenFunction::SigninFailed() { | 578 void IdentityGetAuthTokenFunction::SigninFailed() { |
573 CompleteFunctionWithError(identity_constants::kUserNotSignedIn); | 579 CompleteFunctionWithError(identity_constants::kUserNotSignedIn); |
574 } | 580 } |
575 | 581 |
576 void IdentityGetAuthTokenFunction::OnGaiaFlowFailure( | 582 void IdentityGetAuthTokenFunction::OnGaiaFlowFailure( |
577 GaiaWebAuthFlow::Failure failure, | 583 GaiaWebAuthFlow::Failure failure, |
578 GoogleServiceAuthError service_error, | 584 GoogleServiceAuthError service_error, |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
875 void IdentityLaunchWebAuthFlowFunction::OnAuthFlowURLChange( | 881 void IdentityLaunchWebAuthFlowFunction::OnAuthFlowURLChange( |
876 const GURL& redirect_url) { | 882 const GURL& redirect_url) { |
877 if (redirect_url.GetWithEmptyPath() == final_url_prefix_) { | 883 if (redirect_url.GetWithEmptyPath() == final_url_prefix_) { |
878 SetResult(new base::StringValue(redirect_url.spec())); | 884 SetResult(new base::StringValue(redirect_url.spec())); |
879 SendResponse(true); | 885 SendResponse(true); |
880 Release(); // Balanced in RunAsync. | 886 Release(); // Balanced in RunAsync. |
881 } | 887 } |
882 } | 888 } |
883 | 889 |
884 } // namespace extensions | 890 } // namespace extensions |
OLD | NEW |