| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/chromeos/profiles/profile_helper.h" | 5 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 10 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 !UserManager::Get()->IsLoggedInAsStub()) { | 111 !UserManager::Get()->IsLoggedInAsStub()) { |
| 112 chromeos::OAuth2LoginManager* login_manager = | 112 chromeos::OAuth2LoginManager* login_manager = |
| 113 chromeos::OAuth2LoginManagerFactory::GetInstance()->GetForProfile( | 113 chromeos::OAuth2LoginManagerFactory::GetInstance()->GetForProfile( |
| 114 profile); | 114 profile); |
| 115 if (login_manager) | 115 if (login_manager) |
| 116 login_manager->AddObserver(this); | 116 login_manager->AddObserver(this); |
| 117 } | 117 } |
| 118 } | 118 } |
| 119 | 119 |
| 120 base::FilePath ProfileHelper::GetActiveUserProfileDir() { | 120 base::FilePath ProfileHelper::GetActiveUserProfileDir() { |
| 121 DCHECK(!active_user_id_hash_.empty()); | 121 return GetUserProfileDir(active_user_id_hash_); |
| 122 return base::FilePath(chrome::kProfileDirPrefix + active_user_id_hash_); | 122 } |
| 123 |
| 124 base::FilePath ProfileHelper::GetUserProfileDir( |
| 125 const std::string& user_id_hash) { |
| 126 DCHECK(!user_id_hash.empty()); |
| 127 return base::FilePath(chrome::kProfileDirPrefix + user_id_hash); |
| 123 } | 128 } |
| 124 | 129 |
| 125 void ProfileHelper::Initialize() { | 130 void ProfileHelper::Initialize() { |
| 126 UserManager::Get()->AddSessionStateObserver(this); | 131 UserManager::Get()->AddSessionStateObserver(this); |
| 127 } | 132 } |
| 128 | 133 |
| 129 void ProfileHelper::ClearSigninProfile(const base::Closure& on_clear_callback) { | 134 void ProfileHelper::ClearSigninProfile(const base::Closure& on_clear_callback) { |
| 130 on_clear_callbacks_.push_back(on_clear_callback); | 135 on_clear_callbacks_.push_back(on_clear_callback); |
| 131 if (signin_profile_clear_requested_) | 136 if (signin_profile_clear_requested_) |
| 132 return; | 137 return; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 //////////////////////////////////////////////////////////////////////////////// | 180 //////////////////////////////////////////////////////////////////////////////// |
| 176 // ProfileHelper, UserManager::UserSessionStateObserver implementation: | 181 // ProfileHelper, UserManager::UserSessionStateObserver implementation: |
| 177 | 182 |
| 178 void ProfileHelper::ActiveUserHashChanged(const std::string& hash) { | 183 void ProfileHelper::ActiveUserHashChanged(const std::string& hash) { |
| 179 active_user_id_hash_ = hash; | 184 active_user_id_hash_ = hash; |
| 180 base::FilePath profile_path = GetProfilePathByUserIdHash(hash); | 185 base::FilePath profile_path = GetProfilePathByUserIdHash(hash); |
| 181 LOG(INFO) << "Switching to profile path: " << profile_path.value(); | 186 LOG(INFO) << "Switching to profile path: " << profile_path.value(); |
| 182 } | 187 } |
| 183 | 188 |
| 184 } // namespace chromeos | 189 } // namespace chromeos |
| OLD | NEW |