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

Unified Diff: extensions/browser/api/clipboard/clipboard_api.cc

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/browser/api/clipboard/clipboard_api.h ('k') | extensions/browser/api/extensions_api_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/api/clipboard/clipboard_api.cc
diff --git a/extensions/browser/api/clipboard/clipboard_api.cc b/extensions/browser/api/clipboard/clipboard_api.cc
index 9b996e460181bf8a7ea8080ed474c0dab65c36b5..7af9272aab39394dba63c6e1bb4f2cfae9d6e787 100644
--- a/extensions/browser/api/clipboard/clipboard_api.cc
+++ b/extensions/browser/api/clipboard/clipboard_api.cc
@@ -9,8 +9,8 @@
#include "base/lazy_instance.h"
#include "base/memory/ptr_util.h"
#include "base/values.h"
+#include "extensions/browser/api/extensions_api_client.h"
#include "extensions/browser/event_router.h"
-#include "extensions/common/api/clipboard.h"
#include "ui/base/clipboard/clipboard_monitor.h"
namespace extensions {
@@ -47,4 +47,26 @@ void ClipboardAPI::OnClipboardDataChanged() {
}
}
+ClipboardSetImageDataFunction::~ClipboardSetImageDataFunction() {}
+
+ExtensionFunction::ResponseAction ClipboardSetImageDataFunction::Run() {
+ std::unique_ptr<clipboard::SetImageData::Params> params(
+ clipboard::SetImageData::Params::Create(*args_));
+ EXTENSION_FUNCTION_VALIDATE(params);
+ ExtensionsAPIClient::Get()->SaveImageDataToClipboard(
+ params->image_data, params->type,
+ base::Bind(&ClipboardSetImageDataFunction::OnSaveImageDataSuccess, this),
+ base::Bind(&ClipboardSetImageDataFunction::OnSaveImageDataError, this));
+ return RespondLater();
+}
+
+void ClipboardSetImageDataFunction::OnSaveImageDataSuccess() {
+ Respond(NoArguments());
+}
+
+void ClipboardSetImageDataFunction::OnSaveImageDataError(
+ const std::string& error) {
+ Respond(Error(error));
+}
+
} // namespace extensions
« no previous file with comments | « extensions/browser/api/clipboard/clipboard_api.h ('k') | extensions/browser/api/extensions_api_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698