| 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 <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "chrome/browser/profiles/profile_io_data.h" | 34 #include "chrome/browser/profiles/profile_io_data.h" |
| 35 #include "chrome/browser/safe_browsing/srt_client_info_win.h" | 35 #include "chrome/browser/safe_browsing/srt_client_info_win.h" |
| 36 #include "chrome/browser/safe_browsing/srt_global_error_win.h" | 36 #include "chrome/browser/safe_browsing/srt_global_error_win.h" |
| 37 #include "chrome/browser/ui/browser_finder.h" | 37 #include "chrome/browser/ui/browser_finder.h" |
| 38 #include "chrome/browser/ui/browser_list.h" | 38 #include "chrome/browser/ui/browser_list.h" |
| 39 #include "chrome/browser/ui/browser_list_observer.h" | 39 #include "chrome/browser/ui/browser_list_observer.h" |
| 40 #include "chrome/browser/ui/global_error/global_error_service.h" | 40 #include "chrome/browser/ui/global_error/global_error_service.h" |
| 41 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 41 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
| 42 #include "chrome/common/pref_names.h" | 42 #include "chrome/common/pref_names.h" |
| 43 #include "components/component_updater/pref_names.h" | 43 #include "components/component_updater/pref_names.h" |
| 44 #include "components/data_use_measurement/core/data_use_user_data.h" |
| 44 #include "components/prefs/pref_service.h" | 45 #include "components/prefs/pref_service.h" |
| 45 #include "components/rappor/rappor_service.h" | 46 #include "components/rappor/rappor_service.h" |
| 46 #include "components/variations/net/variations_http_headers.h" | 47 #include "components/variations/net/variations_http_headers.h" |
| 47 #include "components/version_info/version_info.h" | 48 #include "components/version_info/version_info.h" |
| 48 #include "content/public/browser/browser_thread.h" | 49 #include "content/public/browser/browser_thread.h" |
| 49 #include "net/base/load_flags.h" | 50 #include "net/base/load_flags.h" |
| 50 #include "net/http/http_status_code.h" | 51 #include "net/http/http_status_code.h" |
| 51 #include "net/url_request/url_fetcher.h" | 52 #include "net/url_request/url_fetcher.h" |
| 52 #include "net/url_request/url_fetcher_delegate.h" | 53 #include "net/url_request/url_fetcher_delegate.h" |
| 53 #include "net/url_request/url_request_context_getter.h" | 54 #include "net/url_request/url_request_context_getter.h" |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 // themselves, they will self-delete on completion of the network request when | 581 // themselves, they will self-delete on completion of the network request when |
| 581 // OnURLFetchComplete is called. | 582 // OnURLFetchComplete is called. |
| 582 class SRTFetcher : public net::URLFetcherDelegate { | 583 class SRTFetcher : public net::URLFetcherDelegate { |
| 583 public: | 584 public: |
| 584 explicit SRTFetcher(Profile* profile) | 585 explicit SRTFetcher(Profile* profile) |
| 585 : profile_(profile), | 586 : profile_(profile), |
| 586 url_fetcher_(net::URLFetcher::Create(0, | 587 url_fetcher_(net::URLFetcher::Create(0, |
| 587 GURL(GetSRTDownloadURL()), | 588 GURL(GetSRTDownloadURL()), |
| 588 net::URLFetcher::GET, | 589 net::URLFetcher::GET, |
| 589 this)) { | 590 this)) { |
| 591 data_use_measurement::DataUseUserData::AttachToFetcher( |
| 592 url_fetcher_.get(), |
| 593 data_use_measurement::DataUseUserData::SAFE_BROWSING); |
| 590 url_fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE); | 594 url_fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE); |
| 591 url_fetcher_->SetMaxRetriesOn5xx(3); | 595 url_fetcher_->SetMaxRetriesOn5xx(3); |
| 592 url_fetcher_->SaveResponseToTemporaryFile( | 596 url_fetcher_->SaveResponseToTemporaryFile( |
| 593 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE)); | 597 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE)); |
| 594 url_fetcher_->SetRequestContext( | 598 url_fetcher_->SetRequestContext( |
| 595 g_browser_process->system_request_context()); | 599 g_browser_process->system_request_context()); |
| 596 // Adds the UMA bit to the download request if the user is enrolled in UMA. | 600 // Adds the UMA bit to the download request if the user is enrolled in UMA. |
| 597 ProfileIOData* io_data = ProfileIOData::FromResourceContext( | 601 ProfileIOData* io_data = ProfileIOData::FromResourceContext( |
| 598 profile_->GetResourceContext()); | 602 profile_->GetResourceContext()); |
| 599 net::HttpRequestHeaders headers; | 603 net::HttpRequestHeaders headers; |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1046 return srt_cleaner_key.Open(HKEY_CURRENT_USER, cleaner_key_path.c_str(), | 1050 return srt_cleaner_key.Open(HKEY_CURRENT_USER, cleaner_key_path.c_str(), |
| 1047 KEY_QUERY_VALUE) == ERROR_SUCCESS && | 1051 KEY_QUERY_VALUE) == ERROR_SUCCESS && |
| 1048 srt_cleaner_key.GetValueCount() > 0; | 1052 srt_cleaner_key.GetValueCount() > 0; |
| 1049 } | 1053 } |
| 1050 | 1054 |
| 1051 void SetSwReporterTestingDelegate(SwReporterTestingDelegate* delegate) { | 1055 void SetSwReporterTestingDelegate(SwReporterTestingDelegate* delegate) { |
| 1052 g_testing_delegate_ = delegate; | 1056 g_testing_delegate_ = delegate; |
| 1053 } | 1057 } |
| 1054 | 1058 |
| 1055 } // namespace safe_browsing | 1059 } // namespace safe_browsing |
| OLD | NEW |