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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 std::string file_content; | 50 std::string file_content; |
51 const bool success = file_util::ReadFileToString(path, &file_content); | 51 const bool success = file_util::ReadFileToString(path, &file_content); |
52 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 52 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
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); | 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->Open(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 |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 current_listener != listener_range.second; | 448 current_listener != listener_range.second; |
449 ++current_listener) { | 449 ++current_listener) { |
450 if (current_listener->second) | 450 if (current_listener->second) |
451 current_listener->second->OnBurnDownloadStarted(success); | 451 current_listener->second->OnBurnDownloadStarted(success); |
452 } | 452 } |
453 listeners_.erase(listener_range.first, listener_range.second); | 453 listeners_.erase(listener_range.first, listener_range.second); |
454 } | 454 } |
455 | 455 |
456 } // namespace imageburner | 456 } // namespace imageburner |
457 } // namespace chromeos | 457 } // namespace chromeos |
OLD | NEW |