| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/options/options_util.h" | 5 #include "chrome/browser/ui/options/options_util.h" |
| 6 | 6 |
| 7 #include "base/threading/thread_restrictions.h" | 7 #include "base/threading/thread_restrictions.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/content_settings/host_content_settings_map.h" | 9 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 10 #include "chrome/browser/download/download_manager.h" | 10 #include "chrome/browser/download/download_manager.h" |
| 11 #include "chrome/browser/download/download_prefs.h" | 11 #include "chrome/browser/download/download_prefs.h" |
| 12 #include "chrome/browser/geolocation/geolocation_content_settings_map.h" | 12 #include "chrome/browser/geolocation/geolocation_content_settings_map.h" |
| 13 #include "chrome/browser/metrics/metrics_service.h" | 13 #include "chrome/browser/metrics/metrics_service.h" |
| 14 #include "chrome/browser/notifications/desktop_notification_service.h" | 14 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 15 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | |
| 16 #include "chrome/browser/prefs/pref_service.h" | 15 #include "chrome/browser/prefs/pref_service.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
| 19 #include "chrome/installer/util/google_update_settings.h" | 18 #include "chrome/installer/util/google_update_settings.h" |
| 20 #include "content/browser/host_zoom_map.h" | 19 #include "content/browser/host_zoom_map.h" |
| 21 | 20 |
| 22 // static | 21 // static |
| 23 void OptionsUtil::ResetToDefaults(Profile* profile) { | 22 void OptionsUtil::ResetToDefaults(Profile* profile) { |
| 24 // TODO(tc): It would be nice if we could generate this list automatically so | 23 // TODO(tc): It would be nice if we could generate this list automatically so |
| 25 // changes to any of the options pages doesn't require updating this list | 24 // changes to any of the options pages doesn't require updating this list |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 prefs::kWebKitSansSerifFontFamily, | 76 prefs::kWebKitSansSerifFontFamily, |
| 78 prefs::kWebKitSerifFontFamily, | 77 prefs::kWebKitSerifFontFamily, |
| 79 prefs::kWebKitMinimumFontSize, | 78 prefs::kWebKitMinimumFontSize, |
| 80 prefs::kWebKitMinimumLogicalFontSize, | 79 prefs::kWebKitMinimumLogicalFontSize, |
| 81 prefs::kWebkitTabsToLinks, | 80 prefs::kWebkitTabsToLinks, |
| 82 }; | 81 }; |
| 83 profile->GetDownloadManager()->download_prefs()->ResetToDefaults(); | 82 profile->GetDownloadManager()->download_prefs()->ResetToDefaults(); |
| 84 profile->GetHostContentSettingsMap()->ResetToDefaults(); | 83 profile->GetHostContentSettingsMap()->ResetToDefaults(); |
| 85 profile->GetGeolocationContentSettingsMap()->ResetToDefault(); | 84 profile->GetGeolocationContentSettingsMap()->ResetToDefault(); |
| 86 profile->GetHostZoomMap()->ResetToDefaults(); | 85 profile->GetHostZoomMap()->ResetToDefaults(); |
| 87 DesktopNotificationServiceFactory::GetForProfile(profile)-> | 86 profile->GetDesktopNotificationService()->ResetToDefaultContentSetting(); |
| 88 ResetToDefaultContentSetting(); | |
| 89 for (size_t i = 0; i < arraysize(kUserPrefs); ++i) | 87 for (size_t i = 0; i < arraysize(kUserPrefs); ++i) |
| 90 prefs->ClearPref(kUserPrefs[i]); | 88 prefs->ClearPref(kUserPrefs[i]); |
| 91 | 89 |
| 92 PrefService* local_state = g_browser_process->local_state(); | 90 PrefService* local_state = g_browser_process->local_state(); |
| 93 // Note that we don't reset the kMetricsReportingEnabled preference here | 91 // Note that we don't reset the kMetricsReportingEnabled preference here |
| 94 // because the reset will reset it to the default setting specified in Chrome | 92 // because the reset will reset it to the default setting specified in Chrome |
| 95 // source, not the default setting selected by the user on the web page where | 93 // source, not the default setting selected by the user on the web page where |
| 96 // they downloaded Chrome. This means that if the user ever resets their | 94 // they downloaded Chrome. This means that if the user ever resets their |
| 97 // settings they'll either inadvertedly enable this logging or disable it. | 95 // settings they'll either inadvertedly enable this logging or disable it. |
| 98 // One is undesirable for them, one is undesirable for us. For now, we just | 96 // One is undesirable for them, one is undesirable for us. For now, we just |
| (...skipping 30 matching lines...) Expand all Loading... |
| 129 if (metrics) { | 127 if (metrics) { |
| 130 metrics->SetUserPermitsUpload(enabled); | 128 metrics->SetUserPermitsUpload(enabled); |
| 131 if (enabled) | 129 if (enabled) |
| 132 metrics->Start(); | 130 metrics->Start(); |
| 133 else | 131 else |
| 134 metrics->Stop(); | 132 metrics->Stop(); |
| 135 } | 133 } |
| 136 | 134 |
| 137 return enabled; | 135 return enabled; |
| 138 } | 136 } |
| OLD | NEW |