| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 base::Bind(callback, success, file_content)); | 53 base::Bind(callback, success, file_content)); |
| 54 } | 54 } |
| 55 | 55 |
| 56 // Creates a FileStream and calls |callback| with the result on UI thread. | 56 // Creates a FileStream and calls |callback| with the result on UI thread. |
| 57 void CreateFileStream( | 57 void CreateFileStream( |
| 58 const FilePath& file_path, | 58 const FilePath& file_path, |
| 59 base::Callback<void(net::FileStream* file_stream)> callback) { | 59 base::Callback<void(net::FileStream* file_stream)> callback) { |
| 60 scoped_ptr<net::FileStream> file_stream(new net::FileStream(NULL)); | 60 scoped_ptr<net::FileStream> file_stream(new net::FileStream(NULL)); |
| 61 // TODO(tbarzic): Save temp image file to temp folder instead of Downloads | 61 // TODO(tbarzic): Save temp image file to temp folder instead of Downloads |
| 62 // once extracting image directly to removalbe device is implemented | 62 // once extracting image directly to removalbe device is implemented |
| 63 if (file_stream->Open(file_path, base::PLATFORM_FILE_OPEN_ALWAYS | | 63 if (file_stream->OpenSync(file_path, base::PLATFORM_FILE_OPEN_ALWAYS | |
| 64 base::PLATFORM_FILE_WRITE)) | 64 base::PLATFORM_FILE_WRITE)) |
| 65 file_stream.reset(); | 65 file_stream.reset(); |
| 66 | 66 |
| 67 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 67 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 68 base::Bind(callback, file_stream.release())); | 68 base::Bind(callback, file_stream.release())); |
| 69 } | 69 } |
| 70 | 70 |
| 71 } // namespace | 71 } // namespace |
| 72 | 72 |
| 73 const char kName[] = "name"; | 73 const char kName[] = "name"; |
| 74 const char kHwid[] = "hwid"; | 74 const char kHwid[] = "hwid"; |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 current_listener != listener_range.second; | 451 current_listener != listener_range.second; |
| 452 ++current_listener) { | 452 ++current_listener) { |
| 453 if (current_listener->second) | 453 if (current_listener->second) |
| 454 current_listener->second->OnBurnDownloadStarted(success); | 454 current_listener->second->OnBurnDownloadStarted(success); |
| 455 } | 455 } |
| 456 listeners_.erase(listener_range.first, listener_range.second); | 456 listeners_.erase(listener_range.first, listener_range.second); |
| 457 } | 457 } |
| 458 | 458 |
| 459 } // namespace imageburner | 459 } // namespace imageburner |
| 460 } // namespace chromeos | 460 } // namespace chromeos |
| OLD | NEW |