| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/webui/chromeos/imageburner/imageburner_utils.h" | 5 #include "chrome/browser/ui/webui/chromeos/imageburner/imageburner_utils.h" |
| 6 | 6 |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/task.h" | 9 #include "base/task.h" |
| 10 #include "chrome/browser/download/download_types.h" | 10 #include "chrome/browser/download/download_types.h" |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 delegate->OnConfigFileFetched(config_file_, true); | 298 delegate->OnConfigFileFetched(config_file_, true); |
| 299 return; | 299 return; |
| 300 } | 300 } |
| 301 downloaders_.push_back(delegate->AsWeakPtr()); | 301 downloaders_.push_back(delegate->AsWeakPtr()); |
| 302 | 302 |
| 303 if (config_file_requested_) | 303 if (config_file_requested_) |
| 304 return; | 304 return; |
| 305 config_file_requested_ = true; | 305 config_file_requested_ = true; |
| 306 | 306 |
| 307 config_file_path_ = GetImageDir().Append(kConfigFileName); | 307 config_file_path_ = GetImageDir().Append(kConfigFileName); |
| 308 download_manager_ = tab_contents->profile()->GetDownloadManager(); | 308 download_manager_ = tab_contents->browser_context()->GetDownloadManager(); |
| 309 download_manager_->AddObserver(this); | 309 download_manager_->AddObserver(this); |
| 310 downloader()->AddListener(this, config_file_url_); | 310 downloader()->AddListener(this, config_file_url_); |
| 311 downloader()->DownloadFile(config_file_url_, config_file_path_, tab_contents); | 311 downloader()->DownloadFile(config_file_url_, config_file_path_, tab_contents); |
| 312 } | 312 } |
| 313 | 313 |
| 314 void BurnManager::ConfigFileFetchedOnUIThread(bool fetched, | 314 void BurnManager::ConfigFileFetchedOnUIThread(bool fetched, |
| 315 const std::string& content) { | 315 const std::string& content) { |
| 316 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 316 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 317 | 317 |
| 318 if (config_file_fetched_) | 318 if (config_file_fetched_) |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 url, file_path, tab_contents, file_stream.release())); | 422 url, file_path, tab_contents, file_stream.release())); |
| 423 } | 423 } |
| 424 | 424 |
| 425 void Downloader::OnFileStreamCreatedOnUIThread(const GURL& url, | 425 void Downloader::OnFileStreamCreatedOnUIThread(const GURL& url, |
| 426 const FilePath& file_path, TabContents* tab_contents, | 426 const FilePath& file_path, TabContents* tab_contents, |
| 427 net::FileStream* created_file_stream) { | 427 net::FileStream* created_file_stream) { |
| 428 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 428 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 429 | 429 |
| 430 if (created_file_stream) { | 430 if (created_file_stream) { |
| 431 DownloadManager* download_manager = | 431 DownloadManager* download_manager = |
| 432 tab_contents->profile()->GetDownloadManager(); | 432 tab_contents->browser_context()->GetDownloadManager(); |
| 433 DownloadSaveInfo save_info; | 433 DownloadSaveInfo save_info; |
| 434 save_info.file_path = file_path; | 434 save_info.file_path = file_path; |
| 435 save_info.file_stream = linked_ptr<net::FileStream>(created_file_stream); | 435 save_info.file_stream = linked_ptr<net::FileStream>(created_file_stream); |
| 436 DownloadStarted(true, url); | 436 DownloadStarted(true, url); |
| 437 download_manager->DownloadUrlToFile(url, | 437 download_manager->DownloadUrlToFile(url, |
| 438 tab_contents->GetURL(), | 438 tab_contents->GetURL(), |
| 439 tab_contents->encoding(), | 439 tab_contents->encoding(), |
| 440 save_info, | 440 save_info, |
| 441 tab_contents); | 441 tab_contents); |
| 442 } else { | 442 } else { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 455 current_listener != listener_range.second; | 455 current_listener != listener_range.second; |
| 456 ++current_listener) { | 456 ++current_listener) { |
| 457 if (current_listener->second) | 457 if (current_listener->second) |
| 458 current_listener->second->OnBurnDownloadStarted(success); | 458 current_listener->second->OnBurnDownloadStarted(success); |
| 459 } | 459 } |
| 460 listeners_.erase(listener_range.first, listener_range.second); | 460 listeners_.erase(listener_range.first, listener_range.second); |
| 461 } | 461 } |
| 462 | 462 |
| 463 } // namespace imageburner. | 463 } // namespace imageburner. |
| 464 | 464 |
| OLD | NEW |