OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_EXTENSIONS_EXTENSION_CLIPBOARD_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_CLIPBOARD_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_CLIPBOARD_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_CLIPBOARD_API_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/extensions/extension_function.h" | 9 #include "chrome/browser/extensions/extension_function.h" |
10 | 10 |
11 // Writes data to the clipboard. Data format and buffer data will be written to | 11 // Writes data to the clipboard. Data format and buffer data will be written to |
12 // are specified by parameters passed from the extension. | 12 // are specified by parameters passed from the extension. |
13 // Currently, only writing to standard buffer is possible. | 13 // Currently, only writing to standard buffer is possible. |
14 class WriteDataClipboardFunction : public SyncExtensionFunction { | 14 class WriteDataClipboardFunction : public SyncExtensionFunction { |
15 public: | 15 public: |
16 virtual bool RunImpl(); | 16 virtual bool RunImpl() OVERRIDE; |
17 | 17 |
18 private: | 18 private: |
19 // Writes plain text to the buffer. Ignores url argument if sent from the | 19 // Writes plain text to the buffer. Ignores url argument if sent from the |
20 // extension. Only standard buffer is currently supported. | 20 // extension. Only standard buffer is currently supported. |
21 bool WritePlainText(const std::string& buffer); | 21 bool WritePlainText(const std::string& buffer); |
22 // Writes html to the buffer. Only standard buffer is currently supported. | 22 // Writes html to the buffer. Only standard buffer is currently supported. |
23 bool WriteHtml(const std::string& buffer); | 23 bool WriteHtml(const std::string& buffer); |
24 | 24 |
25 DECLARE_EXTENSION_FUNCTION_NAME("experimental.clipboard.writeData") | 25 DECLARE_EXTENSION_FUNCTION_NAME("experimental.clipboard.writeData") |
26 }; | 26 }; |
27 | 27 |
28 // Reads data from the clipboard. Data format and buffer data will be written to | 28 // Reads data from the clipboard. Data format and buffer data will be written to |
29 // are specified by parameters passed from the extension. | 29 // are specified by parameters passed from the extension. |
30 class ReadDataClipboardFunction : public SyncExtensionFunction { | 30 class ReadDataClipboardFunction : public SyncExtensionFunction { |
31 public: | 31 public: |
32 virtual bool RunImpl(); | 32 virtual bool RunImpl() OVERRIDE; |
33 | 33 |
34 private: | 34 private: |
35 // Reads plain text from the clipboard buffer. Callback will have only data | 35 // Reads plain text from the clipboard buffer. Callback will have only data |
36 // property set. Selection buffer not supported for Win and Mac. | 36 // property set. Selection buffer not supported for Win and Mac. |
37 bool ReadPlainText(const std::string& buffer); | 37 bool ReadPlainText(const std::string& buffer); |
38 // Reads html from the buffer. Selection buffer not supported for Win and Mac. | 38 // Reads html from the buffer. Selection buffer not supported for Win and Mac. |
39 bool ReadHtml(const std::string& buffer); | 39 bool ReadHtml(const std::string& buffer); |
40 | 40 |
41 DECLARE_EXTENSION_FUNCTION_NAME("experimental.clipboard.readData") | 41 DECLARE_EXTENSION_FUNCTION_NAME("experimental.clipboard.readData") |
42 }; | 42 }; |
43 | 43 |
44 // For a given clipbord buffer, returns list of data types available on it. | 44 // For a given clipbord buffer, returns list of data types available on it. |
45 class GetAvailableMimeTypesClipboardFunction : public SyncExtensionFunction { | 45 class GetAvailableMimeTypesClipboardFunction : public SyncExtensionFunction { |
46 public: | 46 public: |
47 virtual bool RunImpl(); | 47 virtual bool RunImpl() OVERRIDE; |
48 private: | 48 private: |
49 DECLARE_EXTENSION_FUNCTION_NAME("experimental.clipboard.getAvailableTypes") | 49 DECLARE_EXTENSION_FUNCTION_NAME("experimental.clipboard.getAvailableTypes") |
50 }; | 50 }; |
51 | 51 |
52 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_CLIPBOARD_API_H_ | 52 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_CLIPBOARD_API_H_ |
OLD | NEW |