Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(631)

Side by Side Diff: chrome/browser/chromeos/imageburner/burn_manager.cc

Issue 10386063: Move URLFetcherDelegate to net/ and split URLFetcher between net/ and content/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync to head, fix win component build Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/imageburner/burn_manager.h" 5 #include "chrome/browser/chromeos/imageburner/burn_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 image_fetcher_->SaveResponseToFileAtPath( 299 image_fetcher_->SaveResponseToFileAtPath(
300 file_path, 300 file_path,
301 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); 301 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE));
302 image_fetcher_->Start(); 302 image_fetcher_->Start();
303 } 303 }
304 304
305 void BurnManager::CancelImageFetch() { 305 void BurnManager::CancelImageFetch() {
306 image_fetcher_.reset(); 306 image_fetcher_.reset();
307 } 307 }
308 308
309 void BurnManager::OnURLFetchComplete(const content::URLFetcher* source) { 309 void BurnManager::OnURLFetchComplete(const net::URLFetcher* source) {
310 const bool success = 310 const bool success =
311 source->GetStatus().status() == net::URLRequestStatus::SUCCESS; 311 source->GetStatus().status() == net::URLRequestStatus::SUCCESS;
312 if (source == config_fetcher_.get()) { 312 if (source == config_fetcher_.get()) {
313 std::string data; 313 std::string data;
314 if (success) 314 if (success)
315 config_fetcher_->GetResponseAsString(&data); 315 config_fetcher_->GetResponseAsString(&data);
316 config_fetcher_.reset(); 316 config_fetcher_.reset();
317 ConfigFileFetched(success, data); 317 ConfigFileFetched(success, data);
318 } else if (source == image_fetcher_.get()) { 318 } else if (source == image_fetcher_.get()) {
319 if (success) 319 if (success)
320 FOR_EACH_OBSERVER(Observer, observers_, OnDownloadCompleted()); 320 FOR_EACH_OBSERVER(Observer, observers_, OnDownloadCompleted());
321 else 321 else
322 FOR_EACH_OBSERVER(Observer, observers_, OnDownloadCancelled()); 322 FOR_EACH_OBSERVER(Observer, observers_, OnDownloadCancelled());
323 } 323 }
324 } 324 }
325 325
326 void BurnManager::OnURLFetchDownloadProgress(const content::URLFetcher* source, 326 void BurnManager::OnURLFetchDownloadProgress(const net::URLFetcher* source,
327 int64 current, 327 int64 current,
328 int64 total) { 328 int64 total) {
329 if (source == image_fetcher_.get()) { 329 if (source == image_fetcher_.get()) {
330 if (current >= bytes_image_download_progress_last_reported_ + 330 if (current >= bytes_image_download_progress_last_reported_ +
331 kBytesImageDownloadProgressReportInterval) { 331 kBytesImageDownloadProgressReportInterval) {
332 bytes_image_download_progress_last_reported_ = current; 332 bytes_image_download_progress_last_reported_ = current;
333 base::TimeDelta time_remaining; 333 base::TimeDelta time_remaining;
334 if (current > 0) { 334 if (current > 0) {
335 const base::TimeDelta diff = 335 const base::TimeDelta diff =
336 base::TimeTicks::Now() - tick_image_download_start_; 336 base::TimeTicks::Now() - tick_image_download_start_;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 downloaders_[i]->OnConfigFileFetched(fetched, 369 downloaders_[i]->OnConfigFileFetched(fetched,
370 image_file_name_, 370 image_file_name_,
371 image_download_url_); 371 image_download_url_);
372 } 372 }
373 } 373 }
374 downloaders_.clear(); 374 downloaders_.clear();
375 } 375 }
376 376
377 } // namespace imageburner 377 } // namespace imageburner
378 } // namespace chromeos 378 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/imageburner/burn_manager.h ('k') | chrome/browser/component_updater/component_updater_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698