| 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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 | 366 |
| 367 download_util::RecordDownloadSource( | 367 download_util::RecordDownloadSource( |
| 368 download_util::INITIATED_BY_IMAGE_BURNER); | 368 download_util::INITIATED_BY_IMAGE_BURNER); |
| 369 download_manager->DownloadUrl( | 369 download_manager->DownloadUrl( |
| 370 url, | 370 url, |
| 371 web_contents->GetURL(), | 371 web_contents->GetURL(), |
| 372 web_contents->GetEncoding(), | 372 web_contents->GetEncoding(), |
| 373 false, | 373 false, |
| 374 -1, | 374 -1, |
| 375 save_info, | 375 save_info, |
| 376 web_contents); | 376 web_contents, |
| 377 DownloadManager::OnStartedCallback()); |
| 377 } else { | 378 } else { |
| 378 DownloadStarted(false, url); | 379 DownloadStarted(false, url); |
| 379 } | 380 } |
| 380 } | 381 } |
| 381 | 382 |
| 382 void Downloader::AddListener(Listener* listener, const GURL& url) { | 383 void Downloader::AddListener(Listener* listener, const GURL& url) { |
| 383 listeners_.insert(std::make_pair(url, listener->AsWeakPtr())); | 384 listeners_.insert(std::make_pair(url, listener->AsWeakPtr())); |
| 384 } | 385 } |
| 385 | 386 |
| 386 void Downloader::DownloadStarted(bool success, const GURL& url) { | 387 void Downloader::DownloadStarted(bool success, const GURL& url) { |
| 387 std::pair<ListenerMap::iterator, ListenerMap::iterator> listener_range = | 388 std::pair<ListenerMap::iterator, ListenerMap::iterator> listener_range = |
| 388 listeners_.equal_range(url); | 389 listeners_.equal_range(url); |
| 389 for (ListenerMap::iterator current_listener = listener_range.first; | 390 for (ListenerMap::iterator current_listener = listener_range.first; |
| 390 current_listener != listener_range.second; | 391 current_listener != listener_range.second; |
| 391 ++current_listener) { | 392 ++current_listener) { |
| 392 if (current_listener->second) | 393 if (current_listener->second) |
| 393 current_listener->second->OnBurnDownloadStarted(success); | 394 current_listener->second->OnBurnDownloadStarted(success); |
| 394 } | 395 } |
| 395 listeners_.erase(listener_range.first, listener_range.second); | 396 listeners_.erase(listener_range.first, listener_range.second); |
| 396 } | 397 } |
| 397 | 398 |
| 398 } // namespace imageburner | 399 } // namespace imageburner |
| 399 } // namespace chromeos | 400 } // namespace chromeos |
| OLD | NEW |