| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 std::string prefix(chrome::kProfileDirPrefix); | 81 std::string prefix(chrome::kProfileDirPrefix); |
| 82 if (profile_dir.find(prefix) != 0) { | 82 if (profile_dir.find(prefix) != 0) { |
| 83 NOTREACHED(); | 83 NOTREACHED(); |
| 84 return std::string(); | 84 return std::string(); |
| 85 } | 85 } |
| 86 | 86 |
| 87 return profile_dir.substr(prefix.length(), | 87 return profile_dir.substr(prefix.length(), |
| 88 profile_dir.length() - prefix.length()); | 88 profile_dir.length() - prefix.length()); |
| 89 } | 89 } |
| 90 | 90 |
| 91 // static | |
| 92 bool ProfileHelper::IsSigninProfile(Profile* profile) { | |
| 93 return profile->GetPath().BaseName().value() == chrome::kInitialProfile; | |
| 94 } | |
| 95 | |
| 96 void ProfileHelper::ProfileStartup(Profile* profile, bool process_startup) { | 91 void ProfileHelper::ProfileStartup(Profile* profile, bool process_startup) { |
| 97 // Initialize Chrome OS preferences like touch pad sensitivity. For the | 92 // Initialize Chrome OS preferences like touch pad sensitivity. For the |
| 98 // preferences to work in the guest mode, the initialization has to be | 93 // preferences to work in the guest mode, the initialization has to be |
| 99 // done after |profile| is switched to the incognito profile (which | 94 // done after |profile| is switched to the incognito profile (which |
| 100 // is actually GuestSessionProfile in the guest mode). See the | 95 // is actually GuestSessionProfile in the guest mode). See the |
| 101 // GetOffTheRecordProfile() call above. | 96 // GetOffTheRecordProfile() call above. |
| 102 profile->InitChromeOSPreferences(); | 97 profile->InitChromeOSPreferences(); |
| 103 | 98 |
| 104 // Add observer so we can see when the first profile's session restore is | 99 // Add observer so we can see when the first profile's session restore is |
| 105 // completed. After that, we won't need the default profile anymore. | 100 // completed. After that, we won't need the default profile anymore. |
| 106 if (!IsSigninProfile(profile) && | 101 if (!profile->IsLoginProfile() && |
| 107 UserManager::Get()->IsLoggedInAsRegularUser() && | 102 UserManager::Get()->IsLoggedInAsRegularUser() && |
| 108 !UserManager::Get()->IsLoggedInAsStub()) { | 103 !UserManager::Get()->IsLoggedInAsStub()) { |
| 109 chromeos::OAuth2LoginManager* login_manager = | 104 chromeos::OAuth2LoginManager* login_manager = |
| 110 chromeos::OAuth2LoginManagerFactory::GetInstance()->GetForProfile( | 105 chromeos::OAuth2LoginManagerFactory::GetInstance()->GetForProfile( |
| 111 profile); | 106 profile); |
| 112 if (login_manager) | 107 if (login_manager) |
| 113 login_manager->AddObserver(this); | 108 login_manager->AddObserver(this); |
| 114 } | 109 } |
| 115 } | 110 } |
| 116 | 111 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 //////////////////////////////////////////////////////////////////////////////// | 173 //////////////////////////////////////////////////////////////////////////////// |
| 179 // ProfileHelper, UserManager::UserSessionStateObserver implementation: | 174 // ProfileHelper, UserManager::UserSessionStateObserver implementation: |
| 180 | 175 |
| 181 void ProfileHelper::ActiveUserHashChanged(const std::string& hash) { | 176 void ProfileHelper::ActiveUserHashChanged(const std::string& hash) { |
| 182 active_user_id_hash_ = hash; | 177 active_user_id_hash_ = hash; |
| 183 base::FilePath profile_path = GetProfilePathByUserIdHash(hash); | 178 base::FilePath profile_path = GetProfilePathByUserIdHash(hash); |
| 184 LOG(INFO) << "Switching to profile path: " << profile_path.value(); | 179 LOG(INFO) << "Switching to profile path: " << profile_path.value(); |
| 185 } | 180 } |
| 186 | 181 |
| 187 } // namespace chromeos | 182 } // namespace chromeos |
| OLD | NEW |