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

Side by Side Diff: chrome/browser/invalidation/profile_invalidation_auth_provider.cc

Issue 196783002: Export a private webstore API to call into the new inline sign-in flow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add API tests Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/invalidation/profile_invalidation_auth_provider.h" 5 #include "chrome/browser/invalidation/profile_invalidation_auth_provider.h"
6 6
7 #include "chrome/browser/ui/webui/signin/login_ui_service.h" 7 #include "chrome/browser/ui/webui/signin/login_ui_service.h"
8 #include "components/signin/core/browser/profile_oauth2_token_service.h" 8 #include "components/signin/core/browser/profile_oauth2_token_service.h"
9 9
10 namespace invalidation { 10 namespace invalidation {
11 11
12 ProfileInvalidationAuthProvider::ProfileInvalidationAuthProvider( 12 ProfileInvalidationAuthProvider::ProfileInvalidationAuthProvider(
13 SigninManagerBase* signin_manager, 13 SigninManagerBase* signin_manager,
14 ProfileOAuth2TokenService* token_service, 14 ProfileOAuth2TokenService* token_service,
15 LoginUIService* login_ui_service) 15 LoginUIService* login_ui_service)
16 : signin_manager_(signin_manager), 16 : signin_manager_(signin_manager),
17 token_service_(token_service), 17 token_service_(token_service),
18 login_ui_service_(login_ui_service) { 18 login_ui_service_(login_ui_service) {
19 signin_manager_->AddObserver(this); 19 signin_manager_->AddObserver(this);
20 SigninManagerFactory::GetInstance()->AddObserver(this);
20 } 21 }
21 22
22 ProfileInvalidationAuthProvider::~ProfileInvalidationAuthProvider() { 23 ProfileInvalidationAuthProvider::~ProfileInvalidationAuthProvider() {
23 signin_manager_->RemoveObserver(this); 24 SigninManagerFactory::GetInstance()->RemoveObserver(this);
25 if (signin_manager_)
26 signin_manager_->RemoveObserver(this);
24 } 27 }
25 28
26 std::string ProfileInvalidationAuthProvider::GetAccountId() { 29 std::string ProfileInvalidationAuthProvider::GetAccountId() {
27 return signin_manager_->GetAuthenticatedAccountId(); 30 return signin_manager_->GetAuthenticatedAccountId();
28 } 31 }
29 32
30 OAuth2TokenService* ProfileInvalidationAuthProvider::GetTokenService() { 33 OAuth2TokenService* ProfileInvalidationAuthProvider::GetTokenService() {
31 return token_service_; 34 return token_service_;
32 } 35 }
33 36
34 bool ProfileInvalidationAuthProvider::ShowLoginUI() { 37 bool ProfileInvalidationAuthProvider::ShowLoginUI() {
35 login_ui_service_->ShowLoginPopup(); 38 login_ui_service_->ShowLoginPopup();
36 return true; 39 return true;
37 } 40 }
38 41
39 void ProfileInvalidationAuthProvider::GoogleSignedOut( 42 void ProfileInvalidationAuthProvider::GoogleSignedOut(
40 const std::string& username) { 43 const std::string& username) {
41 FireInvalidationAuthLogout(); 44 FireInvalidationAuthLogout();
42 } 45 }
43 46
47 void ProfileInvalidationAuthProvider::SigninManagerShutdown(
48 SigninManagerBase* manager) {
49 if (manager == signin_manager_) {
50 signin_manager_->RemoveObserver(this);
51 signin_manager_ = NULL;
52 }
53 }
54
44 } // namespace invalidation 55 } // namespace invalidation
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698