#include "base/compiler_specific.h"
#include "base/debug/trace_event.h"
#include "base/environment.h"
-#include "base/file_util.h"
#include "base/files/file_path.h"
+#include "base/files/file_util.h"
#include "base/memory/scoped_ptr.h"
#include "base/path_service.h"
#include "base/prefs/json_pref_store.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/content_settings/cookie_settings.h"
#include "chrome/browser/content_settings/host_content_settings_map.h"
-#include "chrome/browser/dom_distiller/dom_distiller_service_factory.h"
-#include "chrome/browser/dom_distiller/lazy_dom_distiller_service.h"
+#include "chrome/browser/dom_distiller/profile_utils.h"
+#include "chrome/browser/domain_reliability/service_factory.h"
#include "chrome/browser/download/chrome_download_manager_delegate.h"
#include "chrome/browser/download/download_service.h"
#include "chrome/browser/download/download_service_factory.h"
-#include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/extensions/extension_special_storage_policy.h"
#include "chrome/browser/history/top_sites.h"
-#include "chrome/browser/net/chrome_url_request_context.h"
#include "chrome/browser/net/net_pref_observer.h"
#include "chrome/browser/net/predictor.h"
#include "chrome/browser/net/pref_proxy_config_tracker.h"
#include "chrome/browser/net/proxy_service_factory.h"
+#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.h"
+#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
+#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_factory.h"
#include "chrome/browser/net/ssl_config_service_manager.h"
#include "chrome/browser/plugins/chrome_plugin_service_filter.h"
#include "chrome/browser/plugins/plugin_prefs.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/profile_metrics.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
-#include "chrome/browser/search_engines/template_url_fetcher.h"
#include "chrome/browser/services/gcm/gcm_profile_service.h"
#include "chrome/browser/services/gcm/gcm_profile_service_factory.h"
#include "chrome/browser/services/gcm/push_messaging_service_impl.h"
#include "chrome/browser/sessions/session_service_factory.h"
+#include "chrome/browser/signin/signin_ui_util.h"
+#include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h"
+#include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h"
#include "chrome/browser/ui/startup/startup_browser_creator.h"
-#include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
-#include "chrome/browser/webdata/web_data_service.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths_internal.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version_info.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
+#include "chrome/grit/chromium_strings.h"
#include "components/bookmarks/browser/bookmark_model.h"
-#include "components/dom_distiller/content/dom_distiller_viewer_source.h"
+#include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h"
+#include "components/data_reduction_proxy/browser/data_reduction_proxy_settings.h"
+#include "components/data_reduction_proxy/browser/data_reduction_proxy_statistics_prefs.h"
+#include "components/domain_reliability/monitor.h"
+#include "components/domain_reliability/service.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "components/metrics/metrics_service.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "content/public/browser/user_metrics.h"
#include "content/public/common/content_constants.h"
#include "content/public/common/page_zoom.h"
-#include "extensions/browser/extension_pref_store.h"
-#include "extensions/browser/extension_pref_value_map.h"
-#include "extensions/browser/extension_pref_value_map_factory.h"
-#include "extensions/browser/extension_system.h"
-#include "grit/chromium_strings.h"
-#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
#if defined(OS_ANDROID)
#include "chrome/browser/media/protected_media_identifier_permission_context.h"
#include "chrome/browser/media/protected_media_identifier_permission_context_factory.h"
-#if defined(FULL_SAFE_BROWSING)
-#include "chrome/browser/safe_browsing/safe_browsing_service.h"
-#endif
#endif
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/locale_change_guard.h"
-#include "chrome/browser/chromeos/login/users/user_manager.h"
#include "chrome/browser/chromeos/preferences.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
+#include "components/user_manager/user_manager.h"
#endif
#if defined(ENABLE_CONFIGURATION_POLICY)
#include "chrome/browser/policy/schema_registry_service_factory.h"
#include "components/policy/core/browser/browser_policy_connector.h"
#if defined(OS_CHROMEOS)
+#include "chrome/browser/chromeos/login/login_utils.h"
#include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h"
#include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chromeos.h"
#else
#endif
#if defined(ENABLE_EXTENSIONS)
-#include "chrome/browser/guest_view/guest_view_manager.h"
+#include "chrome/browser/extensions/extension_service.h"
+#include "chrome/browser/extensions/extension_special_storage_policy.h"
+#include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
+#include "extensions/browser/extension_pref_store.h"
+#include "extensions/browser/extension_pref_value_map.h"
+#include "extensions/browser/extension_pref_value_map_factory.h"
+#include "extensions/browser/extension_system.h"
+#include "extensions/browser/guest_view/guest_view_manager.h"
#endif
#if defined(ENABLE_MANAGED_USERS)
#if defined(ENABLE_SESSION_SERVICE)
// Delay, in milliseconds, before we explicitly create the SessionService.
-static const int kCreateSessionServiceDelayMS = 500;
+const int kCreateSessionServiceDelayMS = 500;
#endif
// Text content of README file created in each profile directory. Both %s
// placeholders must contain the product name. This is not localizable and hence
// not in resources.
-static const char kReadmeText[] =
+const char kReadmeText[] =
"%s settings and storage represent user-selected preferences and "
"information and MUST not be extracted, overwritten or modified except "
"through %s defined APIs.";
// Value written to prefs for EXIT_CRASHED and EXIT_SESSION_ENDED.
-const char* const kPrefExitTypeCrashed = "Crashed";
-const char* const kPrefExitTypeSessionEnded = "SessionEnded";
+const char kPrefExitTypeCrashed[] = "Crashed";
+const char kPrefExitTypeSessionEnded[] = "SessionEnded";
// Helper method needed because PostTask cannot currently take a Callback
// function with non-void return type.
return std::string();
}
-// Setup URLDataSource for the chrome-distiller:// scheme for the given
-// |profile|.
-void RegisterDomDistillerViewerSource(Profile* profile) {
- const CommandLine& command_line = *CommandLine::ForCurrentProcess();
- if (command_line.HasSwitch(switches::kEnableDomDistiller)) {
- dom_distiller::DomDistillerServiceFactory* dom_distiller_service_factory =
- dom_distiller::DomDistillerServiceFactory::GetInstance();
- // The LazyDomDistillerService deletes itself when the profile is destroyed.
- dom_distiller::LazyDomDistillerService* lazy_service =
- new dom_distiller::LazyDomDistillerService(
- profile, dom_distiller_service_factory);
- content::URLDataSource::Add(profile,
- new dom_distiller::DomDistillerViewerSource(
- lazy_service, chrome::kDomDistillerScheme));
- }
+PrefStore* CreateExtensionPrefStore(Profile* profile,
+ bool incognito_pref_store) {
+#if defined(ENABLE_EXTENSIONS)
+ return new ExtensionPrefStore(
+ ExtensionPrefValueMapFactory::GetForBrowserContext(profile),
+ incognito_pref_store);
+#else
+ return NULL;
+#endif
}
} // namespace
Profile* Profile::CreateProfile(const base::FilePath& path,
Delegate* delegate,
CreateMode create_mode) {
- TRACE_EVENT0("browser", "Profile::CreateProfile")
+ TRACE_EVENT_BEGIN1("browser",
+ "Profile::CreateProfile",
+ "profile_path",
+ path.value().c_str());
+
// Get sequenced task runner for making sure that file operations of
// this profile (defined by |path|) are executed in expected order
// (what was previously assured by the FILE thread).
prefs::kProfileAvatarIndex,
-1,
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
- registry->RegisterStringPref(prefs::kSupervisedUserId,
- std::string(),
- user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
- registry->RegisterStringPref(prefs::kProfileName,
- std::string(),
- user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
+ // Whether a profile is using an avatar without having explicitely chosen it
+ // (i.e. was assigned by default by legacy profile creation).
registry->RegisterBooleanPref(
- prefs::kProfileIsSupervised,
+ prefs::kProfileUsingDefaultAvatar,
+ true,
+ user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
+ registry->RegisterBooleanPref(
+ prefs::kProfileUsingGAIAAvatar,
false,
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
+ // Whether a profile is using a default avatar name (eg. Pickles or Person 1).
+ registry->RegisterBooleanPref(
+ prefs::kProfileUsingDefaultName,
+ true,
+ user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
+ registry->RegisterStringPref(
+ prefs::kSupervisedUserId,
+ std::string(),
+ user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
+ registry->RegisterStringPref(prefs::kProfileName,
+ std::string(),
+ user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
registry->RegisterStringPref(prefs::kHomePage,
std::string(),
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
const CommandLine* command_line = CommandLine::ForCurrentProcess();
predictor_ = chrome_browser_net::Predictor::CreatePredictor(
!command_line->HasSwitch(switches::kDisablePreconnect),
+ !command_line->HasSwitch(switches::kDnsPrefetchDisable),
g_browser_process->profile_manager() == NULL);
// If we are creating the profile synchronously, then we should load the
scoped_refptr<SafeBrowsingService> safe_browsing_service(
g_browser_process->safe_browsing_service());
- if (safe_browsing_service) {
+ if (safe_browsing_service.get()) {
pref_validation_delegate_ =
safe_browsing_service->CreatePreferenceValidationDelegate(this).Pass();
}
pref_validation_delegate_.get(),
profile_policy_connector_->policy_service(),
supervised_user_settings,
- new ExtensionPrefStore(
- ExtensionPrefValueMapFactory::GetForBrowserContext(this), false),
+ CreateExtensionPrefStore(this, false),
pref_registry_,
async_prefs).Pass();
// Register on BrowserContext.
prefs::kDefaultZoomLevel,
base::Bind(&ProfileImpl::OnDefaultZoomLevelChanged,
base::Unretained(this)));
+
+ // Changes in the profile avatar.
pref_change_registrar_.Add(
prefs::kProfileAvatarIndex,
base::Bind(&ProfileImpl::UpdateProfileAvatarCache,
base::Unretained(this)));
pref_change_registrar_.Add(
+ prefs::kProfileUsingDefaultAvatar,
+ base::Bind(&ProfileImpl::UpdateProfileAvatarCache,
+ base::Unretained(this)));
+ pref_change_registrar_.Add(
+ prefs::kProfileUsingGAIAAvatar,
+ base::Bind(&ProfileImpl::UpdateProfileAvatarCache,
+ base::Unretained(this)));
+
+ // Changes in the profile name.
+ pref_change_registrar_.Add(
+ prefs::kProfileUsingDefaultName,
+ base::Bind(&ProfileImpl::UpdateProfileNameCache,
+ base::Unretained(this)));
+ pref_change_registrar_.Add(
prefs::kProfileName,
base::Bind(&ProfileImpl::UpdateProfileNameCache,
base::Unretained(this)));
+
pref_change_registrar_.Add(
prefs::kForceEphemeralProfiles,
base::Bind(&ProfileImpl::UpdateProfileIsEphemeralCache,
base::FilePath cookie_path = GetPath();
cookie_path = cookie_path.Append(chrome::kCookieFilename);
- base::FilePath server_bound_cert_path = GetPath();
- server_bound_cert_path =
- server_bound_cert_path.Append(chrome::kOBCertFilename);
+ base::FilePath channel_id_path = GetPath();
+ channel_id_path = channel_id_path.Append(chrome::kChannelIDFilename);
base::FilePath cache_path = base_cache_path_;
int cache_max_size;
GetCacheParameters(false, &cache_path, &cache_max_size);
InitHostZoomMap();
+ base::Callback<void(bool)> data_reduction_proxy_unavailable;
+ scoped_ptr<data_reduction_proxy::DataReductionProxyParams>
+ data_reduction_proxy_params;
+ scoped_ptr<DataReductionProxyChromeConfigurator> chrome_configurator;
+ scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs>
+ data_reduction_proxy_statistics_prefs;
+ DataReductionProxyChromeSettings* data_reduction_proxy_chrome_settings =
+ DataReductionProxyChromeSettingsFactory::GetForBrowserContext(this);
+ data_reduction_proxy_params =
+ data_reduction_proxy_chrome_settings->params()->Clone();
+ data_reduction_proxy_unavailable =
+ base::Bind(
+ &data_reduction_proxy::DataReductionProxySettings::SetUnreachable,
+ base::Unretained(data_reduction_proxy_chrome_settings));
+ // The configurator is used by DataReductionProxyChromeSettings and
+ // ProfileIOData. Ownership is passed to the latter via ProfileIOData::Handle,
+ // which is only destroyed after BrowserContextKeyedServices,
+ // including DataReductionProxyChromeSettings.
+ chrome_configurator.reset(
+ new DataReductionProxyChromeConfigurator(
+ prefs_.get(),
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)));
+ // Retain a raw pointer to use for initialization of data reduction proxy
+ // settings after ownership is passed.
+ DataReductionProxyChromeConfigurator*
+ data_reduction_proxy_chrome_configurator = chrome_configurator.get();
+#if defined(OS_ANDROID) || defined(OS_IOS)
+ // On mobile we write data reduction proxy prefs directly to the pref service.
+ // On desktop we store data reduction proxy prefs in memory, writing to disk
+ // every 60 minutes and on termination. Shutdown hooks must be added for
+ // Android and iOS in order for non-zero delays to be supported.
+ // (http://crbug.com/408264)
+ base::TimeDelta commit_delay = base::TimeDelta();
+#else
+ base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60);
+#endif
+ data_reduction_proxy_statistics_prefs =
+ scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs>(
+ new data_reduction_proxy::DataReductionProxyStatisticsPrefs(
+ g_browser_process->local_state(),
+ base::MessageLoopProxy::current(),
+ commit_delay));
+ data_reduction_proxy_chrome_settings->SetDataReductionProxyStatisticsPrefs(
+ data_reduction_proxy_statistics_prefs.get());
+
// Make sure we initialize the ProfileIOData after everything else has been
// initialized that we might be reading from the IO thread.
- io_data_.Init(cookie_path, server_bound_cert_path, cache_path,
+ io_data_.Init(cookie_path, channel_id_path, cache_path,
cache_max_size, media_cache_path, media_cache_max_size,
extensions_cookie_path, GetPath(), infinite_cache_path,
- predictor_,
- session_cookie_mode,
- GetSpecialStoragePolicy());
+ predictor_, session_cookie_mode, GetSpecialStoragePolicy(),
+ CreateDomainReliabilityMonitor(local_state),
+ data_reduction_proxy_unavailable,
+ chrome_configurator.Pass(),
+ data_reduction_proxy_params.Pass(),
+ data_reduction_proxy_statistics_prefs.Pass());
+ data_reduction_proxy_chrome_settings->InitDataReductionProxySettings(
+ data_reduction_proxy_chrome_configurator,
+ prefs_.get(),
+ g_browser_process->local_state(),
+ GetRequestContext());
#if defined(ENABLE_PLUGINS)
ChromePluginServiceFilter::GetInstance()->RegisterResourceContext(
RegisterDomDistillerViewerSource(this);
// Creation has been finished.
+ TRACE_EVENT_END1("browser",
+ "Profile::CreateProfile",
+ "profile_path",
+ path_.value().c_str());
+
+#if defined(OS_CHROMEOS)
+ if (chromeos::LoginUtils::Get()->RestartToApplyPerSessionFlagsIfNeed(this,
+ true)) {
+ return;
+ }
+#endif
+
if (delegate_) {
TRACE_EVENT0("browser", "ProfileImpl::DoFileInit:DelegateOnProfileCreated")
delegate_->OnProfileCreated(this, true, IsNewProfile());
#endif
gcm::PushMessagingServiceImpl::InitializeForProfile(this);
+
+#if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) && !defined(OS_IOS)
+ signin_ui_util::InitializePrefsForProfile(this);
+#endif
}
void ProfileImpl::InitHostZoomMap() {
- HostZoomMap* host_zoom_map = HostZoomMap::GetForBrowserContext(this);
+ HostZoomMap* host_zoom_map = HostZoomMap::GetDefaultForBrowserContext(this);
host_zoom_map->SetDefaultZoomLevel(
prefs_->GetDouble(prefs::kDefaultZoomLevel));
ProfileDestroyer::DestroyOffTheRecordProfileNow(
off_the_record_profile_.get());
} else {
+#if defined(ENABLE_EXTENSIONS)
ExtensionPrefValueMapFactory::GetForBrowserContext(this)->
ClearAllIncognitoSessionOnlyPreferences();
+#endif
}
BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices(
void ProfileImpl::DestroyOffTheRecordProfile() {
off_the_record_profile_.reset();
+#if defined(ENABLE_EXTENSIONS)
ExtensionPrefValueMapFactory::GetForBrowserContext(this)->
ClearAllIncognitoSessionOnlyPreferences();
+#endif
}
bool ProfileImpl::HasOffTheRecordProfile() {
return !GetPrefs()->GetString(prefs::kSupervisedUserId).empty();
}
-ExtensionService* ProfileImpl::GetExtensionService() {
- return extensions::ExtensionSystem::Get(this)->extension_service();
-}
-
ExtensionSpecialStoragePolicy*
ProfileImpl::GetExtensionSpecialStoragePolicy() {
+#if defined(ENABLE_EXTENSIONS)
if (!extension_special_storage_policy_.get()) {
TRACE_EVENT0("browser", "ProfileImpl::GetExtensionSpecialStoragePolicy")
extension_special_storage_policy_ = new ExtensionSpecialStoragePolicy(
CookieSettings::Factory::GetForProfile(this).get());
}
return extension_special_storage_policy_.get();
+#else
+ return NULL;
+#endif
}
void ProfileImpl::OnPrefsLoaded(bool success) {
prefs_->SetBoolean(prefs::kSessionExitedCleanly, true);
#if defined(OS_ANDROID) && defined(FULL_SAFE_BROWSING)
- // Force safe browsing to false in the case we need to roll back for users
- // enrolled in Finch trial before.
+ // Clear safe browsing setting in the case we need to roll back
+ // for users enrolled in Finch trial before.
if (!SafeBrowsingService::IsEnabledByFieldTrial())
- prefs_->SetBoolean(prefs::kSafeBrowsingEnabled, false);
+ prefs_->ClearPref(prefs::kSafeBrowsingEnabled);
#endif
g_browser_process->profile_manager()->InitProfileUserPrefs(this);
DCHECK(!net_pref_observer_);
{
TRACE_EVENT0("browser", "ProfileImpl::OnPrefsLoaded:NetPrefObserver")
- net_pref_observer_.reset(new NetPrefObserver(
- prefs_.get(),
- prerender::PrerenderManagerFactory::GetForProfile(this),
- predictor_));
+ net_pref_observer_.reset(new NetPrefObserver(prefs_.get()));
}
chrome_prefs::SchedulePrefsFilePathVerification(path_);
// The new ExtensionPrefStore is ref_counted and the new PrefService
// stores a reference so that we do not leak memory here.
otr_prefs_.reset(prefs_->CreateIncognitoPrefService(
- new ExtensionPrefStore(
- ExtensionPrefValueMapFactory::GetForBrowserContext(this), true)));
+ CreateExtensionPrefStore(this, true)));
}
return otr_prefs_.get();
}
content::BrowserPluginGuestManager* ProfileImpl::GetGuestManager() {
#if defined(ENABLE_EXTENSIONS)
- return GuestViewManager::FromBrowserContext(this);
+ return extensions::GuestViewManager::FromBrowserContext(this);
#else
return NULL;
#endif
GetDownloadManagerDelegate();
}
-quota::SpecialStoragePolicy* ProfileImpl::GetSpecialStoragePolicy() {
+storage::SpecialStoragePolicy* ProfileImpl::GetSpecialStoragePolicy() {
+#if defined(ENABLE_EXTENSIONS)
return GetExtensionSpecialStoragePolicy();
+#else
+ return NULL;
+#endif
}
content::PushMessagingService* ProfileImpl::GetPushMessagingService() {
this)->push_messaging_service();
}
+content::SSLHostStateDelegate* ProfileImpl::GetSSLHostStateDelegate() {
+ return ChromeSSLHostStateDelegateFactory::GetForProfile(this);
+}
+
bool ProfileImpl::IsSameProfile(Profile* profile) {
if (profile == static_cast<Profile*>(this))
return true;
}
void ProfileImpl::OnDefaultZoomLevelChanged() {
- HostZoomMap::GetForBrowserContext(this)->SetDefaultZoomLevel(
+ HostZoomMap::GetDefaultForBrowserContext(this)->SetDefaultZoomLevel(
pref_change_registrar_.prefs()->GetDouble(prefs::kDefaultZoomLevel));
}
if (change.mode != HostZoomMap::ZOOM_CHANGED_FOR_HOST)
return;
- HostZoomMap* host_zoom_map = HostZoomMap::GetForBrowserContext(this);
+ HostZoomMap* host_zoom_map = HostZoomMap::GetDefaultForBrowserContext(this);
double level = change.zoom_level;
DictionaryPrefUpdate update(prefs_.get(), prefs::kPerHostZoomLevels);
base::DictionaryValue* host_zoom_dictionary = update.Get();
- if (content::ZoomValuesEqual(level, host_zoom_map->GetDefaultZoomLevel())) {
+ if (content::ZoomValuesEqual(level, host_zoom_map->GetDefaultZoomLevel()))
host_zoom_dictionary->RemoveWithoutPathExpansion(change.host, NULL);
- } else {
- host_zoom_dictionary->SetWithoutPathExpansion(
- change.host, base::Value::CreateDoubleValue(level));
- }
+ else
+ host_zoom_dictionary->SetDoubleWithoutPathExpansion(change.host, level);
}
#if defined(ENABLE_SESSION_SERVICE)
// while user's profile determines his personal locale preference.
break;
}
- case APP_LOCALE_CHANGED_VIA_LOGIN: {
+ case APP_LOCALE_CHANGED_VIA_LOGIN:
+ case APP_LOCALE_CHANGED_VIA_PUBLIC_SESSION_LOGIN: {
if (!pref_locale.empty()) {
DCHECK(pref_locale == new_locale);
std::string accepted_locale =
}
if (do_update_pref)
GetPrefs()->SetString(prefs::kApplicationLocale, new_locale);
- local_state->SetString(prefs::kApplicationLocale, new_locale);
+ if (via != APP_LOCALE_CHANGED_VIA_PUBLIC_SESSION_LOGIN)
+ local_state->SetString(prefs::kApplicationLocale, new_locale);
- if (chromeos::UserManager::Get()->GetOwnerEmail() ==
- chromeos::UserManager::Get()->GetUserByProfile(this)->email())
+ if (user_manager::UserManager::Get()->GetOwnerEmail() ==
+ chromeos::ProfileHelper::Get()->GetUserByProfile(this)->email())
local_state->SetString(prefs::kOwnerLocale, new_locale);
}
void ProfileImpl::InitChromeOSPreferences() {
chromeos_preferences_.reset(new chromeos::Preferences());
chromeos_preferences_->Init(
- PrefServiceSyncable::FromProfile(this),
- chromeos::UserManager::Get()->GetUserByProfile(this));
+ this, chromeos::ProfileHelper::Get()->GetUserByProfile(this));
}
#endif // defined(OS_CHROMEOS)
io_data_.ClearNetworkingHistorySince(time, completion);
}
-void ProfileImpl::ClearDomainReliabilityMonitor(
- domain_reliability::DomainReliabilityClearMode mode,
- const base::Closure& completion) {
- io_data_.ClearDomainReliabilityMonitor(mode, completion);
-}
-
GURL ProfileImpl::GetHomePage() {
// --homepage overrides any preferences.
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
std::string profile_name =
GetPrefs()->GetString(prefs::kProfileName);
cache.SetNameOfProfileAtIndex(index, base::UTF8ToUTF16(profile_name));
+ bool default_name =
+ GetPrefs()->GetBoolean(prefs::kProfileUsingDefaultName);
+ cache.SetProfileIsUsingDefaultNameAtIndex(index, default_name);
}
}
size_t avatar_index =
GetPrefs()->GetInteger(prefs::kProfileAvatarIndex);
cache.SetAvatarIconOfProfileAtIndex(index, avatar_index);
+ bool default_avatar =
+ GetPrefs()->GetBoolean(prefs::kProfileUsingDefaultAvatar);
+ cache.SetProfileIsUsingDefaultAvatarAtIndex(index, default_avatar);
+ bool gaia_avatar =
+ GetPrefs()->GetBoolean(prefs::kProfileUsingGAIAAvatar);
+ cache.SetIsUsingGAIAPictureOfProfileAtIndex(index, gaia_avatar);
}
}
return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile(
GetPrefs(), g_browser_process->local_state());
}
+
+scoped_ptr<domain_reliability::DomainReliabilityMonitor>
+ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) {
+ domain_reliability::DomainReliabilityService* service =
+ domain_reliability::DomainReliabilityServiceFactory::GetInstance()->
+ GetForBrowserContext(this);
+ if (!service)
+ return scoped_ptr<domain_reliability::DomainReliabilityMonitor>();
+
+ return service->CreateMonitor(
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
+}