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

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

Issue 2379573008: Add SetImageData api to chrome.clipboard. (Closed)
Patch Set: Update idl for possible web alternative timeline. Created 3 years, 12 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 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/api/extensions_api_client.h"
Devlin 2016/12/21 23:58:38 needed?
jennyz 2016/12/22 22:45:21 Removed.
13 #include "extensions/common/api/clipboard.h"
14
15 class SkBitmap;
16
17 namespace extensions {
18
19 // A helper class for decoding the image data and saving decoded image data on
20 // clipboard, called from clipboard extension API.
21 class ClipboardExtensionHelper {
22 public:
23 ClipboardExtensionHelper();
24 ~ClipboardExtensionHelper();
25
26 // Decodes and saves the image data on clipboard. Must run on UI thread.
27 void DecodeAndSaveImageData(
28 const std::vector<char>& data,
29 api::clipboard::ImageType type,
30 const base::Closure& success_callback,
31 const base::Callback<void(const std::string&)>& error_callback);
32
33 private:
34 // A class to decode PNG and JPEG file.
35 class ClipboardImageDataDecoder;
36
37 // Handles decoded image data.
38 void OnImageDecoded(const SkBitmap& bitmap);
39 // Handles image decoding failure case.
40 void OnImageDecodeFailure();
41 // Handles image decoding request cancelation case.
42 void OnImageDecodeCancel();
43
44 std::unique_ptr<ClipboardImageDataDecoder> clipboard_image_data_decoder_;
45 base::Closure image_save_success_callback_;
46 base::Callback<void(const std::string&)> image_save_error_callback_;
47
48 DISALLOW_COPY_AND_ASSIGN(ClipboardExtensionHelper);
49 };
50
51 } // namespace extensions
52
53 #endif // CHROME_BROWSER_EXTENSIONS_CLIPBOARD_EXTENSION_HELPER_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698