| 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/bind.h" |
| 7 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 8 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 9 #include "base/task.h" | 10 #include "base/task.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/common/chrome_paths.h" | 12 #include "chrome/common/chrome_paths.h" |
| 12 #include "content/browser/browser_thread.h" | 13 #include "content/browser/browser_thread.h" |
| 13 #include "content/browser/download/download_types.h" | 14 #include "content/browser/download/download_types.h" |
| 14 | 15 |
| 15 namespace imageburner { | 16 namespace imageburner { |
| 16 | 17 |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 void BurnManager::OnDownloadUpdated(DownloadItem* download) { | 230 void BurnManager::OnDownloadUpdated(DownloadItem* download) { |
| 230 if (download->IsCancelled()) { | 231 if (download->IsCancelled()) { |
| 231 ConfigFileFetchedOnUIThread(false, ""); | 232 ConfigFileFetchedOnUIThread(false, ""); |
| 232 DCHECK(!download_item_observer_added_); | 233 DCHECK(!download_item_observer_added_); |
| 233 DCHECK(active_download_item_ == NULL); | 234 DCHECK(active_download_item_ == NULL); |
| 234 } else if (download->IsComplete()) { | 235 } else if (download->IsComplete()) { |
| 235 scoped_refptr<BurnManagerTaskProxy> task = | 236 scoped_refptr<BurnManagerTaskProxy> task = |
| 236 new BurnManagerTaskProxy(); | 237 new BurnManagerTaskProxy(); |
| 237 BrowserThread::PostTask( | 238 BrowserThread::PostTask( |
| 238 BrowserThread::FILE, FROM_HERE, | 239 BrowserThread::FILE, FROM_HERE, |
| 239 NewRunnableMethod(task.get(), | 240 base::Bind(&BurnManagerTaskProxy::OnConfigFileDownloaded, task.get())); |
| 240 &BurnManagerTaskProxy::OnConfigFileDownloaded)); | |
| 241 } | 241 } |
| 242 } | 242 } |
| 243 | 243 |
| 244 void BurnManager::OnConfigFileDownloadedOnFileThread() { | 244 void BurnManager::OnConfigFileDownloadedOnFileThread() { |
| 245 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 245 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 246 std::string config_file_content; | 246 std::string config_file_content; |
| 247 bool success = | 247 bool success = |
| 248 file_util::ReadFileToString(config_file_path_, &config_file_content); | 248 file_util::ReadFileToString(config_file_path_, &config_file_content); |
| 249 scoped_refptr<BurnManagerTaskProxy> task = new BurnManagerTaskProxy(); | 249 scoped_refptr<BurnManagerTaskProxy> task = new BurnManagerTaskProxy(); |
| 250 BrowserThread::PostTask( | 250 BrowserThread::PostTask( |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |