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

Side by Side Diff: chrome/browser/extensions/clipboard_extension_helper.h

Issue 2379573008: Add SetImageData api to chrome.clipboard. (Closed)
Patch Set: Fix interactive_ui_tests issue. Created 4 years, 1 month 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 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_H_
6 #define CHROME_BROWSER_EXTENSIONS_CLIPBOARD_EXTENSION_HELPER_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/callback.h"
12 #include "extensions/common/api/clipboard.h"
13 #include "ui/gfx/image/image_skia.h"
14
15 namespace ui {
16 class ScopedClipboardWriter;
17 }
18
19 namespace extensions {
20
21 namespace clipboard = api::clipboard;
Devlin 2016/11/16 02:34:33 not allowed in .h files
jennyz 2016/12/07 01:21:47 Done.
22
23 // A helper class for decoding the image data and saving decoded image data on
24 // clipboard, called from clipboard extension API.
25 class ClipboardExtensionHelper {
26 public:
27 ClipboardExtensionHelper();
28 ~ClipboardExtensionHelper();
29
30 // Decodes and saves the image data on clipboard. Must run on UI thread.
31 void DecodeAndSaveImageData(const std::vector<char>& data,
32 clipboard::ImageType type,
33 const base::Closure& success_callback,
34 const base::Closure& error_callback);
35
36 protected:
37 // A class to decode PNG and JPEG file.
38 class ClipboardImageDataDecoder;
39
40 static ClipboardImageDataDecoder* clipboard_image_data_decoder_;
41
42 private:
43 // Handles decoded image data.
44 void OnImageDecoded(const SkBitmap& bitmap);
45 // Handles image decoding failure case.
46 void OnImageDecodeFailure();
47 // Handles image decoding request cancelation case.
48 void OnImageDecodeCancel();
49
50 base::Closure image_save_success_callback_;
51 base::Closure image_save_error_callback_;
52 std::unique_ptr<ui::ScopedClipboardWriter> clipboard_writer_;
Devlin 2016/11/16 02:34:33 DISALLOW_COPY_AND_ASSIGN
jennyz 2016/12/07 01:21:48 Done.
53 };
54
55 } // namespace extensions
56
57 #endif // CHROME_BROWSER_EXTENSIONS_CLIPBOARD_EXTENSION_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698