OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
jam
2013/11/21 19:36:41
here and in other files, the new copyright header
Drew Haven
2013/11/26 02:10:43
Done.
| |
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_IMAGE_WRITER_IMAGE_WRITER_H_ | |
6 #define CHROME_BROWSER_IMAGE_WRITER_IMAGE_WRITER_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "base/files/file_path.h" | |
12 #include "base/threading/sequenced_worker_pool.h" | |
13 #include "content/public/browser/utility_process_host_client.h" | |
14 | |
15 // Decodes an image in a sandboxed process. | |
jam
2013/11/21 19:36:41
update
Drew Haven
2013/11/26 02:10:43
Done.
| |
16 class ImageWriter : public content::UtilityProcessHostClient { | |
17 public: | |
18 class Delegate { | |
19 public: | |
20 // Called when image is decoded. | |
21 // |writer| is used to identify the image in case of decoding several | |
22 // images simultaneously. | |
23 virtual void OnWriteImageSucceeded() = 0; | |
24 | |
25 // Called when decoding image failed. Delegate can do some cleanup in | |
26 // this handler. | |
27 virtual void OnWriteImageFailed(const std::string& message) = 0; | |
28 | |
29 virtual void OnWriteImageProgress(int progress) = 0; | |
30 | |
31 protected: | |
32 virtual ~Delegate() {} | |
33 }; | |
34 | |
35 ImageWriter(Delegate* delegate, | |
36 const base::FilePath& source, | |
37 const base::FilePath& target); | |
38 | |
39 void Start(scoped_refptr<base::SequencedTaskRunner> task_runner); | |
40 | |
41 // Overidden from UtilityProcessHostClient: | |
42 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | |
jam
2013/11/21 19:36:41
nit: put in private section
Drew Haven
2013/11/26 02:10:43
Done.
| |
43 | |
44 private: | |
45 // It's a reference counted object, so destructor is private. | |
46 virtual ~ImageWriter(); | |
47 | |
48 // IPC message handlers. | |
49 void OnWriteImageSucceeded(); | |
50 void OnWriteImageFailed(const std::string& message); | |
51 void OnWriteImageProgress(int progress); | |
52 | |
53 void StartWriteInUtilityProcess(); | |
54 | |
55 Delegate* delegate_; | |
56 base::FilePath source_; | |
57 base::FilePath target_; | |
58 scoped_refptr<base::SequencedTaskRunner> task_runner_; | |
59 | |
60 DISALLOW_COPY_AND_ASSIGN(ImageWriter); | |
61 }; | |
62 | |
63 #endif // CHROME_BROWSER_IMAGE_WRITER_IMAGE_WRITER_H_ | |
OLD | NEW |