OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 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_CLIPBOARD_EXTENSION_HELPER_CHROMEOS_H_ | |
6 #define CHROME_BROWSER_EXTENSIONS_CLIPBOARD_EXTENSION_HELPER_CHROMEOS_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "base/callback.h" | |
12 #include "extensions/browser/extensions_browser_client.h" | |
13 #include "extensions/common/api/clipboard.h" | |
14 #include "ui/gfx/image/image_skia.h" | |
Devlin
2016/12/16 02:26:16
needed?
jennyz
2016/12/19 07:01:36
Removed.
| |
15 | |
16 namespace ui { | |
17 class ScopedClipboardWriter; | |
18 } | |
19 | |
20 namespace extensions { | |
21 | |
22 // A helper class for decoding the image data and saving decoded image data on | |
23 // clipboard, called from clipboard extension API. | |
24 class ClipboardExtensionHelper { | |
25 public: | |
26 ClipboardExtensionHelper(); | |
27 ~ClipboardExtensionHelper(); | |
28 | |
29 // Decodes and saves the image data on clipboard. Must run on UI thread. | |
30 void DecodeAndSaveImageData( | |
31 const std::vector<char>& data, | |
32 api::clipboard::ImageType type, | |
33 const base::Closure& success_callback, | |
34 const ExtensionsBrowserClient::ErrorCallback& error_callback); | |
35 | |
36 protected: | |
37 // A class to decode PNG and JPEG file. | |
38 class ClipboardImageDataDecoder; | |
Devlin
2016/12/16 02:26:16
Why protected instead of private?
jennyz
2016/12/19 07:01:36
Make it private.
| |
39 | |
40 private: | |
41 // Handles decoded image data. | |
42 void OnImageDecoded(const SkBitmap& bitmap); | |
43 // Handles image decoding failure case. | |
44 void OnImageDecodeFailure(); | |
45 // Handles image decoding request cancelation case. | |
46 void OnImageDecodeCancel(); | |
47 | |
48 std::unique_ptr<ClipboardImageDataDecoder> clipboard_image_data_decoder_; | |
49 base::Closure image_save_success_callback_; | |
50 ExtensionsBrowserClient::ErrorCallback image_save_error_callback_; | |
51 std::unique_ptr<ui::ScopedClipboardWriter> clipboard_writer_; | |
52 | |
53 DISALLOW_COPY_AND_ASSIGN(ClipboardExtensionHelper); | |
54 }; | |
55 | |
56 } // namespace extensions | |
57 | |
58 #endif // CHROME_BROWSER_EXTENSIONS_CLIPBOARD_EXTENSION_HELPER_CHROMEOS_H_ | |
OLD | NEW |