| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 base::FilePath ProfileHelper::GetUserProfileDir( | 112 base::FilePath ProfileHelper::GetUserProfileDir( |
| 113 const std::string& user_id_hash) { | 113 const std::string& user_id_hash) { |
| 114 DCHECK(!user_id_hash.empty()); | 114 DCHECK(!user_id_hash.empty()); |
| 115 return ShouldAddProfileDirPrefix(user_id_hash) | 115 return ShouldAddProfileDirPrefix(user_id_hash) |
| 116 ? base::FilePath(chrome::kProfileDirPrefix + user_id_hash) | 116 ? base::FilePath(chrome::kProfileDirPrefix + user_id_hash) |
| 117 : base::FilePath(user_id_hash); | 117 : base::FilePath(user_id_hash); |
| 118 } | 118 } |
| 119 | 119 |
| 120 // static | 120 // static |
| 121 bool ProfileHelper::IsSigninProfile(Profile* profile) { | 121 bool ProfileHelper::IsSigninProfile(Profile* profile) { |
| 122 return profile->GetPath().BaseName().value() == chrome::kInitialProfile; | 122 return profile && |
| 123 profile->GetPath().BaseName().value() == chrome::kInitialProfile; |
| 123 } | 124 } |
| 124 | 125 |
| 125 // static | 126 // static |
| 126 bool ProfileHelper::IsOwnerProfile(Profile* profile) { | 127 bool ProfileHelper::IsOwnerProfile(Profile* profile) { |
| 127 if (!profile) | 128 if (!profile) |
| 128 return false; | 129 return false; |
| 129 chromeos::UserManager* manager = chromeos::UserManager::Get(); | 130 chromeos::UserManager* manager = chromeos::UserManager::Get(); |
| 130 chromeos::User* user = manager->GetUserByProfile(profile); | 131 chromeos::User* user = manager->GetUserByProfile(profile); |
| 131 if (!user) | 132 if (!user) |
| 132 return false; | 133 return false; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 //////////////////////////////////////////////////////////////////////////////// | 213 //////////////////////////////////////////////////////////////////////////////// |
| 213 // ProfileHelper, UserManager::UserSessionStateObserver implementation: | 214 // ProfileHelper, UserManager::UserSessionStateObserver implementation: |
| 214 | 215 |
| 215 void ProfileHelper::ActiveUserHashChanged(const std::string& hash) { | 216 void ProfileHelper::ActiveUserHashChanged(const std::string& hash) { |
| 216 active_user_id_hash_ = hash; | 217 active_user_id_hash_ = hash; |
| 217 base::FilePath profile_path = GetProfilePathByUserIdHash(hash); | 218 base::FilePath profile_path = GetProfilePathByUserIdHash(hash); |
| 218 VLOG(1) << "Switching to profile path: " << profile_path.value(); | 219 VLOG(1) << "Switching to profile path: " << profile_path.value(); |
| 219 } | 220 } |
| 220 | 221 |
| 221 } // namespace chromeos | 222 } // namespace chromeos |
| OLD | NEW |