| OLD | NEW |
| 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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 | 427 |
| 428 download_util::RecordDownloadSource( | 428 download_util::RecordDownloadSource( |
| 429 download_util::INITIATED_BY_IMAGE_BURNER); | 429 download_util::INITIATED_BY_IMAGE_BURNER); |
| 430 download_manager->DownloadUrl( | 430 download_manager->DownloadUrl( |
| 431 url, | 431 url, |
| 432 web_contents->GetURL(), | 432 web_contents->GetURL(), |
| 433 web_contents->GetEncoding(), | 433 web_contents->GetEncoding(), |
| 434 false, | 434 false, |
| 435 -1, | 435 -1, |
| 436 save_info, | 436 save_info, |
| 437 web_contents); | 437 web_contents, |
| 438 DownloadManager::OnStartedCallback()); |
| 438 } else { | 439 } else { |
| 439 DownloadStarted(false, url); | 440 DownloadStarted(false, url); |
| 440 } | 441 } |
| 441 } | 442 } |
| 442 | 443 |
| 443 void Downloader::AddListener(Listener* listener, const GURL& url) { | 444 void Downloader::AddListener(Listener* listener, const GURL& url) { |
| 444 listeners_.insert(std::make_pair(url, listener->AsWeakPtr())); | 445 listeners_.insert(std::make_pair(url, listener->AsWeakPtr())); |
| 445 } | 446 } |
| 446 | 447 |
| 447 void Downloader::DownloadStarted(bool success, const GURL& url) { | 448 void Downloader::DownloadStarted(bool success, const GURL& url) { |
| 448 std::pair<ListenerMap::iterator, ListenerMap::iterator> listener_range = | 449 std::pair<ListenerMap::iterator, ListenerMap::iterator> listener_range = |
| 449 listeners_.equal_range(url); | 450 listeners_.equal_range(url); |
| 450 for (ListenerMap::iterator current_listener = listener_range.first; | 451 for (ListenerMap::iterator current_listener = listener_range.first; |
| 451 current_listener != listener_range.second; | 452 current_listener != listener_range.second; |
| 452 ++current_listener) { | 453 ++current_listener) { |
| 453 if (current_listener->second) | 454 if (current_listener->second) |
| 454 current_listener->second->OnBurnDownloadStarted(success); | 455 current_listener->second->OnBurnDownloadStarted(success); |
| 455 } | 456 } |
| 456 listeners_.erase(listener_range.first, listener_range.second); | 457 listeners_.erase(listener_range.first, listener_range.second); |
| 457 } | 458 } |
| 458 | 459 |
| 459 } // namespace imageburner | 460 } // namespace imageburner |
| 460 } // namespace chromeos | 461 } // namespace chromeos |
| OLD | NEW |