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/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/threading/worker_pool.h" | 10 #include "base/threading/worker_pool.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 const char kImageZipFileName[] = "chromeos_image.bin.zip"; | 34 const char kImageZipFileName[] = "chromeos_image.bin.zip"; |
35 | 35 |
36 const int64 kBytesImageDownloadProgressReportInterval = 10240; | 36 const int64 kBytesImageDownloadProgressReportInterval = 10240; |
37 | 37 |
38 BurnManager* g_burn_manager = NULL; | 38 BurnManager* g_burn_manager = NULL; |
39 | 39 |
40 // Cretes a directory and calls |callback| with the result on UI thread. | 40 // Cretes a directory and calls |callback| with the result on UI thread. |
41 void CreateDirectory(const base::FilePath& path, | 41 void CreateDirectory(const base::FilePath& path, |
42 base::Callback<void(bool success)> callback) { | 42 base::Callback<void(bool success)> callback) { |
43 const bool success = file_util::CreateDirectory(path); | 43 const bool success = base::CreateDirectory(path); |
44 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 44 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
45 base::Bind(callback, success)); | 45 base::Bind(callback, success)); |
46 } | 46 } |
47 | 47 |
48 // Unzips |source_zip_file| and sets the filename of the unzipped image to | 48 // Unzips |source_zip_file| and sets the filename of the unzipped image to |
49 // |source_image_file|. | 49 // |source_image_file|. |
50 void UnzipImage(const base::FilePath& source_zip_file, | 50 void UnzipImage(const base::FilePath& source_zip_file, |
51 const std::string& image_name, | 51 const std::string& image_name, |
52 scoped_refptr<base::RefCountedString> source_image_file) { | 52 scoped_refptr<base::RefCountedString> source_image_file) { |
53 if (zip::Unzip(source_zip_file, source_zip_file.DirName())) { | 53 if (zip::Unzip(source_zip_file, source_zip_file.DirName())) { |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 // Note: in theory, this is not a part of notification, but cancelling | 646 // Note: in theory, this is not a part of notification, but cancelling |
647 // the running burning task. However, there is no good place to be in the | 647 // the running burning task. However, there is no good place to be in the |
648 // current code. | 648 // current code. |
649 // TODO(hidehiko): Clean this up after refactoring. | 649 // TODO(hidehiko): Clean this up after refactoring. |
650 OnError(IDS_IMAGEBURN_DEVICE_NOT_FOUND_ERROR); | 650 OnError(IDS_IMAGEBURN_DEVICE_NOT_FOUND_ERROR); |
651 } | 651 } |
652 } | 652 } |
653 | 653 |
654 } // namespace imageburner | 654 } // namespace imageburner |
655 } // namespace chromeos | 655 } // namespace chromeos |
OLD | NEW |