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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 base::FilePath ProfileHelper::GetUserProfileDir( | 134 base::FilePath ProfileHelper::GetUserProfileDir( |
135 const std::string& user_id_hash) { | 135 const std::string& user_id_hash) { |
136 CHECK(!user_id_hash.empty()); | 136 CHECK(!user_id_hash.empty()); |
137 return ShouldAddProfileDirPrefix(user_id_hash) | 137 return ShouldAddProfileDirPrefix(user_id_hash) |
138 ? base::FilePath(chrome::kProfileDirPrefix + user_id_hash) | 138 ? base::FilePath(chrome::kProfileDirPrefix + user_id_hash) |
139 : base::FilePath(user_id_hash); | 139 : base::FilePath(user_id_hash); |
140 } | 140 } |
141 | 141 |
142 // static | 142 // static |
143 bool ProfileHelper::IsSigninProfile(Profile* profile) { | 143 bool ProfileHelper::IsSigninProfile(Profile* profile) { |
144 return profile->GetPath().BaseName().value() == chrome::kInitialProfile; | 144 return profile && |
| 145 profile->GetPath().BaseName().value() == chrome::kInitialProfile; |
145 } | 146 } |
146 | 147 |
147 // static | 148 // static |
148 bool ProfileHelper::IsOwnerProfile(Profile* profile) { | 149 bool ProfileHelper::IsOwnerProfile(Profile* profile) { |
149 if (!profile) | 150 if (!profile) |
150 return false; | 151 return false; |
151 user_manager::User* user = ProfileHelper::Get()->GetUserByProfile(profile); | 152 user_manager::User* user = ProfileHelper::Get()->GetUserByProfile(profile); |
152 if (!user) | 153 if (!user) |
153 return false; | 154 return false; |
154 | 155 |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 user_to_profile_for_testing_[user] = profile; | 377 user_to_profile_for_testing_[user] = profile; |
377 } | 378 } |
378 | 379 |
379 // static | 380 // static |
380 std::string ProfileHelper::GetUserIdHashByUserIdForTesting( | 381 std::string ProfileHelper::GetUserIdHashByUserIdForTesting( |
381 const std::string& user_id) { | 382 const std::string& user_id) { |
382 return user_id + kUserIdHashSuffix; | 383 return user_id + kUserIdHashSuffix; |
383 } | 384 } |
384 | 385 |
385 } // namespace chromeos | 386 } // namespace chromeos |
OLD | NEW |