| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chromeos/customization/customization_wallpaper_download
er.h" | 5 #include "chrome/browser/chromeos/customization/customization_wallpaper_download
er.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 | 9 |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 } | 79 } |
| 80 | 80 |
| 81 CustomizationWallpaperDownloader::~CustomizationWallpaperDownloader() { | 81 CustomizationWallpaperDownloader::~CustomizationWallpaperDownloader() { |
| 82 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 82 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void CustomizationWallpaperDownloader::StartRequest() { | 85 void CustomizationWallpaperDownloader::StartRequest() { |
| 86 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 86 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 87 DCHECK(wallpaper_url_.is_valid()); | 87 DCHECK(wallpaper_url_.is_valid()); |
| 88 | 88 |
| 89 url_fetcher_.reset( | 89 url_fetcher_ = |
| 90 net::URLFetcher::Create(wallpaper_url_, net::URLFetcher::GET, this)); | 90 net::URLFetcher::Create(wallpaper_url_, net::URLFetcher::GET, this); |
| 91 url_fetcher_->SetRequestContext(url_context_getter_.get()); | 91 url_fetcher_->SetRequestContext(url_context_getter_.get()); |
| 92 url_fetcher_->SetLoadFlags(net::LOAD_BYPASS_CACHE | | 92 url_fetcher_->SetLoadFlags(net::LOAD_BYPASS_CACHE | |
| 93 net::LOAD_DISABLE_CACHE | | 93 net::LOAD_DISABLE_CACHE | |
| 94 net::LOAD_DO_NOT_SAVE_COOKIES | | 94 net::LOAD_DO_NOT_SAVE_COOKIES | |
| 95 net::LOAD_DO_NOT_SEND_COOKIES | | 95 net::LOAD_DO_NOT_SEND_COOKIES | |
| 96 net::LOAD_DO_NOT_SEND_AUTH_DATA); | 96 net::LOAD_DO_NOT_SEND_AUTH_DATA); |
| 97 base::SequencedWorkerPool* blocking_pool = | 97 base::SequencedWorkerPool* blocking_pool = |
| 98 content::BrowserThread::GetBlockingPool(); | 98 content::BrowserThread::GetBlockingPool(); |
| 99 url_fetcher_->SaveResponseToFileAtPath( | 99 url_fetcher_->SaveResponseToFileAtPath( |
| 100 wallpaper_temporary_file_, | 100 wallpaper_temporary_file_, |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 } | 186 } |
| 187 } | 187 } |
| 188 | 188 |
| 189 void CustomizationWallpaperDownloader::OnTemporaryFileRenamed( | 189 void CustomizationWallpaperDownloader::OnTemporaryFileRenamed( |
| 190 scoped_ptr<bool> success) { | 190 scoped_ptr<bool> success) { |
| 191 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 191 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 192 on_wallpaper_fetch_completed_.Run(*success, wallpaper_url_); | 192 on_wallpaper_fetch_completed_.Run(*success, wallpaper_url_); |
| 193 } | 193 } |
| 194 | 194 |
| 195 } // namespace chromeos | 195 } // namespace chromeos |
| OLD | NEW |