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

Side by Side Diff: chrome/browser/safe_browsing/srt_fetcher_win.cc

Issue 2780873002: Basic IPC communication between Chrome and the SW Reporter. (Closed)
Patch Set: Fix typo Created 3 years, 8 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 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 <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
11 #include <utility> 11 #include <utility>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/bind_helpers.h" 15 #include "base/bind_helpers.h"
16 #include "base/callback_helpers.h" 16 #include "base/callback_helpers.h"
17 #include "base/command_line.h" 17 #include "base/command_line.h"
18 #include "base/debug/leak_annotations.h" 18 #include "base/debug/leak_annotations.h"
19 #include "base/files/file_path.h" 19 #include "base/files/file_path.h"
20 #include "base/macros.h" 20 #include "base/macros.h"
21 #include "base/memory/ptr_util.h" 21 #include "base/memory/ptr_util.h"
22 #include "base/metrics/field_trial.h" 22 #include "base/metrics/field_trial.h"
23 #include "base/metrics/histogram_macros.h" 23 #include "base/metrics/histogram_macros.h"
24 #include "base/metrics/sparse_histogram.h" 24 #include "base/metrics/sparse_histogram.h"
25 #include "base/process/launch.h"
26 #include "base/strings/string_number_conversions.h" 25 #include "base/strings/string_number_conversions.h"
27 #include "base/strings/stringprintf.h" 26 #include "base/strings/stringprintf.h"
28 #include "base/strings/utf_string_conversions.h" 27 #include "base/strings/utf_string_conversions.h"
29 #include "base/task_runner_util.h" 28 #include "base/task_runner_util.h"
30 #include "base/task_scheduler/post_task.h" 29 #include "base/task_scheduler/post_task.h"
31 #include "base/task_scheduler/task_traits.h" 30 #include "base/task_scheduler/task_traits.h"
32 #include "base/time/time.h" 31 #include "base/time/time.h"
33 #include "base/version.h" 32 #include "base/version.h"
34 #include "base/win/registry.h" 33 #include "base/win/registry.h"
35 #include "chrome/browser/browser_process.h" 34 #include "chrome/browser/browser_process.h"
36 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" 35 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h"
37 #include "chrome/browser/profiles/profile.h" 36 #include "chrome/browser/profiles/profile.h"
38 #include "chrome/browser/profiles/profile_io_data.h" 37 #include "chrome/browser/profiles/profile_io_data.h"
38 #include "chrome/browser/safe_browsing/srt_chrome_prompt_impl.h"
39 #include "chrome/browser/safe_browsing/srt_client_info_win.h" 39 #include "chrome/browser/safe_browsing/srt_client_info_win.h"
40 #include "chrome/browser/safe_browsing/srt_global_error_win.h" 40 #include "chrome/browser/safe_browsing/srt_global_error_win.h"
41 #include "chrome/browser/ui/browser_finder.h" 41 #include "chrome/browser/ui/browser_finder.h"
42 #include "chrome/browser/ui/browser_list.h" 42 #include "chrome/browser/ui/browser_list.h"
43 #include "chrome/browser/ui/browser_list_observer.h" 43 #include "chrome/browser/ui/browser_list_observer.h"
44 #include "chrome/browser/ui/global_error/global_error_service.h" 44 #include "chrome/browser/ui/global_error/global_error_service.h"
45 #include "chrome/browser/ui/global_error/global_error_service_factory.h" 45 #include "chrome/browser/ui/global_error/global_error_service_factory.h"
46 #include "chrome/common/pref_names.h" 46 #include "chrome/common/pref_names.h"
47 #include "components/chrome_cleaner/public/interfaces/chrome_prompt.mojom.h"
47 #include "components/component_updater/pref_names.h" 48 #include "components/component_updater/pref_names.h"
48 #include "components/data_use_measurement/core/data_use_user_data.h" 49 #include "components/data_use_measurement/core/data_use_user_data.h"
49 #include "components/prefs/pref_service.h" 50 #include "components/prefs/pref_service.h"
50 #include "components/variations/net/variations_http_headers.h" 51 #include "components/variations/net/variations_http_headers.h"
51 #include "components/version_info/version_info.h" 52 #include "components/version_info/version_info.h"
52 #include "content/public/browser/browser_thread.h" 53 #include "content/public/browser/browser_thread.h"
54 #include "mojo/edk/embedder/connection_params.h"
55 #include "mojo/edk/embedder/pending_process_connection.h"
56 #include "mojo/edk/embedder/platform_channel_pair.h"
57 #include "mojo/public/cpp/system/message_pipe.h"
53 #include "net/base/load_flags.h" 58 #include "net/base/load_flags.h"
54 #include "net/http/http_status_code.h" 59 #include "net/http/http_status_code.h"
55 #include "net/url_request/url_fetcher.h" 60 #include "net/url_request/url_fetcher.h"
56 #include "net/url_request/url_fetcher_delegate.h" 61 #include "net/url_request/url_fetcher_delegate.h"
57 #include "net/url_request/url_request_context_getter.h" 62 #include "net/url_request/url_request_context_getter.h"
58 63
59 using content::BrowserThread; 64 using content::BrowserThread;
60 65
61 namespace safe_browsing { 66 namespace safe_browsing {
62 67
63 // TODO(b/647763) Change the registry key to properly handle cases when the user 68 // TODO(b/647763) Change the registry key to properly handle cases when the user
64 // runs Google Chrome stable alongside Google Chrome SxS. 69 // runs Google Chrome stable alongside Google Chrome SxS.
65 const wchar_t kSoftwareRemovalToolRegistryKey[] = 70 const wchar_t kSoftwareRemovalToolRegistryKey[] =
66 L"Software\\Google\\Software Removal Tool"; 71 L"Software\\Google\\Software Removal Tool";
67 72
68 const wchar_t kCleanerSubKey[] = L"Cleaner"; 73 const wchar_t kCleanerSubKey[] = L"Cleaner";
69 74
70 const wchar_t kEndTimeValueName[] = L"EndTime"; 75 const wchar_t kEndTimeValueName[] = L"EndTime";
71 const wchar_t kStartTimeValueName[] = L"StartTime"; 76 const wchar_t kStartTimeValueName[] = L"StartTime";
72 77
78 const base::Feature kInBrowserCleanerUIFeature{
79 "InBrowserCleanerUI", base::FEATURE_DISABLED_BY_DEFAULT};
80
81 const char kChromeMojoPipeTokenSwitch[] = "chrome-mojo-pipe-token";
82
73 namespace { 83 namespace {
74 84
75 // Used to send UMA information about missing start and end time registry 85 // Used to send UMA information about missing start and end time registry
76 // values for the reporter. Replicated in the histograms.xml file, so the order 86 // values for the reporter. Replicated in the histograms.xml file, so the order
77 // MUST NOT CHANGE. 87 // MUST NOT CHANGE.
78 enum SwReporterRunningTimeRegistryError { 88 enum SwReporterRunningTimeRegistryError {
79 REPORTER_RUNNING_TIME_ERROR_NO_ERROR = 0, 89 REPORTER_RUNNING_TIME_ERROR_NO_ERROR = 0,
80 REPORTER_RUNNING_TIME_ERROR_REGISTRY_KEY_INVALID = 1, 90 REPORTER_RUNNING_TIME_ERROR_REGISTRY_KEY_INVALID = 1,
81 REPORTER_RUNNING_TIME_ERROR_MISSING_START_TIME = 2, 91 REPORTER_RUNNING_TIME_ERROR_MISSING_START_TIME = 2,
82 REPORTER_RUNNING_TIME_ERROR_MISSING_END_TIME = 3, 92 REPORTER_RUNNING_TIME_ERROR_MISSING_END_TIME = 3,
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 if (error->GetBubbleView()) { 556 if (error->GetBubbleView()) {
547 show_bubble = false; 557 show_bubble = false;
548 break; 558 break;
549 } 559 }
550 } 560 }
551 } 561 }
552 if (show_bubble) 562 if (show_bubble)
553 global_error->ShowBubbleView(browser); 563 global_error->ShowBubbleView(browser);
554 } 564 }
555 565
556 // This function is called from a worker thread to launch the SwReporter and 566 // Class responsible for launching the reporter process and waiting for its
Jialiu Lin 2017/04/10 17:32:54 optional: maybe moving this class into separate fi
ftirelo 2017/04/11 17:31:43 For the moment, this class can be considered an im
557 // wait for termination to collect its exit code. This task could be 567 // completion. If feature InBrowserCleanerUI is enabled, this object will also
558 // interrupted by a shutdown at any time, so it shouldn't depend on anything 568 // be responsible for starting the ChromePromptImpl object on the IO thread and
559 // external that could be shut down beforehand. 569 // controlling its lifetime.
560 int LaunchAndWaitForExit(const SwReporterInvocation& invocation) { 570 //
561 if (g_testing_delegate_) 571 // Expected lifecycle of a SwReporterProcess:
562 return g_testing_delegate_->LaunchReporter(invocation); 572 // - created on the UI thread before the reporter process launch is posted
573 // (method ScheduleNextInvocation);
574 // - deleted on the UI thread once ReporterDone() finishes (the method is
575 // called after the reporter process exits).
576 //
577 // If feature InBrowserCleanerUI feature is enabled, the following tasks will
578 // be posted in sequence to the IO Thread and will retain the SwReporterProcess
579 // object:
580 // - creation of a ChromePromptImpl object right after the reporter process is
581 // launched (that object will be responsible for handling IPC requests from
582 // the reporter process);
583 // - deletion of the ChromePromptImpl object on ReporterDone().
584 // As a consequence, the SwReporterProcess object can outlive ReporterDone()
585 // and will only be deleted after the ChromePromptImpl object is released on
586 // the IO thread.
587 class SwReporterProcess : public base::RefCountedThreadSafe<SwReporterProcess> {
588 public:
589 explicit SwReporterProcess(const SwReporterInvocation& invocation)
590 : invocation_(invocation) {}
591 ~SwReporterProcess() = default;
592
593 // This function is called from a worker thread to launch the SwReporter and
594 // wait for termination to collect its exit code. This task could be
595 // interrupted by a shutdown at any time, so it shouldn't depend on anything
596 // external that could be shut down beforehand.
597 int LaunchAndWaitForExitOnBackgroundThread();
598
599 // Schedules to release the instance of ChromePromptImpl on the IO thread.
600 void OnReporterDone();
601
602 const SwReporterInvocation& invocation() const { return invocation_; }
603
604 private:
605 // Starts a new IPC service implementing the ChromePrompt interface and
606 // launches a new reporter process that can connect to the IPC.
607 base::Process LaunchConnectedReporterProcess();
608
609 // Starts a new instance of ChromePromptImpl to receive requests from the
610 // reporter. Must be run on the IO thread.
611 void CreateChromePromptImpl(mojo::ScopedMessagePipeHandle my_pipe);
612
613 // Releases the instance of ChromePromptImpl. Must be run on the IO thread.
614 void ReleaseChromePromptImpl();
615
616 // Launches a new process with the command line in the invocation and
617 // provided launch options. Uses g_testing_delegate_ if not null.
618 base::Process LaunchReporterProcess(
619 const SwReporterInvocation& invocation,
620 const base::LaunchOptions& launch_options);
621
622 // The invocation for the current reporter process.
623 SwReporterInvocation invocation_;
624
625 // Implementation of the ChromePrompt service to be used by the current
626 // reporter process. Can only be accessed on the IO thread.
627 std::unique_ptr<ChromePromptImpl> chrome_prompt_impl_;
628 };
629
630 int SwReporterProcess::LaunchAndWaitForExitOnBackgroundThread() {
563 base::Process reporter_process = 631 base::Process reporter_process =
564 base::LaunchProcess(invocation.command_line, base::LaunchOptions()); 632 base::FeatureList::IsEnabled(kInBrowserCleanerUIFeature)
633 ? LaunchConnectedReporterProcess()
634 : LaunchReporterProcess(invocation_, base::LaunchOptions());
635
565 // This exit code is used to identify that a reporter run didn't happen, so 636 // This exit code is used to identify that a reporter run didn't happen, so
566 // the result should be ignored and a rerun scheduled for the usual delay. 637 // the result should be ignored and a rerun scheduled for the usual delay.
567 int exit_code = kReporterFailureExitCode; 638 int exit_code = kReporterFailureExitCode;
568 UMAHistogramReporter uma(invocation.suffix); 639 UMAHistogramReporter uma(invocation_.suffix);
569 if (reporter_process.IsValid()) { 640 if (reporter_process.IsValid()) {
570 uma.RecordReporterStep(SW_REPORTER_START_EXECUTION); 641 uma.RecordReporterStep(SW_REPORTER_START_EXECUTION);
571 bool success = reporter_process.WaitForExit(&exit_code); 642 bool success = reporter_process.WaitForExit(&exit_code);
572 DCHECK(success); 643 DCHECK(success);
573 } else { 644 } else {
574 uma.RecordReporterStep(SW_REPORTER_FAILED_TO_START); 645 uma.RecordReporterStep(SW_REPORTER_FAILED_TO_START);
575 } 646 }
576 return exit_code; 647 return exit_code;
577 } 648 }
578 649
650 void SwReporterProcess::OnReporterDone() {
651 if (base::FeatureList::IsEnabled(kInBrowserCleanerUIFeature)) {
652 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)
653 ->PostTask(FROM_HERE,
654 base::Bind(&SwReporterProcess::ReleaseChromePromptImpl,
655 base::RetainedRef(this)));
656 }
657 }
658
659 base::Process SwReporterProcess::LaunchConnectedReporterProcess() {
660 DCHECK(base::FeatureList::IsEnabled(kInBrowserCleanerUIFeature));
661
662 mojo::edk::PendingProcessConnection pending_process_connection;
663 std::string mojo_pipe_token;
664 mojo::ScopedMessagePipeHandle mojo_pipe =
665 pending_process_connection.CreateMessagePipe(&mojo_pipe_token);
666 invocation_.command_line.AppendSwitchASCII(kChromeMojoPipeTokenSwitch,
667 mojo_pipe_token);
668
669 mojo::edk::PlatformChannelPair channel;
670 base::HandlesToInheritVector handles_to_inherit;
671 channel.PrepareToPassClientHandleToChildProcess(&invocation_.command_line,
672 &handles_to_inherit);
673
674 base::LaunchOptions launch_options;
675 launch_options.handles_to_inherit = &handles_to_inherit;
676 base::Process reporter_process =
677 LaunchReporterProcess(invocation_, launch_options);
678
679 if (!reporter_process.IsValid())
680 return reporter_process;
681
682 pending_process_connection.Connect(
683 reporter_process.Handle(),
684 mojo::edk::ConnectionParams(channel.PassServerHandle()));
685
686 // ChromePromptImpl tasks will need to run on the IO thread. There is no
687 // need to synchronize its creation, since the client end will wait for this
688 // initialization to be done before sending requests.
689 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)
690 ->PostTask(FROM_HERE,
691 base::Bind(&SwReporterProcess::CreateChromePromptImpl,
Ken Rockot(use gerrit already) 2017/04/10 21:44:40 nit: I think you could use BindOnce here and then
ftirelo 2017/04/11 17:31:43 Done.
692 base::RetainedRef(this), base::Passed(&mojo_pipe)));
693
694 return reporter_process;
695 }
696
697 base::Process SwReporterProcess::LaunchReporterProcess(
698 const SwReporterInvocation& invocation,
699 const base::LaunchOptions& launch_options) {
700 return g_testing_delegate_
701 ? g_testing_delegate_->LaunchReporter(invocation, launch_options)
702 : base::LaunchProcess(invocation.command_line, launch_options);
703 }
704
705 void SwReporterProcess::CreateChromePromptImpl(
706 mojo::ScopedMessagePipeHandle mojo_pipe) {
Ken Rockot(use gerrit already) 2017/04/10 21:44:40 nit: I'd make this arg a ChromePromptRequest rathe
ftirelo 2017/04/11 17:31:43 Done.
707 DCHECK_CURRENTLY_ON(BrowserThread::IO);
708 DCHECK(base::FeatureList::IsEnabled(kInBrowserCleanerUIFeature));
709
710 chrome_cleaner::mojom::ChromePromptRequest chrome_prompt_request;
711 chrome_prompt_request.Bind(std::move(mojo_pipe));
712 chrome_prompt_impl_ =
713 base::MakeUnique<ChromePromptImpl>(std::move(chrome_prompt_request));
714 }
715
716 void SwReporterProcess::ReleaseChromePromptImpl() {
717 DCHECK_CURRENTLY_ON(BrowserThread::IO);
718 DCHECK(base::FeatureList::IsEnabled(kInBrowserCleanerUIFeature));
719
720 chrome_prompt_impl_.release();
721 }
722
579 } // namespace 723 } // namespace
580 724
581 void DisplaySRTPromptForTesting(const base::FilePath& download_path) { 725 void DisplaySRTPromptForTesting(const base::FilePath& download_path) {
582 DisplaySRTPrompt(download_path); 726 DisplaySRTPrompt(download_path);
583 } 727 }
584 728
585 // Class that will attempt to download the SRT, showing the SRT notification 729 // Class that will attempt to download the SRT, showing the SRT notification
586 // bubble when the download operation is complete. Instances of SRTFetcher own 730 // bubble when the download operation is complete. Instances of SRTFetcher own
587 // themselves, they will self-delete on completion of the network request when 731 // themselves, they will self-delete on completion of the network request when
588 // OnURLFetchComplete is called. 732 // OnURLFetchComplete is called.
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 void ScheduleNextInvocation() { 908 void ScheduleNextInvocation() {
765 DCHECK(!current_invocations_.empty()); 909 DCHECK(!current_invocations_.empty());
766 auto next_invocation = current_invocations_.front(); 910 auto next_invocation = current_invocations_.front();
767 current_invocations_.pop(); 911 current_invocations_.pop();
768 912
769 AppendInvocationSpecificSwitches(&next_invocation); 913 AppendInvocationSpecificSwitches(&next_invocation);
770 914
771 base::TaskRunner* task_runner = 915 base::TaskRunner* task_runner =
772 g_testing_delegate_ ? g_testing_delegate_->BlockingTaskRunner() 916 g_testing_delegate_ ? g_testing_delegate_->BlockingTaskRunner()
773 : blocking_task_runner_.get(); 917 : blocking_task_runner_.get();
774 base::PostTaskAndReplyWithResult( 918 auto sw_reporter_process =
775 task_runner, FROM_HERE, 919 make_scoped_refptr(new SwReporterProcess(next_invocation));
776 base::Bind(&LaunchAndWaitForExit, next_invocation), 920 auto launch_and_wait =
921 base::Bind(&SwReporterProcess::LaunchAndWaitForExitOnBackgroundThread,
922 sw_reporter_process);
923 auto reporter_done =
777 base::Bind(&ReporterRunner::ReporterDone, base::Unretained(this), Now(), 924 base::Bind(&ReporterRunner::ReporterDone, base::Unretained(this), Now(),
778 version_, next_invocation)); 925 version_, std::move(sw_reporter_process));
926 base::PostTaskAndReplyWithResult(task_runner, FROM_HERE,
927 std::move(launch_and_wait),
928 std::move(reporter_done));
779 } 929 }
780 930
781 // This method is called on the UI thread when an invocation of the reporter 931 // This method is called on the UI thread when an invocation of the reporter
782 // has completed. This is run as a task posted from an interruptible worker 932 // has completed. This is run as a task posted from an interruptible worker
783 // thread so should be resilient to unexpected shutdown. 933 // thread so should be resilient to unexpected shutdown.
784 void ReporterDone(const base::Time& reporter_start_time, 934 void ReporterDone(const base::Time& reporter_start_time,
785 const base::Version& version, 935 const base::Version& version,
786 const SwReporterInvocation& finished_invocation, 936 scoped_refptr<SwReporterProcess> sw_reporter_process,
787 int exit_code) { 937 int exit_code) {
788 DCHECK_CURRENTLY_ON(BrowserThread::UI); 938 DCHECK_CURRENTLY_ON(BrowserThread::UI);
789 939
940 sw_reporter_process->OnReporterDone();
941
790 base::Time now = Now(); 942 base::Time now = Now();
791 base::TimeDelta reporter_running_time = now - reporter_start_time; 943 base::TimeDelta reporter_running_time = now - reporter_start_time;
792 944
793 // Don't continue the current queue of reporters if one failed to launch. 945 // Don't continue the current queue of reporters if one failed to launch.
794 if (exit_code == kReporterFailureExitCode) 946 if (exit_code == kReporterFailureExitCode)
795 current_invocations_ = SwReporterQueue(); 947 current_invocations_ = SwReporterQueue();
796 948
797 // As soon as we're not running this queue, schedule the next overall queue 949 // As soon as we're not running this queue, schedule the next overall queue
798 // run after the regular delay. (If there was a failure it's not worth 950 // run after the regular delay. (If there was a failure it's not worth
799 // retrying earlier, risking running too often if it always fails, since 951 // retrying earlier, risking running too often if it always fails, since
800 // not many users fail here.) 952 // not many users fail here.)
801 if (current_invocations_.empty()) { 953 if (current_invocations_.empty()) {
802 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 954 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
803 FROM_HERE, 955 FROM_HERE,
804 base::Bind(&ReporterRunner::TryToRun, base::Unretained(this)), 956 base::Bind(&ReporterRunner::TryToRun, base::Unretained(this)),
805 base::TimeDelta::FromDays(days_between_reporter_runs_)); 957 base::TimeDelta::FromDays(days_between_reporter_runs_));
806 } else { 958 } else {
807 ScheduleNextInvocation(); 959 ScheduleNextInvocation();
808 } 960 }
809 961
810 // If the reporter failed to launch, do not process the results. (The exit 962 // If the reporter failed to launch, do not process the results. (The exit
811 // code itself doesn't need to be logged in this case because 963 // code itself doesn't need to be logged in this case because
812 // SW_REPORTER_FAILED_TO_START is logged in |LaunchAndWaitForExit|.) 964 // SW_REPORTER_FAILED_TO_START is logged in
965 // |LaunchAndWaitForExitOnBackgroundThread|.)
813 if (exit_code == kReporterFailureExitCode) 966 if (exit_code == kReporterFailureExitCode)
814 return; 967 return;
815 968
969 const auto& finished_invocation = sw_reporter_process->invocation();
816 UMAHistogramReporter uma(finished_invocation.suffix); 970 UMAHistogramReporter uma(finished_invocation.suffix);
817 uma.ReportVersion(version); 971 uma.ReportVersion(version);
818 uma.ReportExitCode(exit_code); 972 uma.ReportExitCode(exit_code);
819 uma.ReportEngineErrorCode(); 973 uma.ReportEngineErrorCode();
820 uma.ReportFoundUwS(); 974 uma.ReportFoundUwS();
821 975
822 PrefService* local_state = g_browser_process->local_state(); 976 PrefService* local_state = g_browser_process->local_state();
823 if (local_state) { 977 if (local_state) {
824 if (finished_invocation.BehaviourIsSupported( 978 if (finished_invocation.BehaviourIsSupported(
825 SwReporterInvocation::BEHAVIOUR_LOG_EXIT_CODE_TO_PREFS)) { 979 SwReporterInvocation::BEHAVIOUR_LOG_EXIT_CODE_TO_PREFS)) {
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 // The queue of invocations that are currently running. 1140 // The queue of invocations that are currently running.
987 SwReporterQueue current_invocations_; 1141 SwReporterQueue current_invocations_;
988 1142
989 // The invocations to run next time the SwReporter is run. 1143 // The invocations to run next time the SwReporter is run.
990 SwReporterQueue pending_invocations_; 1144 SwReporterQueue pending_invocations_;
991 1145
992 base::Version version_; 1146 base::Version version_;
993 1147
994 scoped_refptr<base::TaskRunner> blocking_task_runner_ = 1148 scoped_refptr<base::TaskRunner> blocking_task_runner_ =
995 base::CreateTaskRunnerWithTraits( 1149 base::CreateTaskRunnerWithTraits(
996 // LaunchAndWaitForExit() creates (MayBlock()) and joins 1150 // LaunchAndWaitForExitOnBackgroundThread() creates (MayBlock()) and
997 // (WithBaseSyncPrimitives()) a process. 1151 // joins (WithBaseSyncPrimitives()) a process.
998 base::TaskTraits() 1152 base::TaskTraits()
999 .WithShutdownBehavior( 1153 .WithShutdownBehavior(
1000 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN) 1154 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN)
1001 .WithPriority(base::TaskPriority::BACKGROUND) 1155 .WithPriority(base::TaskPriority::BACKGROUND)
1002 .MayBlock() 1156 .MayBlock()
1003 .WithBaseSyncPrimitives()); 1157 .WithBaseSyncPrimitives());
1004 1158
1005 // This value is used to identify how long to wait before starting a new run 1159 // This value is used to identify how long to wait before starting a new run
1006 // of the reporter queue. It's initialized with the default value and may be 1160 // of the reporter queue. It's initialized with the default value and may be
1007 // changed to a different value when a prompt is pending and the reporter 1161 // changed to a different value when a prompt is pending and the reporter
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 return srt_cleaner_key.Open(HKEY_CURRENT_USER, cleaner_key_path.c_str(), 1226 return srt_cleaner_key.Open(HKEY_CURRENT_USER, cleaner_key_path.c_str(),
1073 KEY_QUERY_VALUE) == ERROR_SUCCESS && 1227 KEY_QUERY_VALUE) == ERROR_SUCCESS &&
1074 srt_cleaner_key.GetValueCount() > 0; 1228 srt_cleaner_key.GetValueCount() > 0;
1075 } 1229 }
1076 1230
1077 void SetSwReporterTestingDelegate(SwReporterTestingDelegate* delegate) { 1231 void SetSwReporterTestingDelegate(SwReporterTestingDelegate* delegate) {
1078 g_testing_delegate_ = delegate; 1232 g_testing_delegate_ = delegate;
1079 } 1233 }
1080 1234
1081 } // namespace safe_browsing 1235 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698