| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 return "cleaning_failed"; | 46 return "cleaning_failed"; |
| 47 case ChromeCleanerController::IdleReason::kCleaningSucceeded: | 47 case ChromeCleanerController::IdleReason::kCleaningSucceeded: |
| 48 return "cleaning_succeeded"; | 48 return "cleaning_succeeded"; |
| 49 } | 49 } |
| 50 NOTREACHED(); | 50 NOTREACHED(); |
| 51 return ""; | 51 return ""; |
| 52 } | 52 } |
| 53 | 53 |
| 54 } // namespace | 54 } // namespace |
| 55 | 55 |
| 56 ChromeCleanupHandler::ChromeCleanupHandler() | 56 ChromeCleanupHandler::ChromeCleanupHandler(Profile* profile) |
| 57 : controller_(ChromeCleanerController::GetInstance()) {} | 57 : controller_(ChromeCleanerController::GetInstance()), profile_(profile) {} |
| 58 | 58 |
| 59 ChromeCleanupHandler::~ChromeCleanupHandler() { | 59 ChromeCleanupHandler::~ChromeCleanupHandler() { |
| 60 controller_->RemoveObserver(this); | 60 controller_->RemoveObserver(this); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void ChromeCleanupHandler::RegisterMessages() { | 63 void ChromeCleanupHandler::RegisterMessages() { |
| 64 web_ui()->RegisterMessageCallback( | 64 web_ui()->RegisterMessageCallback( |
| 65 "dismissCleanupPage", | 65 "dismissCleanupPage", |
| 66 base::Bind(&ChromeCleanupHandler::HandleDismiss, base::Unretained(this))); | 66 base::Bind(&ChromeCleanupHandler::HandleDismiss, base::Unretained(this))); |
| 67 web_ui()->RegisterMessageCallback( | 67 web_ui()->RegisterMessageCallback( |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 profile_, ChromeCleanerController::UserResponse::kAccepted); |
| 150 } | 150 } |
| 151 | 151 |
| 152 } // namespace settings | 152 } // namespace settings |
| OLD | NEW |