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

Side by Side Diff: base/clipboard_linux.cc

Issue 10955: Implement the WebSmartPaste pasteboard type on Mac, stub it out on Linux, rem... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 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
« no previous file with comments | « base/clipboard.cc ('k') | base/clipboard_mac.mm » ('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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #include "base/clipboard.h" 5 #include "base/clipboard.h"
6 #include "base/string_util.h" 6 #include "base/string_util.h"
7 7
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 size_t markup_len, 133 size_t markup_len,
134 const char* url_data, 134 const char* url_data,
135 size_t url_len) { 135 size_t url_len) {
136 // TODO(estade): might not want to ignore |url_data| 136 // TODO(estade): might not want to ignore |url_data|
137 char* data = new char[markup_len]; 137 char* data = new char[markup_len];
138 memcpy(data, markup_data, markup_len); 138 memcpy(data, markup_data, markup_len);
139 139
140 InsertMapping(kMimeHtml, data, markup_len); 140 InsertMapping(kMimeHtml, data, markup_len);
141 } 141 }
142 142
143 // Write an extra flavor that signifies WebKit was the last to modify the
144 // pasteboard. This flavor has no data.
145 void Clipboard::WriteWebSmartPaste() {
146 NOTIMPLEMENTED();
147 }
148
143 // We do not use gtk_clipboard_wait_is_target_available because of 149 // We do not use gtk_clipboard_wait_is_target_available because of
144 // a bug with the gtk clipboard. It caches the available targets 150 // a bug with the gtk clipboard. It caches the available targets
145 // and does not always refresh the cache when it is appropriate. 151 // and does not always refresh the cache when it is appropriate.
146 // TODO(estade): When gnome bug 557315 is resolved, change this function 152 // TODO(estade): When gnome bug 557315 is resolved, change this function
147 // to use gtk_clipboard_wait_is_target_available. Also, catch requests 153 // to use gtk_clipboard_wait_is_target_available. Also, catch requests
148 // for plain text and change them to gtk_clipboard_wait_is_text_available 154 // for plain text and change them to gtk_clipboard_wait_is_text_available
149 // (which checks for several standard text targets). 155 // (which checks for several standard text targets).
150 bool Clipboard::IsFormatAvailable(Clipboard::FormatType format) const { 156 bool Clipboard::IsFormatAvailable(Clipboard::FormatType format) const {
151 bool retval = false; 157 bool retval = false;
152 GdkAtom* targets = NULL; 158 GdkAtom* targets = NULL;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 // static 226 // static
221 Clipboard::FormatType Clipboard::GetPlainTextWFormatType() { 227 Clipboard::FormatType Clipboard::GetPlainTextWFormatType() {
222 return GetPlainTextFormatType(); 228 return GetPlainTextFormatType();
223 } 229 }
224 230
225 // static 231 // static
226 Clipboard::FormatType Clipboard::GetHtmlFormatType() { 232 Clipboard::FormatType Clipboard::GetHtmlFormatType() {
227 return gdk_atom_intern(kMimeHtml, false); 233 return gdk_atom_intern(kMimeHtml, false);
228 } 234 }
229 235
236 // static
237 Clipboard::FormatType Clipboard::GetWebKitSmartPasteFormatType() {
238 NOTIMPLEMENTED();
239 return NULL;
240 }
241
230 // Insert the key/value pair in the clipboard_data structure. If 242 // Insert the key/value pair in the clipboard_data structure. If
231 // the mapping already exists, it frees the associated data. Don't worry 243 // the mapping already exists, it frees the associated data. Don't worry
232 // about double freeing because if the same key is inserted into the 244 // about double freeing because if the same key is inserted into the
233 // map twice, it must have come from different Write* functions and the 245 // map twice, it must have come from different Write* functions and the
234 // data pointer cannot be the same. 246 // data pointer cannot be the same.
235 void Clipboard::InsertMapping(const char* key, 247 void Clipboard::InsertMapping(const char* key,
236 char* data, 248 char* data,
237 size_t data_len) { 249 size_t data_len) {
238 TargetMap::iterator iter = clipboard_data_->find(key); 250 TargetMap::iterator iter = clipboard_data_->find(key);
239 251
240 if (iter != clipboard_data_->end()) 252 if (iter != clipboard_data_->end())
241 delete[] iter->second.first; 253 delete[] iter->second.first;
242 254
243 (*clipboard_data_)[key] = std::make_pair(data, data_len); 255 (*clipboard_data_)[key] = std::make_pair(data, data_len);
244 } 256 }
OLDNEW
« no previous file with comments | « base/clipboard.cc ('k') | base/clipboard_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698