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 <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 const char kFoundUwsReadErrorMetricName[] = | 88 const char kFoundUwsReadErrorMetricName[] = |
89 "SoftwareReporter.FoundUwSReadError"; | 89 "SoftwareReporter.FoundUwSReadError"; |
90 const char kScanTimesMetricName[] = "SoftwareReporter.UwSScanTimes"; | 90 const char kScanTimesMetricName[] = "SoftwareReporter.UwSScanTimes"; |
91 const char kMemoryUsedMetricName[] = "SoftwareReporter.MemoryUsed"; | 91 const char kMemoryUsedMetricName[] = "SoftwareReporter.MemoryUsed"; |
92 | 92 |
93 void DisplaySRTPrompt(const base::FilePath& download_path) { | 93 void DisplaySRTPrompt(const base::FilePath& download_path) { |
94 // Find the last active browser, which may be NULL, in which case we won't | 94 // Find the last active browser, which may be NULL, in which case we won't |
95 // show the prompt this time and will wait until the next run of the | 95 // show the prompt this time and will wait until the next run of the |
96 // reporter. We can't use other ways of finding a browser because we don't | 96 // reporter. We can't use other ways of finding a browser because we don't |
97 // have a profile. | 97 // have a profile. |
98 chrome::HostDesktopType desktop_type = chrome::GetActiveDesktop(); | |
99 Browser* browser = chrome::FindLastActive(); | 98 Browser* browser = chrome::FindLastActive(); |
100 if (!browser) | 99 if (!browser) |
101 return; | 100 return; |
102 | 101 |
103 Profile* profile = browser->profile(); | 102 Profile* profile = browser->profile(); |
104 DCHECK(profile); | 103 DCHECK(profile); |
105 | 104 |
106 // Make sure we have a tabbed browser since we need to anchor the bubble to | 105 // Make sure we have a tabbed browser since we need to anchor the bubble to |
107 // the toolbar's wrench menu. Create one if none exist already. | 106 // the toolbar's wrench menu. Create one if none exist already. |
108 if (browser->type() != Browser::TYPE_TABBED) { | 107 if (browser->type() != Browser::TYPE_TABBED) { |
109 browser = chrome::FindTabbedBrowser(profile, false); | 108 browser = chrome::FindTabbedBrowser(profile, false); |
110 if (!browser) | 109 if (!browser) |
111 browser = new Browser(Browser::CreateParams(profile, desktop_type)); | 110 browser = new Browser(Browser::CreateParams(profile)); |
112 } | 111 } |
113 GlobalErrorService* global_error_service = | 112 GlobalErrorService* global_error_service = |
114 GlobalErrorServiceFactory::GetForProfile(profile); | 113 GlobalErrorServiceFactory::GetForProfile(profile); |
115 SRTGlobalError* global_error = | 114 SRTGlobalError* global_error = |
116 new SRTGlobalError(global_error_service, download_path); | 115 new SRTGlobalError(global_error_service, download_path); |
117 | 116 |
118 // Ownership of |global_error| is passed to the service. The error removes | 117 // Ownership of |global_error| is passed to the service. The error removes |
119 // itself from the service and self-destructs when done. | 118 // itself from the service and self-destructs when done. |
120 global_error_service->AddGlobalError(global_error); | 119 global_error_service->AddGlobalError(global_error); |
121 | 120 |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 | 629 |
631 void SetReporterLauncherForTesting(const ReporterLauncher& reporter_launcher) { | 630 void SetReporterLauncherForTesting(const ReporterLauncher& reporter_launcher) { |
632 g_reporter_launcher_ = reporter_launcher; | 631 g_reporter_launcher_ = reporter_launcher; |
633 } | 632 } |
634 | 633 |
635 void SetPromptTriggerForTesting(const PromptTrigger& prompt_trigger) { | 634 void SetPromptTriggerForTesting(const PromptTrigger& prompt_trigger) { |
636 g_prompt_trigger_ = prompt_trigger; | 635 g_prompt_trigger_ = prompt_trigger; |
637 } | 636 } |
638 | 637 |
639 } // namespace safe_browsing | 638 } // namespace safe_browsing |
OLD | NEW |