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 |