OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/profile.h" | 5 #include "chrome/browser/profile.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 #include "chrome/common/pref_names.h" | 50 #include "chrome/common/pref_names.h" |
51 #include "chrome/common/render_messages.h" | 51 #include "chrome/common/render_messages.h" |
52 #include "grit/locale_settings.h" | 52 #include "grit/locale_settings.h" |
53 #include "net/base/strict_transport_security_state.h" | 53 #include "net/base/strict_transport_security_state.h" |
54 | 54 |
55 #if defined(OS_LINUX) | 55 #if defined(OS_LINUX) |
56 #include "net/ocsp/nss_ocsp.h" | 56 #include "net/ocsp/nss_ocsp.h" |
57 #include "chrome/browser/gtk/gtk_theme_provider.h" | 57 #include "chrome/browser/gtk/gtk_theme_provider.h" |
58 #endif | 58 #endif |
59 | 59 |
| 60 #if defined(OS_CHROMEOS) |
| 61 #include "chrome/browser/chromeos/touchpad.h" |
| 62 #endif |
| 63 |
60 using base::Time; | 64 using base::Time; |
61 using base::TimeDelta; | 65 using base::TimeDelta; |
62 | 66 |
63 namespace { | 67 namespace { |
64 | 68 |
65 // Delay, in milliseconds, before we explicitly create the SessionService. | 69 // Delay, in milliseconds, before we explicitly create the SessionService. |
66 static const int kCreateSessionServiceDelayMS = 500; | 70 static const int kCreateSessionServiceDelayMS = 500; |
67 | 71 |
68 enum ContextType { | 72 enum ContextType { |
69 kNormalContext, | 73 kNormalContext, |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 // Listen for theme installation. | 593 // Listen for theme installation. |
590 registrar_.Add(this, NotificationType::THEME_INSTALLED, | 594 registrar_.Add(this, NotificationType::THEME_INSTALLED, |
591 NotificationService::AllSources()); | 595 NotificationService::AllSources()); |
592 | 596 |
593 // Listen for bookmark model load, to bootstrap the sync service. | 597 // Listen for bookmark model load, to bootstrap the sync service. |
594 registrar_.Add(this, NotificationType::BOOKMARK_MODEL_LOADED, | 598 registrar_.Add(this, NotificationType::BOOKMARK_MODEL_LOADED, |
595 Source<Profile>(this)); | 599 Source<Profile>(this)); |
596 | 600 |
597 ssl_config_service_manager_.reset( | 601 ssl_config_service_manager_.reset( |
598 SSLConfigServiceManager::CreateDefaultManager(this)); | 602 SSLConfigServiceManager::CreateDefaultManager(this)); |
| 603 |
| 604 #if defined(OS_CHROMEOS) |
| 605 touchpad_.Init(prefs); |
| 606 #endif |
599 } | 607 } |
600 | 608 |
601 void ProfileImpl::InitExtensions() { | 609 void ProfileImpl::InitExtensions() { |
602 if (user_script_master_ || extensions_service_) | 610 if (user_script_master_ || extensions_service_) |
603 return; // Already initialized. | 611 return; // Already initialized. |
604 | 612 |
605 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 613 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
606 PrefService* prefs = GetPrefs(); | 614 PrefService* prefs = GetPrefs(); |
607 bool user_scripts_enabled = | 615 bool user_scripts_enabled = |
608 command_line->HasSwitch(switches::kEnableUserScripts) || | 616 command_line->HasSwitch(switches::kEnableUserScripts) || |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 | 848 |
841 PrefService* ProfileImpl::GetPrefs() { | 849 PrefService* ProfileImpl::GetPrefs() { |
842 if (!prefs_.get()) { | 850 if (!prefs_.get()) { |
843 prefs_.reset(new PrefService(GetPrefFilePath(), | 851 prefs_.reset(new PrefService(GetPrefFilePath(), |
844 g_browser_process->file_thread())); | 852 g_browser_process->file_thread())); |
845 | 853 |
846 // The Profile class and ProfileManager class may read some prefs so | 854 // The Profile class and ProfileManager class may read some prefs so |
847 // register known prefs as soon as possible. | 855 // register known prefs as soon as possible. |
848 Profile::RegisterUserPrefs(prefs_.get()); | 856 Profile::RegisterUserPrefs(prefs_.get()); |
849 ProfileManager::RegisterUserPrefs(prefs_.get()); | 857 ProfileManager::RegisterUserPrefs(prefs_.get()); |
| 858 #if defined(OS_CHROMEOS) |
| 859 // Register Touchpad prefs here instead of in browser_prefs because these |
| 860 // prefs are used in the constructor of ProfileImpl which happens before |
| 861 // browser_prefs' RegisterAllPrefs is called. |
| 862 Touchpad::RegisterUserPrefs(prefs_.get()); |
| 863 #endif |
850 | 864 |
851 // The last session exited cleanly if there is no pref for | 865 // The last session exited cleanly if there is no pref for |
852 // kSessionExitedCleanly or the value for kSessionExitedCleanly is true. | 866 // kSessionExitedCleanly or the value for kSessionExitedCleanly is true. |
853 last_session_exited_cleanly_ = | 867 last_session_exited_cleanly_ = |
854 prefs_->GetBoolean(prefs::kSessionExitedCleanly); | 868 prefs_->GetBoolean(prefs::kSessionExitedCleanly); |
855 // Mark the session as open. | 869 // Mark the session as open. |
856 prefs_->SetBoolean(prefs::kSessionExitedCleanly, false); | 870 prefs_->SetBoolean(prefs::kSessionExitedCleanly, false); |
857 // Make sure we save to disk that the session has opened. | 871 // Make sure we save to disk that the session has opened. |
858 prefs_->ScheduleSavePersistentPrefs(); | 872 prefs_->ScheduleSavePersistentPrefs(); |
859 } | 873 } |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1321 #endif | 1335 #endif |
1322 return NULL; | 1336 return NULL; |
1323 } | 1337 } |
1324 | 1338 |
1325 void ProfileImpl::InitSyncService() { | 1339 void ProfileImpl::InitSyncService() { |
1326 #ifdef CHROME_PERSONALIZATION | 1340 #ifdef CHROME_PERSONALIZATION |
1327 sync_service_.reset(new ProfileSyncService(this)); | 1341 sync_service_.reset(new ProfileSyncService(this)); |
1328 sync_service_->Initialize(); | 1342 sync_service_->Initialize(); |
1329 #endif | 1343 #endif |
1330 } | 1344 } |
OLD | NEW |