| OLD | NEW |
| 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 "components/signin/core/browser/signin_manager_base.h" | 5 #include "components/signin/core/browser/signin_manager_base.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 SigninManagerBase::~SigninManagerBase() {} | 29 SigninManagerBase::~SigninManagerBase() {} |
| 30 | 30 |
| 31 void SigninManagerBase::Initialize(PrefService* local_state) { | 31 void SigninManagerBase::Initialize(PrefService* local_state) { |
| 32 // Should never call Initialize() twice. | 32 // Should never call Initialize() twice. |
| 33 DCHECK(!IsInitialized()); | 33 DCHECK(!IsInitialized()); |
| 34 initialized_ = true; | 34 initialized_ = true; |
| 35 | 35 |
| 36 // If the user is clearing the token service from the command line, then | 36 // If the user is clearing the token service from the command line, then |
| 37 // clear their login info also (not valid to be logged in without any | 37 // clear their login info also (not valid to be logged in without any |
| 38 // tokens). | 38 // tokens). |
| 39 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 39 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
| 40 if (cmd_line->HasSwitch(switches::kClearTokenService)) | 40 if (cmd_line->HasSwitch(switches::kClearTokenService)) |
| 41 client_->GetPrefs()->ClearPref(prefs::kGoogleServicesUsername); | 41 client_->GetPrefs()->ClearPref(prefs::kGoogleServicesUsername); |
| 42 | 42 |
| 43 std::string user = | 43 std::string user = |
| 44 client_->GetPrefs()->GetString(prefs::kGoogleServicesUsername); | 44 client_->GetPrefs()->GetString(prefs::kGoogleServicesUsername); |
| 45 if (!user.empty()) | 45 if (!user.empty()) |
| 46 SetAuthenticatedUsername(user); | 46 SetAuthenticatedUsername(user); |
| 47 } | 47 } |
| 48 | 48 |
| 49 bool SigninManagerBase::IsInitialized() const { return initialized_; } | 49 bool SigninManagerBase::IsInitialized() const { return initialized_; } |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 NotifySigninValueChanged(field, value)); | 144 NotifySigninValueChanged(field, value)); |
| 145 } | 145 } |
| 146 | 146 |
| 147 void SigninManagerBase::NotifyDiagnosticsObservers( | 147 void SigninManagerBase::NotifyDiagnosticsObservers( |
| 148 const TimedSigninStatusField& field, | 148 const TimedSigninStatusField& field, |
| 149 const std::string& value) { | 149 const std::string& value) { |
| 150 FOR_EACH_OBSERVER(SigninDiagnosticsObserver, | 150 FOR_EACH_OBSERVER(SigninDiagnosticsObserver, |
| 151 signin_diagnostics_observers_, | 151 signin_diagnostics_observers_, |
| 152 NotifySigninValueChanged(field, value)); | 152 NotifySigninValueChanged(field, value)); |
| 153 } | 153 } |
| OLD | NEW |