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/signin/signin_manager_fake.h" | 5 #include "chrome/browser/signin/signin_manager_fake.h" |
6 | 6 |
7 #include "chrome/common/chrome_notification_types.h" | 7 FakeSigninManager::FakeSigninManager() {} |
8 #include "content/public/browser/notification_service.h" | |
9 | |
10 FakeSigninManager::FakeSigninManager(Profile* profile) { | |
11 profile_ = profile; | |
12 } | |
13 | 8 |
14 FakeSigninManager::~FakeSigninManager() {} | 9 FakeSigninManager::~FakeSigninManager() {} |
15 | 10 |
16 void FakeSigninManager::StartSignIn(const std::string& username, | 11 void FakeSigninManager::StartSignIn(const std::string& username, |
17 const std::string& password, | 12 const std::string& password, |
18 const std::string& login_token, | 13 const std::string& login_token, |
19 const std::string& login_captcha) { | 14 const std::string& login_captcha) { |
20 SetAuthenticatedUsername(username); | 15 SetAuthenticatedUsername(username); |
21 } | 16 } |
22 | 17 |
23 void FakeSigninManager::StartSignInWithCredentials( | 18 void FakeSigninManager::StartSignInWithCredentials( |
24 const std::string& session_index, | 19 const std::string& session_index, |
25 const std::string& username, | 20 const std::string& username, |
26 const std::string& password) { | 21 const std::string& password) { |
27 SetAuthenticatedUsername(username); | 22 SetAuthenticatedUsername(username); |
28 } | 23 } |
29 | 24 |
30 void FakeSigninManager::StartSignInWithOAuth(const std::string& username, | 25 void FakeSigninManager::StartSignInWithOAuth(const std::string& username, |
31 const std::string& password) { | 26 const std::string& password) { |
32 SetAuthenticatedUsername(username); | 27 SetAuthenticatedUsername(username); |
33 } | 28 } |
34 | 29 |
35 void FakeSigninManager::SignOut() { | 30 void FakeSigninManager::SignOut() { |
36 authenticated_username_.clear(); | 31 authenticated_username_.clear(); |
37 content::NotificationService::current()->Notify( | |
38 chrome::NOTIFICATION_GOOGLE_SIGNED_OUT, | |
39 content::Source<Profile>(profile_), | |
40 content::NotificationService::NoDetails()); | |
41 } | 32 } |
42 | 33 |
43 // static | 34 // static |
44 ProfileKeyedService* FakeSigninManager::Build(Profile* profile) { | 35 ProfileKeyedService* FakeSigninManager::Build(Profile* profile) { |
45 return new FakeSigninManager(profile); | 36 return new FakeSigninManager(); |
46 } | 37 } |
OLD | NEW |