Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(480)

Side by Side Diff: chrome/browser/extensions/api/image_writer_private/image_writer_utils.h

Issue 170123002: Revert of Significantly cleans up the ImageWriter Operation class and subclasses. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_IMAGE_WRITER_PRIVATE_IMAGE_WRITER_UTILS_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_IMAGE_WRITER_PRIVATE_IMAGE_WRITER_UTILS_H_
7
8 #include "base/files/file_path.h"
9 #include "base/platform_file.h"
10
11 namespace extensions {
12 namespace image_writer_utils {
13
14 // Utility class for writing data to a removable disk.
15 class ImageWriter {
16 public:
17 ImageWriter();
18 virtual ~ImageWriter();
19
20 // Note: If there is already a device open, it will be closed.
21 virtual bool Open(const base::FilePath& path);
22 virtual bool Close();
23
24 // Writes from data_block to the device, and returns the amount written or -1
25 // on error.
26 virtual int Write(const char* data_block, int data_size);
27
28 private:
29 base::PlatformFile file_;
30 int writes_count_;
31 };
32
33 // Utility class for reading a large file, such as a Chrome OS image.
34 class ImageReader {
35 public:
36 ImageReader();
37 virtual ~ImageReader();
38
39 // Note: If there is already a file open, it will be closed.
40 virtual bool Open(const base::FilePath& path);
41 virtual bool Close();
42 // Read from the file into data_block.
43 virtual int Read(char* data_block, int data_size);
44 virtual int64 GetSize();
45
46 private:
47 base::PlatformFile file_;
48 };
49
50 } // namespace image_writer_utils
51 } // namespace extensions
52
53 #endif // CHROME_BROWSER_EXTENSIONS_API_IMAGE_WRITER_PRIVATE_IMAGE_WRITER_UTILS _H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698