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

Side by Side Diff: ui/base/clipboard/clipboard_aura.cc

Issue 8364037: Implement clipboard for aura and re-enable clipboard_unittests. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: minor changes Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ui/base/clipboard/clipboard.h"
6
7 #include "base/logging.h"
8 #include "base/utf_string_conversions.h"
9 #include "third_party/skia/include/core/SkBitmap.h"
10
11 namespace ui {
12
13 namespace {
14 const char kMimeTypeBitmap[] = "image/bmp";
15 const char kMimeTypeWebkitSmartPaste[] = "chromium/x-webkit-paste";
16
17 // A mimimum clipboard implementation for simple text cut&paste.
18 class ClipboardData {
19 public:
20 ClipboardData() {}
21 virtual ~ClipboardData() {}
22
23 const std::string& text() const { return utf8_text_; }
24
25 void set_text(const std::string& text) {
26 utf8_text_ = text;
27 }
28
29 private:
30 std::string utf8_text_;
31
32 DISALLOW_COPY_AND_ASSIGN(ClipboardData);
33 };
34
35 ClipboardData* data = NULL;
36
37 ClipboardData* GetClipboardData() {
38 if (!data)
39 data = new ClipboardData();
40 return data;
41 }
42
43 } // namespace
44
45 Clipboard::Clipboard() {
46 NOTIMPLEMENTED();
47 }
48
49 Clipboard::~Clipboard() {
50 }
51
52 void Clipboard::WriteObjects(const ObjectMap& objects) {
53 for (ObjectMap::const_iterator iter = objects.begin();
54 iter != objects.end(); ++iter) {
55 DispatchObject(static_cast<ObjectType>(iter->first), iter->second);
56 }
57 }
58
59
60 void Clipboard::WriteObjects(const ObjectMap& objects,
61 base::ProcessHandle process) {
62 NOTIMPLEMENTED();
63 }
64
65 void Clipboard::DidWriteURL(const std::string& utf8_text) {
66 NOTIMPLEMENTED();
67 }
68
69 bool Clipboard::IsFormatAvailable(const FormatType& format,
70 Buffer buffer) const {
71 NOTIMPLEMENTED();
72 return false;
73 }
74
75 bool Clipboard::IsFormatAvailableByString(const std::string& format,
76 Buffer buffer) const {
77 NOTIMPLEMENTED();
78 return false;
79 }
80
81 void Clipboard::ReadAvailableTypes(Buffer buffer, std::vector<string16>* types,
82 bool* contains_filenames) const {
83 NOTIMPLEMENTED();
84 }
85
86 void Clipboard::ReadText(Buffer buffer, string16* result) const {
87 *result = UTF8ToUTF16(GetClipboardData()->text());
88 }
89
90 void Clipboard::ReadAsciiText(Buffer buffer, std::string* result) const {
91 *result = GetClipboardData()->text();
92 }
93
94 void Clipboard::ReadHTML(Buffer buffer, string16* markup, std::string* src_url,
95 uint32* fragment_start, uint32* fragment_end) const {
96 NOTIMPLEMENTED();
97 }
98
99 SkBitmap Clipboard::ReadImage(Buffer buffer) const {
100 NOTIMPLEMENTED();
101 return SkBitmap();
102 }
103
104 void Clipboard::ReadBookmark(string16* title, std::string* url) const {
105 NOTIMPLEMENTED();
106 }
107
108 void Clipboard::ReadFile(FilePath* file) const {
109 NOTIMPLEMENTED();
110 }
111
112 void Clipboard::ReadFiles(std::vector<FilePath>* files) const {
113 NOTIMPLEMENTED();
114 }
115
116 void Clipboard::ReadData(const std::string& format, std::string* result) {
117 NOTIMPLEMENTED();
118 }
119
120 uint64 Clipboard::GetSequenceNumber() {
121 NOTIMPLEMENTED();
122 return 0;
123 }
124
125 void Clipboard::WriteText(const char* text_data, size_t text_len) {
126 GetClipboardData()->set_text(std::string(text_data, text_len));
127 }
128
129 void Clipboard::WriteHTML(const char* markup_data,
130 size_t markup_len,
131 const char* url_data,
132 size_t url_len) {
133 NOTIMPLEMENTED();
134 }
135
136 void Clipboard::WriteBookmark(const char* title_data,
137 size_t title_len,
138 const char* url_data,
139 size_t url_len) {
140 NOTIMPLEMENTED();
141 }
142
143 void Clipboard::WriteWebSmartPaste() {
144 NOTIMPLEMENTED();
145 }
146
147 void Clipboard::WriteBitmap(const char* pixel_data, const char* size_data) {
148 NOTIMPLEMENTED();
149 }
150
151 void Clipboard::WriteData(const char* format_name, size_t format_len,
152 const char* data_data, size_t data_len) {
153 NOTIMPLEMENTED();
154 }
155
156 // static
157 Clipboard::FormatType Clipboard::GetPlainTextFormatType() {
158 return std::string(kMimeTypeText);
159 }
160
161 // static
162 Clipboard::FormatType Clipboard::GetPlainTextWFormatType() {
163 return GetPlainTextFormatType();
164 }
165
166 // static
167 Clipboard::FormatType Clipboard::GetHtmlFormatType() {
168 return std::string(kMimeTypeHTML);
169 }
170
171 // static
172 Clipboard::FormatType Clipboard::GetBitmapFormatType() {
173 return std::string(kMimeTypeBitmap);
174 }
175
176 // static
177 Clipboard::FormatType Clipboard::GetWebKitSmartPasteFormatType() {
178 return std::string(kMimeTypeWebkitSmartPaste);
179 }
180
181 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/base/clipboard/clipboard_aurax11.cc » ('j') | ui/base/clipboard/clipboard_aurax11.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698