| 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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 web_contents->GetRenderProcessHost()->GetID(), | 406 web_contents->GetRenderProcessHost()->GetID(), |
| 407 web_contents->GetRenderViewHost()->routing_id())); | 407 web_contents->GetRenderViewHost()->routing_id())); |
| 408 } | 408 } |
| 409 | 409 |
| 410 void Downloader::CreateFileStreamOnFileThread( | 410 void Downloader::CreateFileStreamOnFileThread( |
| 411 const GURL& url, const FilePath& file_path, int render_process_id, | 411 const GURL& url, const FilePath& file_path, int render_process_id, |
| 412 int render_view_id) { | 412 int render_view_id) { |
| 413 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 413 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 414 DCHECK(!file_path.empty()); | 414 DCHECK(!file_path.empty()); |
| 415 | 415 |
| 416 scoped_ptr<net::FileStream> file_stream(new net::FileStream); | 416 scoped_ptr<net::FileStream> file_stream(new net::FileStream(NULL)); |
| 417 // TODO(tbarzic): Save temp image file to temp folder instead of Downloads | 417 // TODO(tbarzic): Save temp image file to temp folder instead of Downloads |
| 418 // once extracting image directly to removalbe device is implemented | 418 // once extracting image directly to removalbe device is implemented |
| 419 if (file_stream->Open(file_path, base::PLATFORM_FILE_OPEN_ALWAYS | | 419 if (file_stream->Open(file_path, base::PLATFORM_FILE_OPEN_ALWAYS | |
| 420 base::PLATFORM_FILE_WRITE)) | 420 base::PLATFORM_FILE_WRITE)) |
| 421 file_stream.reset(NULL); | 421 file_stream.reset(NULL); |
| 422 | 422 |
| 423 // Call callback method on UI thread. | 423 // Call callback method on UI thread. |
| 424 BrowserThread::PostTask( | 424 BrowserThread::PostTask( |
| 425 BrowserThread::UI, FROM_HERE, | 425 BrowserThread::UI, FROM_HERE, |
| 426 base::Bind(&Downloader::OnFileStreamCreatedOnUIThread, | 426 base::Bind(&Downloader::OnFileStreamCreatedOnUIThread, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 current_listener != listener_range.second; | 470 current_listener != listener_range.second; |
| 471 ++current_listener) { | 471 ++current_listener) { |
| 472 if (current_listener->second) | 472 if (current_listener->second) |
| 473 current_listener->second->OnBurnDownloadStarted(success); | 473 current_listener->second->OnBurnDownloadStarted(success); |
| 474 } | 474 } |
| 475 listeners_.erase(listener_range.first, listener_range.second); | 475 listeners_.erase(listener_range.first, listener_range.second); |
| 476 } | 476 } |
| 477 | 477 |
| 478 } // namespace imageburner | 478 } // namespace imageburner |
| 479 } // namespace chromeos | 479 } // namespace chromeos |
| OLD | NEW |