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

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: Fixing a bug affecting ProfileSyncService and CR comments. 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 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 const extensions::OAuth2Info& oauth2_info = 747 const extensions::OAuth2Info& oauth2_info =
748 extensions::OAuth2Info::GetOAuth2Info(extension_); 748 extensions::OAuth2Info::GetOAuth2Info(extension_);
749 if (oauth2_info.client_id.empty() || 749 if (oauth2_info.client_id.empty() ||
750 oauth2_info.scopes.empty()) { 750 oauth2_info.scopes.empty()) {
751 ShowConfirmation(); 751 ShowConfirmation();
752 return; 752 return;
753 } 753 }
754 754
755 ProfileOAuth2TokenService* token_service = 755 ProfileOAuth2TokenService* token_service =
756 ProfileOAuth2TokenServiceFactory::GetForProfile(install_ui_->profile()); 756 ProfileOAuth2TokenServiceFactory::GetForProfile(install_ui_->profile());
757 if (!token_service || !token_service->RefreshTokenIsAvailable()) { 757 if (!token_service || !token_service->RefreshTokenIsAvailable(
758 token_service->GetPrimaryAccountId())) {
758 ShowConfirmation(); 759 ShowConfirmation();
759 return; 760 return;
760 } 761 }
761 762
762 // Get an access token from the token service. 763 // Get an access token from the token service.
763 login_token_request_ = token_service->StartRequest( 764 login_token_request_ = token_service->StartRequest(
764 OAuth2TokenService::ScopeSet(), this); 765 token_service->GetPrimaryAccountId(),
766 OAuth2TokenService::ScopeSet(),
767 this);
765 } 768 }
766 769
767 void ExtensionInstallPrompt::OnGetTokenSuccess( 770 void ExtensionInstallPrompt::OnGetTokenSuccess(
768 const OAuth2TokenService::Request* request, 771 const OAuth2TokenService::Request* request,
769 const std::string& access_token, 772 const std::string& access_token,
770 const base::Time& expiration_time) { 773 const base::Time& expiration_time) {
771 DCHECK_EQ(login_token_request_.get(), request); 774 DCHECK_EQ(login_token_request_.get(), request);
772 login_token_request_.reset(); 775 login_token_request_.reset();
773 776
774 const extensions::OAuth2Info& oauth2_info = 777 const extensions::OAuth2Info& oauth2_info =
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 } 843 }
841 844
842 if (AutoConfirmPrompt(delegate_)) 845 if (AutoConfirmPrompt(delegate_))
843 return; 846 return;
844 847
845 if (show_dialog_callback_.is_null()) 848 if (show_dialog_callback_.is_null())
846 GetDefaultShowDialogCallback().Run(show_params_, delegate_, prompt_); 849 GetDefaultShowDialogCallback().Run(show_params_, delegate_, prompt_);
847 else 850 else
848 show_dialog_callback_.Run(show_params_, delegate_, prompt_); 851 show_dialog_callback_.Run(show_params_, delegate_, prompt_);
849 } 852 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698