| 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" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 prefs::kCookieBehavior, | 31 prefs::kCookieBehavior, |
| 32 prefs::kDefaultCharset, | 32 prefs::kDefaultCharset, |
| 33 prefs::kDefaultZoomLevel, | 33 prefs::kDefaultZoomLevel, |
| 34 prefs::kDeleteBrowsingHistory, | 34 prefs::kDeleteBrowsingHistory, |
| 35 prefs::kDeleteCache, | 35 prefs::kDeleteCache, |
| 36 prefs::kDeleteCookies, | 36 prefs::kDeleteCookies, |
| 37 prefs::kDeleteDownloadHistory, | 37 prefs::kDeleteDownloadHistory, |
| 38 prefs::kDeleteFormData, | 38 prefs::kDeleteFormData, |
| 39 prefs::kDeletePasswords, | 39 prefs::kDeletePasswords, |
| 40 prefs::kDnsPrefetchingEnabled, | 40 prefs::kDnsPrefetchingEnabled, |
| 41 #if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_OPENBSD) | 41 // TODO(rtenneti): Remove ssl preferences from user_prefs when we stop |
| 42 // migrating user_prefs to local_state after 6 months (after we delete |
| 43 // migration code). |
| 42 prefs::kCertRevocationCheckingEnabled, | 44 prefs::kCertRevocationCheckingEnabled, |
| 43 prefs::kSSL3Enabled, | 45 prefs::kSSL3Enabled, |
| 44 prefs::kTLS1Enabled, | 46 prefs::kTLS1Enabled, |
| 45 #endif | |
| 46 #if defined(OS_CHROMEOS) | 47 #if defined(OS_CHROMEOS) |
| 47 prefs::kTapToClickEnabled, | 48 prefs::kTapToClickEnabled, |
| 48 prefs::kTouchpadSensitivity, | 49 prefs::kTouchpadSensitivity, |
| 49 #endif | 50 #endif |
| 50 prefs::kDownloadDefaultDirectory, | 51 prefs::kDownloadDefaultDirectory, |
| 51 prefs::kDownloadExtensionsToOpen, | 52 prefs::kDownloadExtensionsToOpen, |
| 52 prefs::kSavingBrowserHistoryDisabled, | 53 prefs::kSavingBrowserHistoryDisabled, |
| 53 prefs::kEnableSpellCheck, | 54 prefs::kEnableSpellCheck, |
| 54 prefs::kEnableTranslate, | 55 prefs::kEnableTranslate, |
| 55 prefs::kAutofillEnabled, | 56 prefs::kAutofillEnabled, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 PrefService* local_state = g_browser_process->local_state(); | 90 PrefService* local_state = g_browser_process->local_state(); |
| 90 // Note that we don't reset the kMetricsReportingEnabled preference here | 91 // Note that we don't reset the kMetricsReportingEnabled preference here |
| 91 // 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 |
| 92 // 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 |
| 93 // 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 |
| 94 // settings they'll either inadvertedly enable this logging or disable it. | 95 // settings they'll either inadvertedly enable this logging or disable it. |
| 95 // 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 |
| 96 // don't reset it. | 97 // don't reset it. |
| 97 const char* kLocalStatePrefs[] = { | 98 const char* kLocalStatePrefs[] = { |
| 98 prefs::kApplicationLocale, | 99 prefs::kApplicationLocale, |
| 99 #if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_OPENBSD) | |
| 100 prefs::kCertRevocationCheckingEnabled, | 100 prefs::kCertRevocationCheckingEnabled, |
| 101 prefs::kSSL3Enabled, | 101 prefs::kSSL3Enabled, |
| 102 prefs::kTLS1Enabled, | 102 prefs::kTLS1Enabled, |
| 103 #endif | |
| 104 }; | 103 }; |
| 105 for (size_t i = 0; i < arraysize(kLocalStatePrefs); ++i) | 104 for (size_t i = 0; i < arraysize(kLocalStatePrefs); ++i) |
| 106 local_state->ClearPref(kLocalStatePrefs[i]); | 105 local_state->ClearPref(kLocalStatePrefs[i]); |
| 107 } | 106 } |
| 108 | 107 |
| 109 // static | 108 // static |
| 110 bool OptionsUtil::ResolveMetricsReportingEnabled(bool enabled) { | 109 bool OptionsUtil::ResolveMetricsReportingEnabled(bool enabled) { |
| 111 // GoogleUpdateSettings touches the disk from the UI thread. MetricsService | 110 // GoogleUpdateSettings touches the disk from the UI thread. MetricsService |
| 112 // also calls GoogleUpdateSettings below. http://crbug/62626 | 111 // also calls GoogleUpdateSettings below. http://crbug/62626 |
| 113 base::ThreadRestrictions::ScopedAllowIO allow_io; | 112 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 128 if (metrics) { | 127 if (metrics) { |
| 129 metrics->SetUserPermitsUpload(enabled); | 128 metrics->SetUserPermitsUpload(enabled); |
| 130 if (enabled) | 129 if (enabled) |
| 131 metrics->Start(); | 130 metrics->Start(); |
| 132 else | 131 else |
| 133 metrics->Stop(); | 132 metrics->Stop(); |
| 134 } | 133 } |
| 135 | 134 |
| 136 return enabled; | 135 return enabled; |
| 137 } | 136 } |
| OLD | NEW |