| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/profiles/profile.h" | 5 #include "chrome/browser/profiles/profile.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| 11 #include "chrome/browser/first_run/first_run.h" | 11 #include "chrome/browser/first_run/first_run.h" |
| 12 #include "chrome/browser/profiles/profile_manager.h" | 12 #include "chrome/browser/profiles/profile_manager.h" |
| 13 #include "chrome/browser/sync/profile_sync_service_factory.h" | 13 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 14 #include "chrome/common/features.h" | 14 #include "chrome/common/features.h" |
| 15 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
| 16 #include "components/browser_sync/profile_sync_service.h" | 16 #include "components/browser_sync/profile_sync_service.h" |
| 17 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref
s.h" | 17 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref
s.h" |
| 18 #include "components/pref_registry/pref_registry_syncable.h" | 18 #include "components/pref_registry/pref_registry_syncable.h" |
| 19 #include "components/prefs/pref_service.h" | 19 #include "components/prefs/pref_service.h" |
| 20 #include "components/safe_browsing/common/safe_browsing_prefs.h" | 20 #include "components/safe_browsing/common/safe_browsing_prefs.h" |
| 21 #include "components/sync/base/sync_prefs.h" | 21 #include "components/sync/base/sync_prefs.h" |
| 22 #include "content/public/browser/host_zoom_map.h" | |
| 23 #include "content/public/browser/notification_service.h" | 22 #include "content/public/browser/notification_service.h" |
| 24 #include "content/public/browser/notification_source.h" | 23 #include "content/public/browser/notification_source.h" |
| 25 #include "content/public/browser/storage_partition.h" | 24 #include "content/public/browser/storage_partition.h" |
| 26 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
| 27 #include "content/public/browser/web_ui.h" | 26 #include "content/public/browser/web_ui.h" |
| 28 #include "extensions/features/features.h" | 27 #include "extensions/features/features.h" |
| 29 | 28 |
| 30 #if defined(OS_CHROMEOS) | 29 #if defined(OS_CHROMEOS) |
| 31 #include "base/command_line.h" | 30 #include "base/command_line.h" |
| 32 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
| 33 #include "chromeos/chromeos_switches.h" | 32 #include "chromeos/chromeos_switches.h" |
| 34 #endif | 33 #endif |
| 35 | 34 |
| 35 #if !defined(OS_ANDROID) |
| 36 #include "content/public/browser/host_zoom_map.h" |
| 37 #endif |
| 38 |
| 36 #if BUILDFLAG(ENABLE_EXTENSIONS) | 39 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 37 #include "extensions/browser/pref_names.h" | 40 #include "extensions/browser/pref_names.h" |
| 38 #endif | 41 #endif |
| 39 | 42 |
| 40 Profile::Profile() | 43 Profile::Profile() |
| 41 : restored_last_session_(false), | 44 : restored_last_session_(false), |
| 42 sent_destroyed_notification_(false), | 45 sent_destroyed_notification_(false), |
| 43 accessibility_pause_level_(0), | 46 accessibility_pause_level_(0), |
| 44 is_guest_profile_(false), | 47 is_guest_profile_(false), |
| 45 is_system_profile_(false) { | 48 is_system_profile_(false) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 56 | 59 |
| 57 // static | 60 // static |
| 58 Profile* Profile::FromWebUI(content::WebUI* web_ui) { | 61 Profile* Profile::FromWebUI(content::WebUI* web_ui) { |
| 59 return FromBrowserContext(web_ui->GetWebContents()->GetBrowserContext()); | 62 return FromBrowserContext(web_ui->GetWebContents()->GetBrowserContext()); |
| 60 } | 63 } |
| 61 | 64 |
| 62 TestingProfile* Profile::AsTestingProfile() { | 65 TestingProfile* Profile::AsTestingProfile() { |
| 63 return NULL; | 66 return NULL; |
| 64 } | 67 } |
| 65 | 68 |
| 69 #if !defined(OS_ANDROID) |
| 66 ChromeZoomLevelPrefs* Profile::GetZoomLevelPrefs() { | 70 ChromeZoomLevelPrefs* Profile::GetZoomLevelPrefs() { |
| 67 return NULL; | 71 return NULL; |
| 68 } | 72 } |
| 73 #endif // !defined(OS_ANDROID) |
| 69 | 74 |
| 70 Profile::Delegate::~Delegate() { | 75 Profile::Delegate::~Delegate() { |
| 71 } | 76 } |
| 72 | 77 |
| 73 // static | 78 // static |
| 74 const char Profile::kProfileKey[] = "__PROFILE__"; | 79 const char Profile::kProfileKey[] = "__PROFILE__"; |
| 75 // This must be a string which can never be a valid domain. | 80 // This must be a string which can never be a valid domain. |
| 76 const char Profile::kNoHostedDomainFound[] = "NO_HOSTED_DOMAIN"; | 81 const char Profile::kNoHostedDomainFound[] = "NO_HOSTED_DOMAIN"; |
| 77 | 82 |
| 78 // static | 83 // static |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 // This pref is intentionally outside the above #if. That flag corresponds | 118 // This pref is intentionally outside the above #if. That flag corresponds |
| 114 // to the Notifier extension and does not gate the launcher page. | 119 // to the Notifier extension and does not gate the launcher page. |
| 115 // TODO(skare): Remove or rename ENABLE_GOOGLE_NOW: http://crbug.com/459827. | 120 // TODO(skare): Remove or rename ENABLE_GOOGLE_NOW: http://crbug.com/459827. |
| 116 registry->RegisterBooleanPref(prefs::kGoogleNowLauncherEnabled, true); | 121 registry->RegisterBooleanPref(prefs::kGoogleNowLauncherEnabled, true); |
| 117 registry->RegisterBooleanPref(prefs::kDisableExtensions, false); | 122 registry->RegisterBooleanPref(prefs::kDisableExtensions, false); |
| 118 #if BUILDFLAG(ENABLE_EXTENSIONS) | 123 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 119 registry->RegisterBooleanPref(extensions::pref_names::kAlertsInitialized, | 124 registry->RegisterBooleanPref(extensions::pref_names::kAlertsInitialized, |
| 120 false); | 125 false); |
| 121 #endif | 126 #endif |
| 122 registry->RegisterStringPref(prefs::kSelectFileLastDirectory, std::string()); | 127 registry->RegisterStringPref(prefs::kSelectFileLastDirectory, std::string()); |
| 128 #if !defined(OS_ANDROID) |
| 123 registry->RegisterDictionaryPref(prefs::kPartitionDefaultZoomLevel); | 129 registry->RegisterDictionaryPref(prefs::kPartitionDefaultZoomLevel); |
| 124 registry->RegisterDictionaryPref(prefs::kPartitionPerHostZoomLevels); | 130 registry->RegisterDictionaryPref(prefs::kPartitionPerHostZoomLevels); |
| 131 #endif // !defined(OS_ANDROID) |
| 125 registry->RegisterStringPref(prefs::kDefaultApps, "install"); | 132 registry->RegisterStringPref(prefs::kDefaultApps, "install"); |
| 126 registry->RegisterBooleanPref(prefs::kSpeechRecognitionFilterProfanities, | 133 registry->RegisterBooleanPref(prefs::kSpeechRecognitionFilterProfanities, |
| 127 true); | 134 true); |
| 128 registry->RegisterIntegerPref(prefs::kProfileIconVersion, 0); | 135 registry->RegisterIntegerPref(prefs::kProfileIconVersion, 0); |
| 129 registry->RegisterBooleanPref(prefs::kAllowDinosaurEasterEgg, true); | 136 registry->RegisterBooleanPref(prefs::kAllowDinosaurEasterEgg, true); |
| 130 #if defined(OS_CHROMEOS) | 137 #if defined(OS_CHROMEOS) |
| 131 // TODO(dilmah): For OS_CHROMEOS we maintain kApplicationLocale in both | 138 // TODO(dilmah): For OS_CHROMEOS we maintain kApplicationLocale in both |
| 132 // local state and user's profile. For other platforms we maintain | 139 // local state and user's profile. For other platforms we maintain |
| 133 // kApplicationLocale only in local state. | 140 // kApplicationLocale only in local state. |
| 134 // In the future we may want to maintain kApplicationLocale | 141 // In the future we may want to maintain kApplicationLocale |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 } | 246 } |
| 240 } | 247 } |
| 241 | 248 |
| 242 bool ProfileCompare::operator()(Profile* a, Profile* b) const { | 249 bool ProfileCompare::operator()(Profile* a, Profile* b) const { |
| 243 DCHECK(a && b); | 250 DCHECK(a && b); |
| 244 if (a->IsSameProfile(b)) | 251 if (a->IsSameProfile(b)) |
| 245 return false; | 252 return false; |
| 246 return a->GetOriginalProfile() < b->GetOriginalProfile(); | 253 return a->GetOriginalProfile() < b->GetOriginalProfile(); |
| 247 } | 254 } |
| 248 | 255 |
| 256 #if !defined(OS_ANDROID) |
| 249 double Profile::GetDefaultZoomLevelForProfile() { | 257 double Profile::GetDefaultZoomLevelForProfile() { |
| 250 return GetDefaultStoragePartition(this) | 258 return GetDefaultStoragePartition(this) |
| 251 ->GetHostZoomMap() | 259 ->GetHostZoomMap() |
| 252 ->GetDefaultZoomLevel(); | 260 ->GetDefaultZoomLevel(); |
| 253 } | 261 } |
| 262 #endif // !defined(OS_ANDROID) |
| OLD | NEW |