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 #include "ui/base/clipboard/clipboard.h" | 5 #include "ui/base/clipboard/clipboard.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 UTF8ToUTF16(reinterpret_cast<char*>(data->data), data->length, markup); | 353 UTF8ToUTF16(reinterpret_cast<char*>(data->data), data->length, markup); |
354 } | 354 } |
355 | 355 |
356 // If there is a terminating NULL, drop it. | 356 // If there is a terminating NULL, drop it. |
357 if (!markup->empty() && markup->at(markup->length() - 1) == '\0') | 357 if (!markup->empty() && markup->at(markup->length() - 1) == '\0') |
358 markup->resize(markup->length() - 1); | 358 markup->resize(markup->length() - 1); |
359 | 359 |
360 gtk_selection_data_free(data); | 360 gtk_selection_data_free(data); |
361 } | 361 } |
362 | 362 |
363 void Clipboard::ReadImage(Buffer buffer, std::string* data) const { | |
364 // TODO(dcheng): implement this. | |
365 NOTIMPLEMENTED(); | |
366 if (!data) { | |
367 NOTREACHED(); | |
368 return; | |
369 } | |
370 } | |
371 | |
372 void Clipboard::ReadBookmark(string16* title, std::string* url) const { | 363 void Clipboard::ReadBookmark(string16* title, std::string* url) const { |
373 // TODO(estade): implement this. | 364 // TODO(estade): implement this. |
374 NOTIMPLEMENTED(); | 365 NOTIMPLEMENTED(); |
375 } | 366 } |
376 | 367 |
377 void Clipboard::ReadData(const std::string& format, std::string* result) { | 368 void Clipboard::ReadData(const std::string& format, std::string* result) { |
378 GtkSelectionData* data = | 369 GtkSelectionData* data = |
379 gtk_clipboard_wait_for_contents(clipboard_, StringToGdkAtom(format)); | 370 gtk_clipboard_wait_for_contents(clipboard_, StringToGdkAtom(format)); |
380 if (!data) | 371 if (!data) |
381 return; | 372 return; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 return clipboard_; | 412 return clipboard_; |
422 case BUFFER_SELECTION: | 413 case BUFFER_SELECTION: |
423 return primary_selection_; | 414 return primary_selection_; |
424 default: | 415 default: |
425 NOTREACHED(); | 416 NOTREACHED(); |
426 return NULL; | 417 return NULL; |
427 } | 418 } |
428 } | 419 } |
429 | 420 |
430 } // namespace ui | 421 } // namespace ui |
OLD | NEW |