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 "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/safe_browsing/srt_field_trial_win.h" | 10 #include "chrome/browser/safe_browsing/srt_field_trial_win.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 69 // Class that will attempt to download the SRT, showing the SRT notification | 69 // Class that will attempt to download the SRT, showing the SRT notification |
| 70 // bubble when the download operation is complete. Instances of SRTFetcher own | 70 // bubble when the download operation is complete. Instances of SRTFetcher own |
| 71 // themselves, they will self-delete on completion of the network request when | 71 // themselves, they will self-delete on completion of the network request when |
| 72 // OnURLFetchComplete is called. | 72 // OnURLFetchComplete is called. |
| 73 class SRTFetcher : public net::URLFetcherDelegate { | 73 class SRTFetcher : public net::URLFetcherDelegate { |
| 74 public: | 74 public: |
| 75 SRTFetcher() | 75 SRTFetcher() |
| 76 : url_fetcher_(net::URLFetcher::Create(0, | 76 : url_fetcher_(net::URLFetcher::Create(0, |
| 77 GURL(GetSRTDownloadURL()), | 77 GURL(GetSRTDownloadURL()), |
| 78 net::URLFetcher::GET, | 78 net::URLFetcher::GET, |
| 79 this)) { | 79 this).Pass()) { |
|
Ryan Sleevi
2015/04/30 18:23:44
Is the .Pass() needed here for these emplacements?
dtapuska
2015/04/30 19:05:56
Pass() is the safe bet.. I was concerned about com
| |
| 80 url_fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE); | 80 url_fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE); |
| 81 url_fetcher_->SetMaxRetriesOn5xx(3); | 81 url_fetcher_->SetMaxRetriesOn5xx(3); |
| 82 url_fetcher_->SaveResponseToTemporaryFile( | 82 url_fetcher_->SaveResponseToTemporaryFile( |
| 83 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); | 83 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); |
| 84 url_fetcher_->SetRequestContext( | 84 url_fetcher_->SetRequestContext( |
| 85 g_browser_process->system_request_context()); | 85 g_browser_process->system_request_context()); |
| 86 url_fetcher_->Start(); | 86 url_fetcher_->Start(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 // net::URLFetcherDelegate: | 89 // net::URLFetcherDelegate: |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 129 } // namespace | 129 } // namespace |
| 130 | 130 |
| 131 namespace safe_browsing { | 131 namespace safe_browsing { |
| 132 | 132 |
| 133 void FetchSRTAndDisplayBubble() { | 133 void FetchSRTAndDisplayBubble() { |
| 134 // All the work happens in the self-deleting class above. | 134 // All the work happens in the self-deleting class above. |
| 135 new SRTFetcher(); | 135 new SRTFetcher(); |
| 136 } | 136 } |
| 137 | 137 |
| 138 } // namespace safe_browsing | 138 } // namespace safe_browsing |
| OLD | NEW |