OLD | NEW |
1 // Copyright (c) 2012 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/profile_startup.h" | 5 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
6 | 6 |
| 7 #include "chrome/browser/browser_process.h" |
7 #include "chrome/browser/chromeos/cros/cros_library.h" | 8 #include "chrome/browser/chromeos/cros/cros_library.h" |
8 #include "chrome/browser/chromeos/cros/network_library.h" | 9 #include "chrome/browser/chromeos/cros/network_library.h" |
9 #include "chrome/browser/chromeos/customization_document.h" | |
10 #include "chrome/browser/chromeos/enterprise_extension_observer.h" | |
11 #include "chrome/browser/chromeos/sms_observer.h" | 10 #include "chrome/browser/chromeos/sms_observer.h" |
12 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
13 #include "chromeos/dbus/dbus_thread_manager.h" | 12 #include "chrome/browser/profiles/profile_destroyer.h" |
| 13 #include "chrome/browser/profiles/profile_manager.h" |
| 14 #include "chrome/common/chrome_constants.h" |
| 15 |
14 | 16 |
15 namespace chromeos { | 17 namespace chromeos { |
16 | 18 |
17 // TODO(beng): It is very fishy that any of these services need to be tied to | 19 // static |
18 // a browser profile. This dependency should be severed and this | 20 Profile* ProfileHelper::GetSigninProfile() { |
19 // init moved earlier in startup. | 21 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
20 void ProfileStartup(Profile* profile, bool process_startup) { | 22 base::FilePath user_data_dir = profile_manager->user_data_dir(); |
| 23 base::FilePath signin_profile_dir = |
| 24 user_data_dir.AppendASCII(chrome::kInitialProfile); |
| 25 return profile_manager->GetProfile(signin_profile_dir)-> |
| 26 GetOffTheRecordProfile(); |
| 27 } |
| 28 |
| 29 // static |
| 30 void ProfileHelper::ProfileStartup(Profile* profile, bool process_startup) { |
21 // Initialize Chrome OS preferences like touch pad sensitivity. For the | 31 // Initialize Chrome OS preferences like touch pad sensitivity. For the |
22 // preferences to work in the guest mode, the initialization has to be | 32 // preferences to work in the guest mode, the initialization has to be |
23 // done after |profile| is switched to the incognito profile (which | 33 // done after |profile| is switched to the incognito profile (which |
24 // is actually GuestSessionProfile in the guest mode). See the | 34 // is actually GuestSessionProfile in the guest mode). See the |
25 // GetOffTheRecordProfile() call above. | 35 // GetOffTheRecordProfile() call above. |
26 profile->InitChromeOSPreferences(); | 36 profile->InitChromeOSPreferences(); |
27 | 37 |
28 if (process_startup) { | 38 if (process_startup) { |
29 static chromeos::SmsObserver* sms_observer = | 39 static chromeos::SmsObserver* sms_observer = |
30 new chromeos::SmsObserver(profile); | 40 new chromeos::SmsObserver(); |
31 chromeos::CrosLibrary::Get()->GetNetworkLibrary()-> | 41 chromeos::CrosLibrary::Get()->GetNetworkLibrary()-> |
32 AddNetworkManagerObserver(sms_observer); | 42 AddNetworkManagerObserver(sms_observer); |
33 | 43 |
34 profile->SetupChromeOSEnterpriseExtensionObserver(); | 44 profile->SetupChromeOSEnterpriseExtensionObserver(); |
35 } | 45 } |
36 } | 46 } |
37 | 47 |
38 } // namespace chromeos | 48 } // namespace chromeos |
OLD | NEW |