Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2017 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/chrome_cleanup_handler.h" | 5 #include "chrome/browser/ui/webui/settings/chrome_cleanup_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/feature_list.h" | 10 #include "base/feature_list.h" |
| 11 #include "base/metrics/histogram_macros.h" | |
| 11 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
| 12 #include "base/values.h" | 13 #include "base/values.h" |
| 13 #include "chrome/browser/safe_browsing/chrome_cleaner/srt_field_trial_win.h" | 14 #include "chrome/browser/safe_browsing/chrome_cleaner/srt_field_trial_win.h" |
| 14 #include "chrome/grit/generated_resources.h" | 15 #include "chrome/grit/generated_resources.h" |
| 15 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
| 16 #include "content/public/browser/web_ui.h" | 17 #include "content/public/browser/web_ui.h" |
| 17 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
| 18 | 19 |
| 19 using safe_browsing::ChromeCleanerController; | 20 using safe_browsing::ChromeCleanerController; |
| 20 | 21 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 126 } | 127 } |
| 127 | 128 |
| 128 void ChromeCleanupHandler::HandleRegisterChromeCleanerObserver( | 129 void ChromeCleanupHandler::HandleRegisterChromeCleanerObserver( |
| 129 const base::ListValue* args) { | 130 const base::ListValue* args) { |
| 130 DCHECK_EQ(0U, args->GetSize()); | 131 DCHECK_EQ(0U, args->GetSize()); |
| 131 // The Polymer element should never be attached if the feature is | 132 // The Polymer element should never be attached if the feature is |
| 132 // disabled. | 133 // disabled. |
| 133 DCHECK( | 134 DCHECK( |
| 134 base::FeatureList::IsEnabled(safe_browsing::kInBrowserCleanerUIFeature)); | 135 base::FeatureList::IsEnabled(safe_browsing::kInBrowserCleanerUIFeature)); |
| 135 | 136 |
| 137 UMA_HISTOGRAM_BOOLEAN("SoftwareReporter.CleanupCardShown", true); | |
|
csharp
2017/07/07 17:32:51
It seems odd to have a boolean histogram that is o
ftirelo
2017/07/07 20:27:53
Used a single-value enum instead.
| |
| 136 AllowJavascript(); | 138 AllowJavascript(); |
| 137 } | 139 } |
| 138 | 140 |
| 139 void ChromeCleanupHandler::HandleRestartComputer(const base::ListValue* args) { | 141 void ChromeCleanupHandler::HandleRestartComputer(const base::ListValue* args) { |
| 140 DCHECK_EQ(0U, args->GetSize()); | 142 DCHECK_EQ(0U, args->GetSize()); |
| 141 | 143 |
| 142 CallJavascriptFunction("cr.webUIListenerCallback", | 144 CallJavascriptFunction("cr.webUIListenerCallback", |
| 143 base::Value("chrome-cleanup-on-dismiss")); | 145 base::Value("chrome-cleanup-on-dismiss")); |
| 144 // TODO(proberge): Show a prompt to reboot the system. | 146 // TODO(proberge): Show a prompt to reboot the system. |
| 145 } | 147 } |
| 146 | 148 |
| 147 void ChromeCleanupHandler::HandleStartCleanup(const base::ListValue* args) { | 149 void ChromeCleanupHandler::HandleStartCleanup(const base::ListValue* args) { |
| 148 DCHECK_EQ(0U, args->GetSize()); | 150 DCHECK_EQ(0U, args->GetSize()); |
| 149 | 151 |
| 152 safe_browsing::RecordCleanupStartedHistogram( | |
|
csharp
2017/07/07 17:32:51
Maybe also worth recording this in the suggested S
ftirelo
2017/07/07 20:27:53
As discussed offline, it will be tricky to do that
| |
| 153 safe_browsing::CLEANUP_STARTED_FROM_PROMPT_IN_SETTINGS); | |
| 150 controller_->ReplyWithUserResponse( | 154 controller_->ReplyWithUserResponse( |
| 151 // TODO(proberge): Send kAcceptedWithLogs or kAcceptedWithoutLogs based on | 155 // TODO(proberge): Send kAcceptedWithLogs or kAcceptedWithoutLogs based on |
| 152 // the state of a logs upload permissions checkbox. | 156 // the state of a logs upload permissions checkbox. |
| 153 profile_, ChromeCleanerController::UserResponse::kAcceptedWithoutLogs); | 157 profile_, ChromeCleanerController::UserResponse::kAcceptedWithoutLogs); |
| 154 } | 158 } |
| 155 | 159 |
| 156 } // namespace settings | 160 } // namespace settings |
| OLD | NEW |