| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/feature_list.h" | 8 #include "base/feature_list.h" |
| 9 #include "base/synchronization/lock.h" | 9 #include "base/synchronization/lock.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 CallJavascriptFunction("cr.webUIListenerCallback", | 113 CallJavascriptFunction("cr.webUIListenerCallback", |
| 114 base::Value("chrome-cleanup-on-reboot-required")); | 114 base::Value("chrome-cleanup-on-reboot-required")); |
| 115 } | 115 } |
| 116 | 116 |
| 117 void ChromeCleanupHandler::HandleDismiss(const base::ListValue* args) { | 117 void ChromeCleanupHandler::HandleDismiss(const base::ListValue* args) { |
| 118 DCHECK_EQ(0U, args->GetSize()); | 118 DCHECK_EQ(0U, args->GetSize()); |
| 119 | 119 |
| 120 controller_->RemoveObserver(this); | 120 controller_->RemoveObserver(this); |
| 121 | 121 |
| 122 CallJavascriptFunction("cr.webUIListenerCallback", | 122 CallJavascriptFunction("cr.webUIListenerCallback", |
| 123 base::Value("chrome-cleanup-dismiss")); | 123 base::Value("chrome-cleanup-on-dismiss")); |
| 124 } | 124 } |
| 125 | 125 |
| 126 void ChromeCleanupHandler::HandleRegisterChromeCleanerObserver( | 126 void ChromeCleanupHandler::HandleRegisterChromeCleanerObserver( |
| 127 const base::ListValue* args) { | 127 const base::ListValue* args) { |
| 128 DCHECK_EQ(0U, args->GetSize()); | 128 DCHECK_EQ(0U, args->GetSize()); |
| 129 // The Polymer element should never be attached if the feature is | 129 // The Polymer element should never be attached if the feature is |
| 130 // disabled. | 130 // disabled. |
| 131 DCHECK( | 131 DCHECK( |
| 132 base::FeatureList::IsEnabled(safe_browsing::kInBrowserCleanerUIFeature)); | 132 base::FeatureList::IsEnabled(safe_browsing::kInBrowserCleanerUIFeature)); |
| 133 | 133 |
| 134 AllowJavascript(); | 134 AllowJavascript(); |
| 135 } | 135 } |
| 136 | 136 |
| 137 void ChromeCleanupHandler::HandleRestartComputer(const base::ListValue* args) { | 137 void ChromeCleanupHandler::HandleRestartComputer(const base::ListValue* args) { |
| 138 DCHECK_EQ(0U, args->GetSize()); | 138 DCHECK_EQ(0U, args->GetSize()); |
| 139 | 139 |
| 140 CallJavascriptFunction("cr.webUIListenerCallback", | 140 CallJavascriptFunction("cr.webUIListenerCallback", |
| 141 base::Value("chrome-cleanup-on-dismiss")); | 141 base::Value("chrome-cleanup-on-dismiss")); |
| 142 // TODO(proberge): Show a prompt to reboot the system. | 142 // TODO(proberge): Show a prompt to reboot the system. |
| 143 } | 143 } |
| 144 | 144 |
| 145 void ChromeCleanupHandler::HandleStartCleanup(const base::ListValue* args) { | 145 void ChromeCleanupHandler::HandleStartCleanup(const base::ListValue* args) { |
| 146 DCHECK_EQ(0U, args->GetSize()); | 146 DCHECK_EQ(0U, args->GetSize()); |
| 147 | 147 |
| 148 controller_->ReplyWithUserResponse( | 148 controller_->ReplyWithUserResponse( |
| 149 ChromeCleanerController::UserResponse::kAccepted); | 149 ChromeCleanerController::UserResponse::kAccepted); |
| 150 } | 150 } |
| 151 | 151 |
| 152 } // namespace settings | 152 } // namespace settings |
| OLD | NEW |