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 18 matching lines...) Expand all Loading... |
29 #include "chrome/browser/profiles/profile.h" | 29 #include "chrome/browser/profiles/profile.h" |
30 #include "chrome/browser/profiles/profile_io_data.h" | 30 #include "chrome/browser/profiles/profile_io_data.h" |
31 #include "chrome/browser/safe_browsing/srt_field_trial_win.h" | 31 #include "chrome/browser/safe_browsing/srt_field_trial_win.h" |
32 #include "chrome/browser/safe_browsing/srt_global_error_win.h" | 32 #include "chrome/browser/safe_browsing/srt_global_error_win.h" |
33 #include "chrome/browser/ui/browser_finder.h" | 33 #include "chrome/browser/ui/browser_finder.h" |
34 #include "chrome/browser/ui/browser_list.h" | 34 #include "chrome/browser/ui/browser_list.h" |
35 #include "chrome/browser/ui/browser_list_observer.h" | 35 #include "chrome/browser/ui/browser_list_observer.h" |
36 #include "chrome/browser/ui/global_error/global_error_service.h" | 36 #include "chrome/browser/ui/global_error/global_error_service.h" |
37 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 37 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
38 #include "components/component_updater/pref_names.h" | 38 #include "components/component_updater/pref_names.h" |
| 39 #include "components/data_use_measurement/core/data_use_user_data.h" |
39 #include "components/prefs/pref_service.h" | 40 #include "components/prefs/pref_service.h" |
40 #include "components/rappor/rappor_service.h" | 41 #include "components/rappor/rappor_service.h" |
41 #include "components/variations/net/variations_http_headers.h" | 42 #include "components/variations/net/variations_http_headers.h" |
42 #include "content/public/browser/browser_thread.h" | 43 #include "content/public/browser/browser_thread.h" |
43 #include "net/base/load_flags.h" | 44 #include "net/base/load_flags.h" |
44 #include "net/http/http_status_code.h" | 45 #include "net/http/http_status_code.h" |
45 #include "net/url_request/url_fetcher.h" | 46 #include "net/url_request/url_fetcher.h" |
46 #include "net/url_request/url_fetcher_delegate.h" | 47 #include "net/url_request/url_fetcher_delegate.h" |
47 #include "net/url_request/url_request_context_getter.h" | 48 #include "net/url_request/url_request_context_getter.h" |
48 | 49 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 // themselves, they will self-delete on completion of the network request when | 245 // themselves, they will self-delete on completion of the network request when |
245 // OnURLFetchComplete is called. | 246 // OnURLFetchComplete is called. |
246 class SRTFetcher : public net::URLFetcherDelegate { | 247 class SRTFetcher : public net::URLFetcherDelegate { |
247 public: | 248 public: |
248 explicit SRTFetcher(Profile* profile) | 249 explicit SRTFetcher(Profile* profile) |
249 : profile_(profile), | 250 : profile_(profile), |
250 url_fetcher_(net::URLFetcher::Create(0, | 251 url_fetcher_(net::URLFetcher::Create(0, |
251 GURL(GetSRTDownloadURL()), | 252 GURL(GetSRTDownloadURL()), |
252 net::URLFetcher::GET, | 253 net::URLFetcher::GET, |
253 this)) { | 254 this)) { |
| 255 data_use_measurement::DataUseUserData::AttachToFetcher( |
| 256 url_fetcher_.get(), |
| 257 data_use_measurement::DataUseUserData::SAFE_BROWSING); |
254 url_fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE); | 258 url_fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE); |
255 url_fetcher_->SetMaxRetriesOn5xx(3); | 259 url_fetcher_->SetMaxRetriesOn5xx(3); |
256 url_fetcher_->SaveResponseToTemporaryFile( | 260 url_fetcher_->SaveResponseToTemporaryFile( |
257 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE)); | 261 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE)); |
258 url_fetcher_->SetRequestContext( | 262 url_fetcher_->SetRequestContext( |
259 g_browser_process->system_request_context()); | 263 g_browser_process->system_request_context()); |
260 // Adds the UMA bit to the download request if the user is enrolled in UMA. | 264 // Adds the UMA bit to the download request if the user is enrolled in UMA. |
261 ProfileIOData* io_data = ProfileIOData::FromResourceContext( | 265 ProfileIOData* io_data = ProfileIOData::FromResourceContext( |
262 profile_->GetResourceContext()); | 266 profile_->GetResourceContext()); |
263 net::HttpRequestHeaders headers; | 267 net::HttpRequestHeaders headers; |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 | 661 |
658 void SetReporterLauncherForTesting(const ReporterLauncher& reporter_launcher) { | 662 void SetReporterLauncherForTesting(const ReporterLauncher& reporter_launcher) { |
659 g_reporter_launcher_ = reporter_launcher; | 663 g_reporter_launcher_ = reporter_launcher; |
660 } | 664 } |
661 | 665 |
662 void SetPromptTriggerForTesting(const PromptTrigger& prompt_trigger) { | 666 void SetPromptTriggerForTesting(const PromptTrigger& prompt_trigger) { |
663 g_prompt_trigger_ = prompt_trigger; | 667 g_prompt_trigger_ = prompt_trigger; |
664 } | 668 } |
665 | 669 |
666 } // namespace safe_browsing | 670 } // namespace safe_browsing |
OLD | NEW |