Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(663)

Side by Side Diff: chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_win.cc

Issue 2973873002: Primary histograms for InBrowserCleanerUI experiment (Closed)
Patch Set: Revert changes to histogram.cc Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 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/safe_browsing/chrome_cleaner/chrome_cleaner_controller_ win.h" 5 #include "chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_controller_ win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/files/file_util.h" 14 #include "base/files/file_util.h"
15 #include "base/location.h" 15 #include "base/location.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/memory/ptr_util.h" 17 #include "base/memory/ptr_util.h"
18 #include "base/metrics/histogram_macros.h"
18 #include "base/task_scheduler/post_task.h" 19 #include "base/task_scheduler/post_task.h"
19 #include "base/task_scheduler/task_traits.h" 20 #include "base/task_scheduler/task_traits.h"
20 #include "base/threading/thread_restrictions.h" 21 #include "base/threading/thread_restrictions.h"
21 #include "base/threading/thread_task_runner_handle.h" 22 #include "base/threading/thread_task_runner_handle.h"
22 #include "chrome/browser/browser_process.h" 23 #include "chrome/browser/browser_process.h"
23 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" 24 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h"
24 #include "chrome/browser/profiles/profile.h" 25 #include "chrome/browser/profiles/profile.h"
25 #include "chrome/browser/profiles/profile_manager.h" 26 #include "chrome/browser/profiles/profile_manager.h"
26 #include "chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_fetcher_win .h" 27 #include "chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_fetcher_win .h"
27 #include "chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_runner_win. h" 28 #include "chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_runner_win. h"
28 #include "chrome/browser/safe_browsing/chrome_cleaner/settings_resetter_win.h" 29 #include "chrome/browser/safe_browsing/chrome_cleaner/settings_resetter_win.h"
29 #include "chrome/browser/safe_browsing/chrome_cleaner/srt_client_info_win.h" 30 #include "chrome/browser/safe_browsing/chrome_cleaner/srt_client_info_win.h"
31 #include "chrome/browser/safe_browsing/chrome_cleaner/srt_field_trial_win.h"
30 #include "chrome/installer/util/scoped_token_privilege.h" 32 #include "chrome/installer/util/scoped_token_privilege.h"
31 #include "components/chrome_cleaner/public/constants/constants.h" 33 #include "components/chrome_cleaner/public/constants/constants.h"
32 #include "components/safe_browsing/common/safe_browsing_prefs.h" 34 #include "components/safe_browsing/common/safe_browsing_prefs.h"
33 #include "content/public/browser/browser_thread.h" 35 #include "content/public/browser/browser_thread.h"
34 #include "net/http/http_status_code.h" 36 #include "net/http/http_status_code.h"
35 37
36 namespace safe_browsing { 38 namespace safe_browsing {
37 39
38 namespace { 40 namespace {
39 41
40 using ::chrome_cleaner::mojom::ChromePrompt; 42 using ::chrome_cleaner::mojom::ChromePrompt;
41 using ::chrome_cleaner::mojom::PromptAcceptance; 43 using ::chrome_cleaner::mojom::PromptAcceptance;
42 using ::content::BrowserThread; 44 using ::content::BrowserThread;
43 45
44 // The global singleton instance. Exposed outside of GetInstance() so that it 46 // The global singleton instance. Exposed outside of GetInstance() so that it
45 // can be reset by tests. 47 // can be reset by tests.
46 ChromeCleanerController* g_controller = nullptr; 48 ChromeCleanerController* g_controller = nullptr;
47 49
48 // TODO(alito): Move these shared exit codes to the chrome_cleaner component. 50 // TODO(alito): Move these shared exit codes to the chrome_cleaner component.
49 // https://crbug.com/727956 51 // https://crbug.com/727956
50 constexpr int kRebootRequiredExitCode = 15; 52 constexpr int kRebootRequiredExitCode = 15;
51 constexpr int kRebootNotRequiredExitCode = 0; 53 constexpr int kRebootNotRequiredExitCode = 0;
52 54
55 // These values are used to send UMA information and are replicated in the
56 // histograms.xml file, so the order MUST NOT CHANGE.
57 enum CleanupResultHistogramValue {
58 CLEANUP_RESULT_SUCCEEDED = 0,
59 CLEANUP_RESULT_REBOOT_REQUIRED = 1,
60 CLEANUP_RESULT_FAILED = 2,
61
62 CLEANUP_RESULT_MAX,
63 };
64
65 // These values are used to send UMA information and are replicated in the
66 // histograms.xml file, so the order MUST NOT CHANGE.
67 enum IPCDisconnectedHistogramValue {
68 IPC_DISCONNECTED_SUCCESS = 0,
69 IPC_DISCONNECTED_LOST_WHILE_SCANNING = 1,
70 IPC_DISCONNECTED_LOST_USER_PROMPTED = 2,
71
72 IPC_DISCONNECTED_MAX,
73 };
74
53 // Attempts to change the Chrome Cleaner binary's suffix to ".exe". Will return 75 // Attempts to change the Chrome Cleaner binary's suffix to ".exe". Will return
54 // an empty FilePath on failure. Should be called on a sequence with traits 76 // an empty FilePath on failure. Should be called on a sequence with traits
55 // appropriate for IO operations. 77 // appropriate for IO operations.
56 base::FilePath VerifyAndRenameDownloadedCleaner( 78 base::FilePath VerifyAndRenameDownloadedCleaner(
57 base::FilePath downloaded_path, 79 base::FilePath downloaded_path,
58 ChromeCleanerFetchStatus fetch_status) { 80 ChromeCleanerFetchStatus fetch_status) {
59 base::ThreadRestrictions::AssertIOAllowed(); 81 base::ThreadRestrictions::AssertIOAllowed();
60 82
61 if (downloaded_path.empty() || !base::PathExists(downloaded_path)) 83 if (downloaded_path.empty() || !base::PathExists(downloaded_path))
62 return base::FilePath(); 84 return base::FilePath();
(...skipping 30 matching lines...) Expand all
93 ChromeCleanerController::IdleReason IdleReasonWhenConnectionClosedTooSoon( 115 ChromeCleanerController::IdleReason IdleReasonWhenConnectionClosedTooSoon(
94 ChromeCleanerController::State current_state) { 116 ChromeCleanerController::State current_state) {
95 DCHECK(current_state == ChromeCleanerController::State::kScanning || 117 DCHECK(current_state == ChromeCleanerController::State::kScanning ||
96 current_state == ChromeCleanerController::State::kInfected); 118 current_state == ChromeCleanerController::State::kInfected);
97 119
98 return current_state == ChromeCleanerController::State::kScanning 120 return current_state == ChromeCleanerController::State::kScanning
99 ? ChromeCleanerController::IdleReason::kScanningFailed 121 ? ChromeCleanerController::IdleReason::kScanningFailed
100 : ChromeCleanerController::IdleReason::kConnectionLost; 122 : ChromeCleanerController::IdleReason::kConnectionLost;
101 } 123 }
102 124
125 void RecordCleanerLogsAcceptanceHistogram(bool logs_accepted) {
126 UMA_HISTOGRAM_BOOLEAN("SoftwareReporter.CleanerLogsAcceptance",
127 logs_accepted);
128 }
129
130 void RecordCleanupResultHistogram(CleanupResultHistogramValue result) {
131 UMA_HISTOGRAM_ENUMERATION("SoftwareReporter.Cleaner.CleanupResult", result,
132 CLEANUP_RESULT_MAX);
133 }
134
135 void RecordIPCDisconnectedHistogram(IPCDisconnectedHistogramValue error) {
136 UMA_HISTOGRAM_ENUMERATION("SoftwareReporter.IPCDisconnected", error,
137 IPC_DISCONNECTED_MAX);
138 }
139
103 } // namespace 140 } // namespace
104 141
142 void RecordCleanupStartedHistogram(CleanupStartedHistogramValue value) {
143 UMA_HISTOGRAM_ENUMERATION("SoftwareReporter.CleanupStarted", value,
144 CLEANUP_STARTED_MAX);
145 }
146
105 ChromeCleanerControllerDelegate::ChromeCleanerControllerDelegate() = default; 147 ChromeCleanerControllerDelegate::ChromeCleanerControllerDelegate() = default;
106 148
107 ChromeCleanerControllerDelegate::~ChromeCleanerControllerDelegate() = default; 149 ChromeCleanerControllerDelegate::~ChromeCleanerControllerDelegate() = default;
108 150
109 void ChromeCleanerControllerDelegate::FetchAndVerifyChromeCleaner( 151 void ChromeCleanerControllerDelegate::FetchAndVerifyChromeCleaner(
110 FetchedCallback fetched_callback) { 152 FetchedCallback fetched_callback) {
111 FetchChromeCleaner( 153 FetchChromeCleaner(
112 base::BindOnce(&OnChromeCleanerFetched, base::Passed(&fetched_callback))); 154 base::BindOnce(&OnChromeCleanerFetched, base::Passed(&fetched_callback)));
113 } 155 }
114 156
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 return; 266 return;
225 267
226 DCHECK(prompt_user_callback_); 268 DCHECK(prompt_user_callback_);
227 269
228 PromptAcceptance acceptance = PromptAcceptance::DENIED; 270 PromptAcceptance acceptance = PromptAcceptance::DENIED;
229 State new_state = State::kIdle; 271 State new_state = State::kIdle;
230 switch (user_response) { 272 switch (user_response) {
231 case UserResponse::kAcceptedWithLogs: 273 case UserResponse::kAcceptedWithLogs:
232 acceptance = PromptAcceptance::ACCEPTED_WITH_LOGS; 274 acceptance = PromptAcceptance::ACCEPTED_WITH_LOGS;
233 SetLogsEnabled(true); 275 SetLogsEnabled(true);
276 RecordCleanerLogsAcceptanceHistogram(true);
234 new_state = State::kCleaning; 277 new_state = State::kCleaning;
235 delegate_->TagForResetting(profile); 278 delegate_->TagForResetting(profile);
236 break; 279 break;
237 case UserResponse::kAcceptedWithoutLogs: 280 case UserResponse::kAcceptedWithoutLogs:
238 acceptance = PromptAcceptance::ACCEPTED_WITHOUT_LOGS; 281 acceptance = PromptAcceptance::ACCEPTED_WITHOUT_LOGS;
239 SetLogsEnabled(false); 282 SetLogsEnabled(false);
283 RecordCleanerLogsAcceptanceHistogram(false);
240 new_state = State::kCleaning; 284 new_state = State::kCleaning;
241 delegate_->TagForResetting(profile); 285 delegate_->TagForResetting(profile);
242 break; 286 break;
243 case UserResponse::kDenied: // Fallthrough 287 case UserResponse::kDenied: // Fallthrough
244 case UserResponse::kDismissed: 288 case UserResponse::kDismissed:
245 acceptance = PromptAcceptance::DENIED; 289 acceptance = PromptAcceptance::DENIED;
246 idle_reason_ = IdleReason::kUserDeclinedCleanup; 290 idle_reason_ = IdleReason::kUserDeclinedCleanup;
247 new_state = State::kIdle; 291 new_state = State::kIdle;
248 break; 292 break;
249 } 293 }
250 294
251 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO) 295 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)
252 ->PostTask(FROM_HERE, 296 ->PostTask(FROM_HERE,
253 base::BindOnce(std::move(prompt_user_callback_), acceptance)); 297 base::BindOnce(std::move(prompt_user_callback_), acceptance));
254 298
255 // The transition to a new state should happen only after the response has 299 // The transition to a new state should happen only after the response has
256 // been posted on the UI thread so that if we transition to the kIdle state, 300 // been posted on the UI thread so that if we transition to the kIdle state,
257 // the response callback is not cleared before it has been posted. 301 // the response callback is not cleared before it has been posted.
258 SetStateAndNotifyObservers(new_state); 302 SetStateAndNotifyObservers(new_state);
259 } 303 }
260 304
261 void ChromeCleanerController::Reboot() { 305 void ChromeCleanerController::Reboot() {
262 DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); 306 DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
263 307
264 if (state() != State::kRebootRequired) 308 if (state() != State::kRebootRequired)
265 return; 309 return;
266 310
311 UMA_HISTOGRAM_BOOLEAN("SoftwareReporter.Cleaner.RebootResponse", true);
267 InitiateReboot(); 312 InitiateReboot();
268 } 313 }
269 314
270 ChromeCleanerController::ChromeCleanerController() 315 ChromeCleanerController::ChromeCleanerController()
271 : real_delegate_(base::MakeUnique<ChromeCleanerControllerDelegate>()), 316 : real_delegate_(base::MakeUnique<ChromeCleanerControllerDelegate>()),
272 delegate_(real_delegate_.get()), 317 delegate_(real_delegate_.get()),
273 weak_factory_(this) { 318 weak_factory_(this) {
274 DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); 319 DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
275 } 320 }
276 321
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 367
323 void ChromeCleanerController::OnChromeCleanerFetchedAndVerified( 368 void ChromeCleanerController::OnChromeCleanerFetchedAndVerified(
324 base::FilePath executable_path) { 369 base::FilePath executable_path) {
325 DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); 370 DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
326 DCHECK_EQ(State::kScanning, state()); 371 DCHECK_EQ(State::kScanning, state());
327 DCHECK(reporter_invocation_); 372 DCHECK(reporter_invocation_);
328 373
329 if (executable_path.empty()) { 374 if (executable_path.empty()) {
330 idle_reason_ = IdleReason::kScanningFailed; 375 idle_reason_ = IdleReason::kScanningFailed;
331 SetStateAndNotifyObservers(State::kIdle); 376 SetStateAndNotifyObservers(State::kIdle);
377 RecordPromptNotShownWithReasonHistogram(
378 NO_PROMPT_REASON_CLEANER_DOWNLOAD_FAILED);
332 return; 379 return;
333 } 380 }
334 381
335 DCHECK(executable_path.MatchesExtension(FILE_PATH_LITERAL(".exe"))); 382 DCHECK(executable_path.MatchesExtension(FILE_PATH_LITERAL(".exe")));
336 383
337 ChromeCleanerRunner::ChromeMetricsStatus metrics_status = 384 ChromeCleanerRunner::ChromeMetricsStatus metrics_status =
338 delegate_->IsMetricsAndCrashReportingEnabled() 385 delegate_->IsMetricsAndCrashReportingEnabled()
339 ? ChromeCleanerRunner::ChromeMetricsStatus::kEnabled 386 ? ChromeCleanerRunner::ChromeMetricsStatus::kEnabled
340 : ChromeCleanerRunner::ChromeMetricsStatus::kDisabled; 387 : ChromeCleanerRunner::ChromeMetricsStatus::kDisabled;
341 388
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 DCHECK_EQ(State::kScanning, state()); 431 DCHECK_EQ(State::kScanning, state());
385 DCHECK(!files_to_delete_); 432 DCHECK(!files_to_delete_);
386 DCHECK(!prompt_user_callback_); 433 DCHECK(!prompt_user_callback_);
387 434
388 if (files_to_delete->empty()) { 435 if (files_to_delete->empty()) {
389 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO) 436 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)
390 ->PostTask(FROM_HERE, base::BindOnce(std::move(prompt_user_callback), 437 ->PostTask(FROM_HERE, base::BindOnce(std::move(prompt_user_callback),
391 PromptAcceptance::DENIED)); 438 PromptAcceptance::DENIED));
392 idle_reason_ = IdleReason::kScanningFoundNothing; 439 idle_reason_ = IdleReason::kScanningFoundNothing;
393 SetStateAndNotifyObservers(State::kIdle); 440 SetStateAndNotifyObservers(State::kIdle);
441 RecordPromptNotShownWithReasonHistogram(NO_PROMPT_REASON_NOTHING_FOUND);
394 return; 442 return;
395 } 443 }
396 444
445 UMA_HISTOGRAM_COUNTS_1000("SoftwareReporter.NumberOfFilesToDelete",
446 files_to_delete->size());
397 files_to_delete_ = std::move(files_to_delete); 447 files_to_delete_ = std::move(files_to_delete);
398 prompt_user_callback_ = std::move(prompt_user_callback); 448 prompt_user_callback_ = std::move(prompt_user_callback);
399 SetStateAndNotifyObservers(State::kInfected); 449 SetStateAndNotifyObservers(State::kInfected);
400 } 450 }
401 451
402 void ChromeCleanerController::OnConnectionClosed() { 452 void ChromeCleanerController::OnConnectionClosed() {
403 DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); 453 DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
404 DCHECK_NE(State::kIdle, state()); 454 DCHECK_NE(State::kIdle, state());
405 DCHECK_NE(State::kRebootRequired, state()); 455 DCHECK_NE(State::kRebootRequired, state());
406 456
407 if (state() == State::kScanning || state() == State::kInfected) { 457 if (state() == State::kScanning || state() == State::kInfected) {
458 if (state() == State::kScanning) {
459 RecordPromptNotShownWithReasonHistogram(
460 NO_PROMPT_REASON_IPC_CONNECTION_BROKEN);
461 RecordIPCDisconnectedHistogram(IPC_DISCONNECTED_LOST_WHILE_SCANNING);
462 } else {
463 RecordIPCDisconnectedHistogram(IPC_DISCONNECTED_LOST_USER_PROMPTED);
464 }
465
408 idle_reason_ = IdleReasonWhenConnectionClosedTooSoon(state()); 466 idle_reason_ = IdleReasonWhenConnectionClosedTooSoon(state());
409 SetStateAndNotifyObservers(State::kIdle); 467 SetStateAndNotifyObservers(State::kIdle);
410 return; 468 return;
411 } 469 }
412 // Nothing to do if OnConnectionClosed() is called in other states: 470 // Nothing to do if OnConnectionClosed() is called in other states:
413 // - This function will not be called in the kIdle and kRebootRequired 471 // - This function will not be called in the kIdle and kRebootRequired
414 // states since we invalidate all weak pointers when we enter those states. 472 // states since we invalidate all weak pointers when we enter those states.
415 // - In the kCleaning state, we don't care about the connection to the Chrome 473 // - In the kCleaning state, we don't care about the connection to the Chrome
416 // Cleaner process since communication via Mojo is complete and only the 474 // Cleaner process since communication via Mojo is complete and only the
417 // exit code of the process is of any use to us (for deciding whether we 475 // exit code of the process is of any use to us (for deciding whether we
418 // need to reboot). 476 // need to reboot).
477 RecordIPCDisconnectedHistogram(IPC_DISCONNECTED_SUCCESS);
419 } 478 }
420 479
421 void ChromeCleanerController::OnCleanerProcessDone( 480 void ChromeCleanerController::OnCleanerProcessDone(
422 ChromeCleanerRunner::ProcessStatus process_status) { 481 ChromeCleanerRunner::ProcessStatus process_status) {
423 DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); 482 DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
424 483
425 if (state() == State::kScanning || state() == State::kInfected) { 484 if (state() == State::kScanning || state() == State::kInfected) {
426 idle_reason_ = IdleReasonWhenConnectionClosedTooSoon(state()); 485 idle_reason_ = IdleReasonWhenConnectionClosedTooSoon(state());
427 SetStateAndNotifyObservers(State::kIdle); 486 SetStateAndNotifyObservers(State::kIdle);
428 return; 487 return;
429 } 488 }
430 489
431 DCHECK_EQ(State::kCleaning, state()); 490 DCHECK_EQ(State::kCleaning, state());
432 DCHECK_NE(ChromeCleanerRunner::LaunchStatus::kLaunchFailed, 491 DCHECK_NE(ChromeCleanerRunner::LaunchStatus::kLaunchFailed,
433 process_status.launch_status); 492 process_status.launch_status);
434 493
435 if (process_status.launch_status != 494 if (process_status.launch_status ==
436 ChromeCleanerRunner::LaunchStatus::kSuccess) { 495 ChromeCleanerRunner::LaunchStatus::kSuccess) {
437 idle_reason_ = IdleReason::kCleaningFailed; 496 if (process_status.exit_code == kRebootRequiredExitCode) {
438 SetStateAndNotifyObservers(State::kIdle); 497 RecordCleanupResultHistogram(CLEANUP_RESULT_REBOOT_REQUIRED);
439 return; 498 SetStateAndNotifyObservers(State::kRebootRequired);
499 return;
500 }
501
502 if (process_status.exit_code == kRebootNotRequiredExitCode) {
503 RecordCleanupResultHistogram(CLEANUP_RESULT_SUCCEEDED);
504 delegate_->ResetTaggedProfiles(
505 g_browser_process->profile_manager()->GetLoadedProfiles(),
506 base::BindOnce(&ChromeCleanerController::OnSettingsResetCompleted,
507 base::Unretained(this)));
508 ResetCleanerDataAndInvalidateWeakPtrs();
509 return;
510 }
440 } 511 }
441 512
442 if (process_status.exit_code == kRebootRequiredExitCode) { 513 RecordCleanupResultHistogram(CLEANUP_RESULT_FAILED);
443 SetStateAndNotifyObservers(State::kRebootRequired);
444 return;
445 }
446
447 if (process_status.exit_code == kRebootNotRequiredExitCode) {
448 delegate_->ResetTaggedProfiles(
449 g_browser_process->profile_manager()->GetLoadedProfiles(),
450 base::BindOnce(&ChromeCleanerController::OnSettingsResetCompleted,
451 base::Unretained(this)));
452 ResetCleanerDataAndInvalidateWeakPtrs();
453 return;
454 }
455
456 idle_reason_ = IdleReason::kCleaningFailed; 514 idle_reason_ = IdleReason::kCleaningFailed;
457 SetStateAndNotifyObservers(State::kIdle); 515 SetStateAndNotifyObservers(State::kIdle);
458 } 516 }
459 517
460 void ChromeCleanerController::InitiateReboot() { 518 void ChromeCleanerController::InitiateReboot() {
461 DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); 519 DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
462 520
463 installer::ScopedTokenPrivilege scoped_se_shutdown_privilege( 521 installer::ScopedTokenPrivilege scoped_se_shutdown_privilege(
464 SE_SHUTDOWN_NAME); 522 SE_SHUTDOWN_NAME);
465 if (!scoped_se_shutdown_privilege.is_enabled() || 523 if (!scoped_se_shutdown_privilege.is_enabled() ||
466 !::ExitWindowsEx(EWX_REBOOT, SHTDN_REASON_MAJOR_SOFTWARE | 524 !::ExitWindowsEx(EWX_REBOOT, SHTDN_REASON_MAJOR_SOFTWARE |
467 SHTDN_REASON_MINOR_OTHER | 525 SHTDN_REASON_MINOR_OTHER |
468 SHTDN_REASON_FLAG_PLANNED)) { 526 SHTDN_REASON_FLAG_PLANNED)) {
469 for (auto& observer : observer_list_) 527 for (auto& observer : observer_list_)
470 observer.OnRebootFailed(); 528 observer.OnRebootFailed();
471 } 529 }
472 } 530 }
473 531
474 void ChromeCleanerController::OnSettingsResetCompleted() { 532 void ChromeCleanerController::OnSettingsResetCompleted() {
475 idle_reason_ = IdleReason::kCleaningSucceeded; 533 idle_reason_ = IdleReason::kCleaningSucceeded;
476 SetStateAndNotifyObservers(State::kIdle); 534 SetStateAndNotifyObservers(State::kIdle);
477 } 535 }
478 536
479 } // namespace safe_browsing 537 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698