Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/webui/settings/settings_clear_browsing_data_handler. h" | 5 #include "chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler. h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 remove_mask |= site_data_mask; | 99 remove_mask |= site_data_mask; |
| 100 origin_mask |= BrowsingDataHelper::UNPROTECTED_WEB; | 100 origin_mask |= BrowsingDataHelper::UNPROTECTED_WEB; |
| 101 } | 101 } |
| 102 | 102 |
| 103 if (prefs->GetBoolean(prefs::kDeletePasswords)) | 103 if (prefs->GetBoolean(prefs::kDeletePasswords)) |
| 104 remove_mask |= BrowsingDataRemover::REMOVE_PASSWORDS; | 104 remove_mask |= BrowsingDataRemover::REMOVE_PASSWORDS; |
| 105 | 105 |
| 106 if (prefs->GetBoolean(prefs::kDeleteFormData)) | 106 if (prefs->GetBoolean(prefs::kDeleteFormData)) |
| 107 remove_mask |= BrowsingDataRemover::REMOVE_FORM_DATA; | 107 remove_mask |= BrowsingDataRemover::REMOVE_FORM_DATA; |
| 108 | 108 |
| 109 // Clearing Content Licenses is only supported in Pepper Flash. | 109 if (prefs->GetBoolean(prefs::kDeleteMediaLicenses)) |
| 110 if (prefs->GetBoolean(prefs::kDeauthorizeContentLicenses) && | 110 remove_mask |= BrowsingDataRemover::REMOVE_MEDIA_LICENSES; |
| 111 *pepper_flash_settings_enabled_) { | |
| 112 remove_mask |= BrowsingDataRemover::REMOVE_CONTENT_LICENSES; | |
| 113 } | |
| 114 | 111 |
| 115 if (prefs->GetBoolean(prefs::kDeleteHostedAppsData)) { | 112 if (prefs->GetBoolean(prefs::kDeleteHostedAppsData)) { |
| 116 remove_mask |= site_data_mask; | 113 remove_mask |= site_data_mask; |
| 117 origin_mask |= BrowsingDataHelper::PROTECTED_WEB; | 114 origin_mask |= BrowsingDataHelper::PROTECTED_WEB; |
| 118 } | 115 } |
| 119 | 116 |
| 120 // Record the deletion of cookies and cache. | 117 // Record the deletion of cookies and cache. |
| 121 BrowsingDataRemover::CookieOrCacheDeletionChoice choice = | 118 BrowsingDataRemover::CookieOrCacheDeletionChoice choice = |
| 122 BrowsingDataRemover::NEITHER_COOKIES_NOR_CACHE; | 119 BrowsingDataRemover::NEITHER_COOKIES_NOR_CACHE; |
| 123 if (prefs->GetBoolean(prefs::kDeleteCookies)) { | 120 if (prefs->GetBoolean(prefs::kDeleteCookies)) { |
| 124 choice = prefs->GetBoolean(prefs::kDeleteCache) | 121 choice = prefs->GetBoolean(prefs::kDeleteCache) |
| 125 ? BrowsingDataRemover::BOTH_COOKIES_AND_CACHE | 122 ? BrowsingDataRemover::BOTH_COOKIES_AND_CACHE |
| 126 : BrowsingDataRemover::ONLY_COOKIES; | 123 : BrowsingDataRemover::ONLY_COOKIES; |
| 127 } else if (prefs->GetBoolean(prefs::kDeleteCache)) { | 124 } else if (prefs->GetBoolean(prefs::kDeleteCache)) { |
| 128 choice = BrowsingDataRemover::ONLY_CACHE; | 125 choice = BrowsingDataRemover::ONLY_CACHE; |
| 129 } | 126 } |
| 130 | 127 |
| 131 UMA_HISTOGRAM_ENUMERATION( | 128 UMA_HISTOGRAM_ENUMERATION( |
| 132 "History.ClearBrowsingData.UserDeletedCookieOrCacheFromDialog", choice, | 129 "History.ClearBrowsingData.UserDeletedCookieOrCacheFromDialog", choice, |
| 133 BrowsingDataRemover::MAX_CHOICE_VALUE); | 130 BrowsingDataRemover::MAX_CHOICE_VALUE); |
| 134 | 131 |
| 135 // Record the circumstances under which passwords are deleted. | 132 // Record the circumstances under which passwords are deleted. |
| 136 if (prefs->GetBoolean(prefs::kDeletePasswords)) { | 133 if (prefs->GetBoolean(prefs::kDeletePasswords)) { |
| 137 static const char* other_types[] = { | 134 static const char* other_types[] = { |
| 138 prefs::kDeleteBrowsingHistory, | 135 prefs::kDeleteBrowsingHistory, prefs::kDeleteDownloadHistory, |
| 139 prefs::kDeleteDownloadHistory, | 136 prefs::kDeleteCache, prefs::kDeleteCookies, |
| 140 prefs::kDeleteCache, | 137 prefs::kDeleteFormData, prefs::kDeleteHostedAppsData, |
| 141 prefs::kDeleteCookies, | 138 prefs::kDeleteMediaLicenses, |
|
Peter Kasting
2016/06/22 00:05:14
Nit: Same comment.
jrummell
2016/06/23 02:48:55
Done.
| |
| 142 prefs::kDeleteFormData, | |
| 143 prefs::kDeleteHostedAppsData, | |
| 144 prefs::kDeauthorizeContentLicenses, | |
| 145 }; | 139 }; |
| 146 static size_t num_other_types = arraysize(other_types); | 140 static size_t num_other_types = arraysize(other_types); |
| 147 int checked_other_types = std::count_if( | 141 int checked_other_types = std::count_if( |
| 148 other_types, other_types + num_other_types, | 142 other_types, other_types + num_other_types, |
| 149 [prefs](const std::string& pref) { return prefs->GetBoolean(pref); }); | 143 [prefs](const std::string& pref) { return prefs->GetBoolean(pref); }); |
| 150 UMA_HISTOGRAM_SPARSE_SLOWLY( | 144 UMA_HISTOGRAM_SPARSE_SLOWLY( |
| 151 "History.ClearBrowsingData.PasswordsDeletion.AdditionalDatatypesCount", | 145 "History.ClearBrowsingData.PasswordsDeletion.AdditionalDatatypesCount", |
| 152 checked_other_types); | 146 checked_other_types); |
| 153 } | 147 } |
| 154 | 148 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 202 void ClearBrowsingDataHandler::UpdateHistoryNotice(bool show) { | 196 void ClearBrowsingDataHandler::UpdateHistoryNotice(bool show) { |
| 203 should_show_history_footer_ = show; | 197 should_show_history_footer_ = show; |
| 204 OnStateChanged(); | 198 OnStateChanged(); |
| 205 | 199 |
| 206 UMA_HISTOGRAM_BOOLEAN( | 200 UMA_HISTOGRAM_BOOLEAN( |
| 207 "History.ClearBrowsingData.HistoryNoticeShownInFooterWhenUpdated", | 201 "History.ClearBrowsingData.HistoryNoticeShownInFooterWhenUpdated", |
| 208 should_show_history_footer_); | 202 should_show_history_footer_); |
| 209 } | 203 } |
| 210 | 204 |
| 211 } // namespace settings | 205 } // namespace settings |
| OLD | NEW |