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