Chromium Code Reviews| 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" |
| 11 #include "chrome/browser/chromeos/login/oauth2_login_manager_factory.h" | 11 #include "chrome/browser/chromeos/login/oauth2_login_manager_factory.h" |
| 12 #include "chrome/browser/chromeos/login/user.h" | |
| 12 #include "chrome/browser/chromeos/login/user_manager.h" | 13 #include "chrome/browser/chromeos/login/user_manager.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/profiles/profile_manager.h" | 15 #include "chrome/browser/profiles/profile_manager.h" |
| 15 #include "chrome/common/chrome_constants.h" | 16 #include "chrome/common/chrome_constants.h" |
| 16 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
| 17 #include "chromeos/chromeos_switches.h" | 18 #include "chromeos/chromeos_switches.h" |
| 18 | 19 |
| 19 namespace chromeos { | 20 namespace chromeos { |
| 20 | 21 |
| 21 namespace { | 22 namespace { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 const std::string& user_id_hash) { | 109 const std::string& user_id_hash) { |
| 109 DCHECK(!user_id_hash.empty()); | 110 DCHECK(!user_id_hash.empty()); |
| 110 return base::FilePath(chrome::kProfileDirPrefix + user_id_hash); | 111 return base::FilePath(chrome::kProfileDirPrefix + user_id_hash); |
| 111 } | 112 } |
| 112 | 113 |
| 113 // static | 114 // static |
| 114 bool ProfileHelper::IsSigninProfile(Profile* profile) { | 115 bool ProfileHelper::IsSigninProfile(Profile* profile) { |
| 115 return profile->GetPath().BaseName().value() == chrome::kInitialProfile; | 116 return profile->GetPath().BaseName().value() == chrome::kInitialProfile; |
| 116 } | 117 } |
| 117 | 118 |
| 119 // static | |
| 120 bool ProfileHelper::IsProfileOwner(Profile* profile) { | |
| 121 chromeos::UserManager* mgr = chromeos::UserManager::Get(); | |
| 122 chromeos::User* usr = mgr->GetUserByProfile(profile); | |
| 123 return usr->email() == mgr->GetOwnerEmail(); | |
|
dzhioev (left Google)
2014/01/23 13:25:08
Please use words instead of abbreviations.
ygorshenin1
2014/01/27 09:13:14
Done.
| |
| 124 } | |
| 125 | |
| 118 void ProfileHelper::ProfileStartup(Profile* profile, bool process_startup) { | 126 void ProfileHelper::ProfileStartup(Profile* profile, bool process_startup) { |
| 119 // Initialize Chrome OS preferences like touch pad sensitivity. For the | 127 // Initialize Chrome OS preferences like touch pad sensitivity. For the |
| 120 // preferences to work in the guest mode, the initialization has to be | 128 // preferences to work in the guest mode, the initialization has to be |
| 121 // done after |profile| is switched to the incognito profile (which | 129 // done after |profile| is switched to the incognito profile (which |
| 122 // is actually GuestSessionProfile in the guest mode). See the | 130 // is actually GuestSessionProfile in the guest mode). See the |
| 123 // GetOffTheRecordProfile() call above. | 131 // GetOffTheRecordProfile() call above. |
| 124 profile->InitChromeOSPreferences(); | 132 profile->InitChromeOSPreferences(); |
| 125 | 133 |
| 126 // Add observer so we can see when the first profile's session restore is | 134 // Add observer so we can see when the first profile's session restore is |
| 127 // completed. After that, we won't need the default profile anymore. | 135 // completed. After that, we won't need the default profile anymore. |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 194 //////////////////////////////////////////////////////////////////////////////// | 202 //////////////////////////////////////////////////////////////////////////////// |
| 195 // ProfileHelper, UserManager::UserSessionStateObserver implementation: | 203 // ProfileHelper, UserManager::UserSessionStateObserver implementation: |
| 196 | 204 |
| 197 void ProfileHelper::ActiveUserHashChanged(const std::string& hash) { | 205 void ProfileHelper::ActiveUserHashChanged(const std::string& hash) { |
| 198 active_user_id_hash_ = hash; | 206 active_user_id_hash_ = hash; |
| 199 base::FilePath profile_path = GetProfilePathByUserIdHash(hash); | 207 base::FilePath profile_path = GetProfilePathByUserIdHash(hash); |
| 200 LOG(WARNING) << "Switching to profile path: " << profile_path.value(); | 208 LOG(WARNING) << "Switching to profile path: " << profile_path.value(); |
| 201 } | 209 } |
| 202 | 210 |
| 203 } // namespace chromeos | 211 } // namespace chromeos |
| OLD | NEW |