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 |
363 void Clipboard::ReadBookmark(string16* title, std::string* url) const { | 372 void Clipboard::ReadBookmark(string16* title, std::string* url) const { |
364 // TODO(estade): implement this. | 373 // TODO(estade): implement this. |
365 NOTIMPLEMENTED(); | 374 NOTIMPLEMENTED(); |
366 } | 375 } |
367 | 376 |
368 void Clipboard::ReadData(const std::string& format, std::string* result) { | 377 void Clipboard::ReadData(const std::string& format, std::string* result) { |
369 GtkSelectionData* data = | 378 GtkSelectionData* data = |
370 gtk_clipboard_wait_for_contents(clipboard_, StringToGdkAtom(format)); | 379 gtk_clipboard_wait_for_contents(clipboard_, StringToGdkAtom(format)); |
371 if (!data) | 380 if (!data) |
372 return; | 381 return; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 return clipboard_; | 421 return clipboard_; |
413 case BUFFER_SELECTION: | 422 case BUFFER_SELECTION: |
414 return primary_selection_; | 423 return primary_selection_; |
415 default: | 424 default: |
416 NOTREACHED(); | 425 NOTREACHED(); |
417 return NULL; | 426 return NULL; |
418 } | 427 } |
419 } | 428 } |
420 | 429 |
421 } // namespace ui | 430 } // namespace ui |
OLD | NEW |