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/safe_browsing/srt_fetcher_win.h" | 5 #include "chrome/browser/safe_browsing/srt_fetcher_win.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 112 | 112 |
| 113 const char kFoundUwsMetricName[] = "SoftwareReporter.FoundUwS"; | 113 const char kFoundUwsMetricName[] = "SoftwareReporter.FoundUwS"; |
| 114 const char kFoundUwsReadErrorMetricName[] = | 114 const char kFoundUwsReadErrorMetricName[] = |
| 115 "SoftwareReporter.FoundUwSReadError"; | 115 "SoftwareReporter.FoundUwSReadError"; |
| 116 const char kScanTimesMetricName[] = "SoftwareReporter.UwSScanTimes"; | 116 const char kScanTimesMetricName[] = "SoftwareReporter.UwSScanTimes"; |
| 117 const char kMemoryUsedMetricName[] = "SoftwareReporter.MemoryUsed"; | 117 const char kMemoryUsedMetricName[] = "SoftwareReporter.MemoryUsed"; |
| 118 | 118 |
| 119 // Reports metrics about the software reporter via UMA (and sometimes Rappor). | 119 // Reports metrics about the software reporter via UMA (and sometimes Rappor). |
| 120 class UMAHistogramReporter { | 120 class UMAHistogramReporter { |
| 121 public: | 121 public: |
| 122 explicit UMAHistogramReporter(const std::string& suffix = std::string()) | 122 UMAHistogramReporter() : UMAHistogramReporter(std::string()) {} |
| 123 | |
| 124 explicit UMAHistogramReporter(const std::string& suffix) | |
| 123 : suffix_(suffix), | 125 : suffix_(suffix), |
| 124 registry_key_(suffix.empty() ? kSoftwareRemovalToolRegistryKey | 126 registry_key_(suffix.empty() ? kSoftwareRemovalToolRegistryKey |
| 125 : base::StringPrintf( | 127 : base::StringPrintf( |
| 126 L"%ls\\%ls", | 128 L"%ls\\%ls", |
| 127 kSoftwareRemovalToolRegistryKey, | 129 kSoftwareRemovalToolRegistryKey, |
| 128 base::UTF8ToUTF16(suffix).c_str())) { | 130 base::UTF8ToUTF16(suffix).c_str())) { |
| 129 } | 131 } |
| 130 | 132 |
| 131 // Reports the software reporter tool's version via UMA. | 133 // Reports the software reporter tool's version via UMA. |
| 132 void ReportVersion(const base::Version& version) const { | 134 void ReportVersion(const base::Version& version) const { |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 575 prefs->SetString(prefs::kSwReporterPromptVersion, | 577 prefs->SetString(prefs::kSwReporterPromptVersion, |
| 576 reporter_version.GetString()); | 578 reporter_version.GetString()); |
| 577 | 579 |
| 578 // Download the SRT. | 580 // Download the SRT. |
| 579 RecordReporterStepHistogram(SW_REPORTER_DOWNLOAD_START); | 581 RecordReporterStepHistogram(SW_REPORTER_DOWNLOAD_START); |
| 580 | 582 |
| 581 // All the work happens in the self-deleting class below. | 583 // All the work happens in the self-deleting class below. |
| 582 new SRTFetcher(profile); | 584 new SRTFetcher(profile); |
| 583 } | 585 } |
| 584 | 586 |
| 585 // This class tries to run the reporter and reacts to its exit code. It | 587 // This class tries to run the reporter and reacts to its exit code. It |
|
grt (UTC plus 2)
2016/09/02 10:19:57
update comment: "the reporter" is no longer accura
Joe Mason
2016/09/02 21:14:35
Done.
| |
| 586 // schedules subsequent runs as needed, or retries as soon as a browser is | 588 // schedules subsequent runs as needed, or retries as soon as a browser is |
| 587 // available when none is on first try. | 589 // available when none is on first try. |
| 588 class ReporterRunner : public chrome::BrowserListObserver { | 590 class ReporterRunner : public chrome::BrowserListObserver { |
| 589 public: | 591 public: |
| 590 // Starts the sequence of attempts to run the reporter. | 592 // Starts the sequence of attempts to run the reporter. |
|
grt (UTC plus 2)
2016/09/02 10:19:57
"reporters" (please update all comments accordingl
Joe Mason
2016/09/02 21:14:34
Done.
| |
| 591 static void Run(const SwReporterInvocation& invocation, | 593 static void Run(std::unique_ptr<SwReporterQueue> invocations, |
| 592 const base::Version& version, | 594 const base::Version& version, |
| 593 scoped_refptr<base::TaskRunner> main_thread_task_runner, | 595 scoped_refptr<base::TaskRunner> main_thread_task_runner, |
| 594 scoped_refptr<base::TaskRunner> blocking_task_runner) { | 596 scoped_refptr<base::TaskRunner> blocking_task_runner) { |
| 595 if (!instance_) | 597 if (!instance_) |
| 596 instance_ = new ReporterRunner; | 598 instance_ = new ReporterRunner; |
| 597 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 599 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 600 DCHECK(invocations); | |
| 598 // There's nothing to do if the path and version of the reporter has not | 601 // There's nothing to do if the path and version of the reporter has not |
| 599 // changed, we just keep running the tasks that are running now. | 602 // changed, we just keep running the tasks that are running now. |
| 600 if (instance_->invocation_ == invocation && instance_->version_.IsValid() && | 603 if (instance_->invocations_ && *instance_->invocations_ == *invocations && |
|
grt (UTC plus 2)
2016/09/02 10:19:57
now that i've taken more time to grok ReporterRunn
Joe Mason
2016/09/02 21:14:35
I don't think this is any clearer than using a que
grt (UTC plus 2)
2016/09/04 10:35:44
yes, duplicate state is bad. could all state be in
macourteau
2016/09/12 19:53:15
Done.
| |
| 601 instance_->version_ == version) | 604 instance_->version_.IsValid() && instance_->version_ == version) |
| 602 return; | 605 return; |
| 603 | 606 |
| 604 instance_->invocation_ = invocation; | 607 instance_->invocations_ = std::move(invocations); |
| 605 instance_->version_ = version; | 608 instance_->version_ = version; |
| 606 instance_->main_thread_task_runner_ = std::move(main_thread_task_runner); | 609 instance_->main_thread_task_runner_ = std::move(main_thread_task_runner); |
| 607 instance_->blocking_task_runner_ = std::move(blocking_task_runner); | 610 instance_->blocking_task_runner_ = std::move(blocking_task_runner); |
| 608 | 611 |
| 609 if (instance_->first_run_) { | 612 if (instance_->first_run_) { |
| 610 instance_->first_run_ = false; | 613 instance_->first_run_ = false; |
| 611 instance_->TryToRun(); | 614 instance_->TryToRun(); |
| 612 } | 615 } |
| 613 } | 616 } |
| 614 | 617 |
| 615 private: | 618 private: |
| 616 ReporterRunner() {} | 619 ReporterRunner() {} |
| 617 ~ReporterRunner() override {} | 620 ~ReporterRunner() override {} |
| 618 | 621 |
| 619 // BrowserListObserver. | 622 // BrowserListObserver. |
| 620 void OnBrowserSetLastActive(Browser* browser) override {} | 623 void OnBrowserSetLastActive(Browser* browser) override {} |
| 621 void OnBrowserRemoved(Browser* browser) override {} | 624 void OnBrowserRemoved(Browser* browser) override {} |
| 622 void OnBrowserAdded(Browser* browser) override { | 625 void OnBrowserAdded(Browser* browser) override { |
| 623 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 626 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 624 DCHECK(browser); | 627 DCHECK(browser); |
| 625 MaybeFetchSRT(browser, version_); | 628 MaybeFetchSRT(browser, version_); |
| 626 BrowserList::RemoveObserver(this); | 629 BrowserList::RemoveObserver(this); |
| 627 } | 630 } |
| 628 | 631 |
| 632 // Launches the command line at the head of the queue. | |
| 633 void LaunchNextInvocation(std::unique_ptr<SwReporterQueue> invocations) { | |
|
grt (UTC plus 2)
2016/09/02 10:19:57
nit: "ScheduleNextInvocation" is more fitting
Joe Mason
2016/09/02 21:14:35
I disagree. It posts a task to do the (synchronous
grt (UTC plus 2)
2016/09/04 10:35:44
...which is another way of saying it schedules it
macourteau
2016/09/12 19:53:15
Done.
| |
| 634 DCHECK(invocations); | |
| 635 DCHECK(!invocations->empty()); | |
| 636 auto next_invocation = invocations->front(); | |
| 637 invocations->pop(); | |
| 638 | |
| 639 if (g_testing_delegate_) | |
| 640 g_testing_delegate_->NotifyLaunchReady(); | |
| 641 | |
| 642 // It's OK to simply |PostTaskAndReplyWithResult| so that | |
| 643 // |LaunchAndWaitForExit| doesn't need to access |main_thread_task_runner_| | |
|
grt (UTC plus 2)
2016/09/02 10:19:58
i find the use of task runners for the main/UI thr
Joe Mason
2016/09/02 21:14:35
Agreed. But I don't think I should be changing the
grt (UTC plus 2)
2016/09/04 10:35:44
Ack.
| |
| 644 // since the callback is not delayed and the test task runner won't need to | |
| 645 // force it. | |
| 646 base::PostTaskAndReplyWithResult( | |
| 647 blocking_task_runner_.get(), FROM_HERE, | |
| 648 | |
| 649 // Send the head of the queue to the launch callback. | |
| 650 base::Bind(&LaunchAndWaitForExit, next_invocation), | |
| 651 | |
| 652 // Send the tail of the queue to the next callback, which will handle | |
| 653 // the results of the first launch and then recursively launch | |
| 654 // everything in the tail. | |
| 655 base::Bind(&ReporterRunner::ReporterDone, base::Unretained(this), | |
| 656 base::Time::Now(), version_, next_invocation, | |
| 657 base::Passed(std::move(invocations)))); | |
| 658 } | |
| 659 | |
| 629 // This method is called on the UI thread when the reporter run has completed. | 660 // This method is called on the UI thread when the reporter run has completed. |
|
grt (UTC plus 2)
2016/09/02 10:19:57
"the reporter" -> "a reporter"
Joe Mason
2016/09/02 21:14:34
Done.
| |
| 630 // This is run as a task posted from an interruptible worker thread so should | 661 // This is run as a task posted from an interruptible worker thread so should |
| 631 // be resilient to unexpected shutdown. | 662 // be resilient to unexpected shutdown. |
| 632 void ReporterDone(const base::Time& reporter_start_time, | 663 void ReporterDone(const base::Time& reporter_start_time, |
| 633 const base::Version& version, | 664 const base::Version& version, |
| 634 const SwReporterInvocation& finished_invocation, | 665 const SwReporterInvocation& finished_invocation, |
| 666 std::unique_ptr<SwReporterQueue> remaining_invocations, | |
| 635 int exit_code) { | 667 int exit_code) { |
| 636 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 668 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 637 | 669 |
| 638 if (g_testing_delegate_) | 670 if (g_testing_delegate_) |
| 639 g_testing_delegate_->NotifyReporterDone(); | 671 g_testing_delegate_->NotifyReporterDone(); |
| 640 | 672 |
| 641 base::TimeDelta reporter_running_time = | 673 base::TimeDelta reporter_running_time = |
| 642 base::Time::Now() - reporter_start_time; | 674 base::Time::Now() - reporter_start_time; |
| 643 // Don't continue when the reporter process failed to launch, but still try | 675 |
| 644 // again after the regular delay. It's not worth retrying earlier, risking | 676 // Don't continue the current queue of reporters if one failed to launch. |
| 645 // running too often if it always fails, since not many users fail here. | 677 // As soon as we're not running this queue, schedule the next overall queue |
| 646 main_thread_task_runner_->PostDelayedTask( | 678 // run after the regular delay. (If there was a failure it's not worth |
| 647 FROM_HERE, | 679 // retrying earlier, risking running too often if it always fails, since |
| 648 base::Bind(&ReporterRunner::TryToRun, base::Unretained(this)), | 680 // not many users fail here.) |
| 649 base::TimeDelta::FromDays(days_between_reporter_runs_)); | 681 if (!remaining_invocations->empty() && |
| 682 exit_code != kReporterFailureExitCode) { | |
| 683 LaunchNextInvocation(std::move(remaining_invocations)); | |
| 684 } else { | |
| 685 main_thread_task_runner_->PostDelayedTask( | |
| 686 FROM_HERE, | |
| 687 base::Bind(&ReporterRunner::TryToRun, base::Unretained(this)), | |
| 688 base::TimeDelta::FromDays(days_between_reporter_runs_)); | |
| 689 } | |
| 690 | |
| 691 // If the reporter failed to launch, do not process the results. (The exit | |
| 692 // code itself doesn't need to be logged in this case because | |
| 693 // SW_REPORTER_FAILED_TO_START is logged in |LaunchAndWaitForExit|.) | |
| 650 if (exit_code == kReporterFailureExitCode) | 694 if (exit_code == kReporterFailureExitCode) |
| 651 return; | 695 return; |
| 652 | 696 |
| 653 UMAHistogramReporter uma(finished_invocation.suffix); | 697 UMAHistogramReporter uma(finished_invocation.suffix); |
| 654 uma.ReportVersion(version); | 698 uma.ReportVersion(version); |
| 655 uma.ReportExitCode(exit_code); | 699 uma.ReportExitCode(exit_code); |
| 656 uma.ReportFoundUwS(!finished_invocation.is_experimental /*use_rappor*/); | 700 uma.ReportFoundUwS(finished_invocation.flags & |
| 701 SwReporterInvocation::FLAG_LOG_TO_RAPPOR); | |
| 657 | 702 |
| 658 // Only save results from the canonical version of the software. | 703 // Only save results from the canonical version of the software. |
| 659 PrefService* local_state = g_browser_process->local_state(); | 704 PrefService* local_state = g_browser_process->local_state(); |
| 660 if (local_state && !finished_invocation.is_experimental) { | 705 if (local_state && |
| 706 (finished_invocation.flags & SwReporterInvocation::FLAG_LOG_TO_PREFS)) { | |
| 661 local_state->SetInteger(prefs::kSwReporterLastExitCode, exit_code); | 707 local_state->SetInteger(prefs::kSwReporterLastExitCode, exit_code); |
| 662 local_state->SetInt64(prefs::kSwReporterLastTimeTriggered, | 708 local_state->SetInt64(prefs::kSwReporterLastTimeTriggered, |
| 663 base::Time::Now().ToInternalValue()); | 709 base::Time::Now().ToInternalValue()); |
| 664 } | 710 } |
| 665 uma.ReportRuntime(reporter_running_time); | 711 uma.ReportRuntime(reporter_running_time); |
| 666 uma.ReportScanTimes(); | 712 uma.ReportScanTimes(); |
| 667 uma.ReportMemoryUsage(); | 713 uma.ReportMemoryUsage(); |
| 668 | 714 |
| 669 // Only continue to launch the prompt for the canonical version. | 715 if (!(finished_invocation.flags & |
| 670 if (finished_invocation.is_experimental) | 716 SwReporterInvocation::FLAG_TRIGGER_PROMPT)) |
| 671 return; | 717 return; |
| 672 | 718 |
| 673 if (!IsInSRTPromptFieldTrialGroups()) { | 719 if (!IsInSRTPromptFieldTrialGroups()) { |
| 674 // Knowing about disabled field trial is more important than reporter not | 720 // Knowing about disabled field trial is more important than reporter not |
| 675 // finding anything to remove, so check this case first. | 721 // finding anything to remove, so check this case first. |
| 676 RecordReporterStepHistogram(SW_REPORTER_NO_PROMPT_FIELD_TRIAL); | 722 RecordReporterStepHistogram(SW_REPORTER_NO_PROMPT_FIELD_TRIAL); |
| 677 return; | 723 return; |
| 678 } | 724 } |
| 679 | 725 |
| 680 if (exit_code != kSwReporterPostRebootCleanupNeeded && | 726 if (exit_code != kSwReporterPostRebootCleanupNeeded && |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 699 } | 745 } |
| 700 | 746 |
| 701 void TryToRun() { | 747 void TryToRun() { |
| 702 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 748 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 703 PrefService* local_state = g_browser_process->local_state(); | 749 PrefService* local_state = g_browser_process->local_state(); |
| 704 if (!version_.IsValid() || !local_state) { | 750 if (!version_.IsValid() || !local_state) { |
| 705 DCHECK(first_run_); | 751 DCHECK(first_run_); |
| 706 return; | 752 return; |
| 707 } | 753 } |
| 708 | 754 |
| 709 // Run the reporter if it hasn't been triggered in the last | 755 // Run the reporter if it hasn't been triggered in the last |
|
grt (UTC plus 2)
2016/09/02 10:19:57
// Starts running the reporters if they haven't be
Joe Mason
2016/09/02 21:14:34
Done.
| |
| 710 // |days_between_reporter_runs_| days, which depends if there is a pending | 756 // |days_between_reporter_runs_| days, which depends if there is a pending |
| 711 // prompt to be added to Chrome's menu. | 757 // prompt to be added to Chrome's menu. |
| 712 if (local_state->GetBoolean(prefs::kSwReporterPendingPrompt)) { | 758 if (local_state->GetBoolean(prefs::kSwReporterPendingPrompt)) { |
| 713 days_between_reporter_runs_ = kDaysBetweenSwReporterRunsForPendingPrompt; | 759 days_between_reporter_runs_ = kDaysBetweenSwReporterRunsForPendingPrompt; |
| 714 RecordReporterStepHistogram(SW_REPORTER_RAN_DAILY); | 760 RecordReporterStepHistogram(SW_REPORTER_RAN_DAILY); |
| 715 } else { | 761 } else { |
| 716 days_between_reporter_runs_ = kDaysBetweenSuccessfulSwReporterRuns; | 762 days_between_reporter_runs_ = kDaysBetweenSuccessfulSwReporterRuns; |
| 717 } | 763 } |
| 718 const base::Time last_time_triggered = base::Time::FromInternalValue( | 764 const base::Time last_time_triggered = base::Time::FromInternalValue( |
| 719 local_state->GetInt64(prefs::kSwReporterLastTimeTriggered)); | 765 local_state->GetInt64(prefs::kSwReporterLastTimeTriggered)); |
| 720 base::TimeDelta next_trigger_delay( | 766 base::TimeDelta next_trigger_delay( |
| 721 last_time_triggered + | 767 last_time_triggered + |
| 722 base::TimeDelta::FromDays(days_between_reporter_runs_) - | 768 base::TimeDelta::FromDays(days_between_reporter_runs_) - |
| 723 base::Time::Now()); | 769 base::Time::Now()); |
| 724 if (next_trigger_delay.ToInternalValue() <= 0 || | 770 DCHECK(invocations_); |
| 725 // Also make sure the kSwReporterLastTimeTriggered value is not set in | 771 if (!invocations_->empty() && |
| 726 // the future. | 772 (next_trigger_delay.ToInternalValue() <= 0 || |
|
grt (UTC plus 2)
2016/09/02 10:19:57
don't convert a time or timedelta to its internal
Joe Mason
2016/09/02 21:14:35
Done.
| |
| 727 last_time_triggered > base::Time::Now()) { | 773 // Also make sure the kSwReporterLastTimeTriggered value is not set in |
| 728 if (g_testing_delegate_) | 774 // the future. |
| 729 g_testing_delegate_->NotifyLaunchReady(); | 775 last_time_triggered > base::Time::Now())) { |
| 730 | 776 // Make a copy of the queue, since LaunchNextInvocation will pop items |
| 731 // It's OK to simply |PostTaskAndReplyWithResult| so that | 777 // from it. We need to save the full original for the comparison in |
| 732 // |LaunchAndWaitForExit| doesn't need to access | 778 // Run. |
| 733 // |main_thread_task_runner_| since the callback is not delayed and the | 779 LaunchNextInvocation(std::make_unique<SwReporterQueue>(*invocations_)); |
| 734 // test task runner won't need to force it. | |
| 735 base::PostTaskAndReplyWithResult( | |
| 736 blocking_task_runner_.get(), FROM_HERE, | |
| 737 base::Bind(&LaunchAndWaitForExit, invocation_), | |
| 738 base::Bind(&ReporterRunner::ReporterDone, base::Unretained(this), | |
| 739 base::Time::Now(), version_, invocation_)); | |
| 740 } else { | 780 } else { |
| 741 main_thread_task_runner_->PostDelayedTask( | 781 main_thread_task_runner_->PostDelayedTask( |
| 742 FROM_HERE, | 782 FROM_HERE, |
| 743 base::Bind(&ReporterRunner::TryToRun, base::Unretained(this)), | 783 base::Bind(&ReporterRunner::TryToRun, base::Unretained(this)), |
| 744 next_trigger_delay); | 784 next_trigger_delay); |
| 745 } | 785 } |
| 746 } | 786 } |
| 747 | 787 |
| 748 bool first_run_ = true; | 788 bool first_run_ = true; |
| 749 SwReporterInvocation invocation_; | 789 std::unique_ptr<SwReporterQueue> invocations_; |
| 750 base::Version version_; | 790 base::Version version_; |
| 751 scoped_refptr<base::TaskRunner> main_thread_task_runner_; | 791 scoped_refptr<base::TaskRunner> main_thread_task_runner_; |
| 752 scoped_refptr<base::TaskRunner> blocking_task_runner_; | 792 scoped_refptr<base::TaskRunner> blocking_task_runner_; |
| 753 | 793 |
| 754 // This value is used to identify how long to wait before starting a new run | 794 // This value is used to identify how long to wait before starting a new run |
| 755 // of the reporter. It's initialized with the default value and may be changed | 795 // of the reporter. It's initialized with the default value and may be changed |
| 756 // to a different value when a prompt is pending and the reporter should be | 796 // to a different value when a prompt is pending and the reporter should be |
| 757 // run before adding the global error to the Chrome menu. | 797 // run before adding the global error to the Chrome menu. |
| 758 int days_between_reporter_runs_ = kDaysBetweenSuccessfulSwReporterRuns; | 798 int days_between_reporter_runs_ = kDaysBetweenSuccessfulSwReporterRuns; |
| 759 | 799 |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 779 | 819 |
| 780 SwReporterInvocation SwReporterInvocation::FromCommandLine( | 820 SwReporterInvocation SwReporterInvocation::FromCommandLine( |
| 781 const base::CommandLine& command_line) { | 821 const base::CommandLine& command_line) { |
| 782 SwReporterInvocation invocation; | 822 SwReporterInvocation invocation; |
| 783 invocation.command_line = command_line; | 823 invocation.command_line = command_line; |
| 784 return invocation; | 824 return invocation; |
| 785 } | 825 } |
| 786 | 826 |
| 787 bool SwReporterInvocation::operator==(const SwReporterInvocation& other) const { | 827 bool SwReporterInvocation::operator==(const SwReporterInvocation& other) const { |
| 788 return command_line.argv() == other.command_line.argv() && | 828 return command_line.argv() == other.command_line.argv() && |
| 789 suffix == other.suffix && is_experimental == other.is_experimental; | 829 suffix == other.suffix && flags == other.flags; |
| 790 } | 830 } |
| 791 | 831 |
| 792 void RunSwReporter(const SwReporterInvocation& invocation, | 832 void RunSwReporters(std::unique_ptr<SwReporterQueue> invocations, |
| 793 const base::Version& version, | 833 const base::Version& version, |
| 794 scoped_refptr<base::TaskRunner> main_thread_task_runner, | 834 scoped_refptr<base::TaskRunner> main_thread_task_runner, |
| 795 scoped_refptr<base::TaskRunner> blocking_task_runner) { | 835 scoped_refptr<base::TaskRunner> blocking_task_runner) { |
| 796 ReporterRunner::Run(invocation, version, std::move(main_thread_task_runner), | 836 ReporterRunner::Run(std::move(invocations), version, |
|
grt (UTC plus 2)
2016/09/02 10:19:58
? DCHECK(!invocations->empty());
why would it be
Joe Mason
2016/09/02 21:14:34
There's a DCHECK for that at the top of ReporterRu
grt (UTC plus 2)
2016/09/04 10:35:44
is there? i see one that DCHECKs that the pointer
macourteau
2016/09/12 19:53:15
Done.
| |
| 837 std::move(main_thread_task_runner), | |
| 797 std::move(blocking_task_runner)); | 838 std::move(blocking_task_runner)); |
| 798 } | 839 } |
| 799 | 840 |
| 800 bool ReporterFoundUws() { | 841 bool ReporterFoundUws() { |
| 801 PrefService* local_state = g_browser_process->local_state(); | 842 PrefService* local_state = g_browser_process->local_state(); |
| 802 if (!local_state) | 843 if (!local_state) |
| 803 return false; | 844 return false; |
| 804 int exit_code = local_state->GetInteger(prefs::kSwReporterLastExitCode); | 845 int exit_code = local_state->GetInteger(prefs::kSwReporterLastExitCode); |
| 805 return exit_code == kSwReporterCleanupNeeded; | 846 return exit_code == kSwReporterCleanupNeeded; |
| 806 } | 847 } |
| 807 | 848 |
| 808 bool UserHasRunCleaner() { | 849 bool UserHasRunCleaner() { |
| 809 base::string16 cleaner_key_path(kSoftwareRemovalToolRegistryKey); | 850 base::string16 cleaner_key_path(kSoftwareRemovalToolRegistryKey); |
| 810 cleaner_key_path.append(L"\\").append(kCleanerSubKey); | 851 cleaner_key_path.append(L"\\").append(kCleanerSubKey); |
| 811 | 852 |
| 812 base::win::RegKey srt_cleaner_key(HKEY_CURRENT_USER, cleaner_key_path.c_str(), | 853 base::win::RegKey srt_cleaner_key(HKEY_CURRENT_USER, cleaner_key_path.c_str(), |
| 813 KEY_QUERY_VALUE); | 854 KEY_QUERY_VALUE); |
| 814 | 855 |
| 815 return srt_cleaner_key.Valid() && srt_cleaner_key.GetValueCount() > 0; | 856 return srt_cleaner_key.Valid() && srt_cleaner_key.GetValueCount() > 0; |
| 816 } | 857 } |
| 817 | 858 |
| 818 void SetSwReporterTestingDelegate(SwReporterTestingDelegate* delegate) { | 859 void SetSwReporterTestingDelegate(SwReporterTestingDelegate* delegate) { |
| 819 g_testing_delegate_ = delegate; | 860 g_testing_delegate_ = delegate; |
| 820 } | 861 } |
| 821 | 862 |
| 822 } // namespace safe_browsing | 863 } // namespace safe_browsing |
| OLD | NEW |