Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: chrome/browser/extensions/extension_install_prompt.cc

Issue 23382008: Making OAuth2TokenService multi-login aware, updating callers, minor fixes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding the AndroidPO2TS update Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/extension_install_prompt.h" 5 #include "chrome/browser/extensions/extension_install_prompt.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 const extensions::OAuth2Info& oauth2_info = 707 const extensions::OAuth2Info& oauth2_info =
708 extensions::OAuth2Info::GetOAuth2Info(extension_); 708 extensions::OAuth2Info::GetOAuth2Info(extension_);
709 if (oauth2_info.client_id.empty() || 709 if (oauth2_info.client_id.empty() ||
710 oauth2_info.scopes.empty()) { 710 oauth2_info.scopes.empty()) {
711 ShowConfirmation(); 711 ShowConfirmation();
712 return; 712 return;
713 } 713 }
714 714
715 ProfileOAuth2TokenService* token_service = 715 ProfileOAuth2TokenService* token_service =
716 ProfileOAuth2TokenServiceFactory::GetForProfile(install_ui_->profile()); 716 ProfileOAuth2TokenServiceFactory::GetForProfile(install_ui_->profile());
717 if (!token_service || !token_service->RefreshTokenIsAvailable()) { 717 if (!token_service || !token_service->RefreshTokenIsAvailable(
718 token_service->GetPrimaryAccountId())) {
718 ShowConfirmation(); 719 ShowConfirmation();
719 return; 720 return;
720 } 721 }
721 722
722 // Get an access token from the token service. 723 // Get an access token from the token service.
723 login_token_request_ = token_service->StartRequest( 724 login_token_request_ = token_service->StartRequest(
724 OAuth2TokenService::ScopeSet(), this); 725 token_service->GetPrimaryAccountId(),
726 OAuth2TokenService::ScopeSet(),
727 this);
725 } 728 }
726 729
727 void ExtensionInstallPrompt::OnGetTokenSuccess( 730 void ExtensionInstallPrompt::OnGetTokenSuccess(
728 const OAuth2TokenService::Request* request, 731 const OAuth2TokenService::Request* request,
729 const std::string& access_token, 732 const std::string& access_token,
730 const base::Time& expiration_time) { 733 const base::Time& expiration_time) {
731 DCHECK_EQ(login_token_request_.get(), request); 734 DCHECK_EQ(login_token_request_.get(), request);
732 login_token_request_.reset(); 735 login_token_request_.reset();
733 736
734 const extensions::OAuth2Info& oauth2_info = 737 const extensions::OAuth2Info& oauth2_info =
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 } 803 }
801 804
802 if (AutoConfirmPrompt(delegate_)) 805 if (AutoConfirmPrompt(delegate_))
803 return; 806 return;
804 807
805 if (show_dialog_callback_.is_null()) 808 if (show_dialog_callback_.is_null())
806 GetDefaultShowDialogCallback().Run(show_params_, delegate_, prompt_); 809 GetDefaultShowDialogCallback().Run(show_params_, delegate_, prompt_);
807 else 810 else
808 show_dialog_callback_.Run(show_params_, delegate_, prompt_); 811 show_dialog_callback_.Run(show_params_, delegate_, prompt_);
809 } 812 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698