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

Side by Side Diff: extensions/browser/api/clipboard/clipboard_api.h

Issue 2379573008: Add SetImageData api to chrome.clipboard. (Closed)
Patch Set: Fix nits. Created 3 years, 11 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
« no previous file with comments | « extensions/browser/api/BUILD.gn ('k') | extensions/browser/api/clipboard/clipboard_api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef EXTENSIONS_BROWSER_API_CLIPBOARD_CLIPBOARD_API_H_ 5 #ifndef EXTENSIONS_BROWSER_API_CLIPBOARD_CLIPBOARD_API_H_
6 #define EXTENSIONS_BROWSER_API_CLIPBOARD_CLIPBOARD_API_H_ 6 #define EXTENSIONS_BROWSER_API_CLIPBOARD_CLIPBOARD_API_H_
7 7
8 #include "extensions/browser/browser_context_keyed_api_factory.h" 8 #include "extensions/browser/browser_context_keyed_api_factory.h"
9 #include "extensions/browser/extension_function.h" 9 #include "extensions/browser/extension_function.h"
10 #include "extensions/common/api/clipboard.h"
10 #include "ui/base/clipboard/clipboard_observer.h" 11 #include "ui/base/clipboard/clipboard_observer.h"
11 12
12 namespace extensions { 13 namespace extensions {
13 14
14 class ClipboardAPI : public BrowserContextKeyedAPI, 15 class ClipboardAPI : public BrowserContextKeyedAPI,
15 public ui::ClipboardObserver { 16 public ui::ClipboardObserver {
16 public: 17 public:
17 explicit ClipboardAPI(content::BrowserContext* context); 18 explicit ClipboardAPI(content::BrowserContext* context);
18 ~ClipboardAPI() override; 19 ~ClipboardAPI() override;
19 20
20 // BrowserContextKeyedAPI implementation. 21 // BrowserContextKeyedAPI implementation.
21 static BrowserContextKeyedAPIFactory<ClipboardAPI>* GetFactoryInstance(); 22 static BrowserContextKeyedAPIFactory<ClipboardAPI>* GetFactoryInstance();
22 23
23 // ui::ClipboardObserver implementation. 24 // ui::ClipboardObserver implementation.
24 void OnClipboardDataChanged() override; 25 void OnClipboardDataChanged() override;
25 26
26 private: 27 private:
27 friend class BrowserContextKeyedAPIFactory<ClipboardAPI>; 28 friend class BrowserContextKeyedAPIFactory<ClipboardAPI>;
28 29
29 // BrowserContextKeyedAPI implementation. 30 // BrowserContextKeyedAPI implementation.
30 static const char* service_name() { return "ClipboardAPI"; } 31 static const char* service_name() { return "ClipboardAPI"; }
31 32
32 content::BrowserContext* const browser_context_; 33 content::BrowserContext* const browser_context_;
33 }; 34 };
34 35
36 class ClipboardSetImageDataFunction : public UIThreadExtensionFunction {
37 public:
38 DECLARE_EXTENSION_FUNCTION("clipboard.setImageData", CLIPBOARD_SETIMAGEDATA);
39
40 protected:
41 ~ClipboardSetImageDataFunction() override;
42 ResponseAction Run() override;
43
44 void OnSaveImageDataSuccess();
45 void OnSaveImageDataError(const std::string& error);
46 };
47
35 } // namespace extensions 48 } // namespace extensions
36 49
37 #endif // EXTENSIONS_BROWSER_API_CLIPBOARD_CLIPBOARD_API_H_ 50 #endif // EXTENSIONS_BROWSER_API_CLIPBOARD_CLIPBOARD_API_H_
OLDNEW
« no previous file with comments | « extensions/browser/api/BUILD.gn ('k') | extensions/browser/api/clipboard/clipboard_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698