| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_aurax11.h" | 5 #include "ui/base/clipboard/clipboard_aurax11.h" |
| 6 | 6 |
| 7 #include <X11/Xatom.h> | 7 #include <X11/Xatom.h> |
| 8 #include <X11/extensions/Xfixes.h> | 8 #include <X11/extensions/Xfixes.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "ui/gfx/geometry/size.h" | 34 #include "ui/gfx/geometry/size.h" |
| 35 #include "ui/gfx/x/x11_atom_cache.h" | 35 #include "ui/gfx/x/x11_atom_cache.h" |
| 36 | 36 |
| 37 namespace ui { | 37 namespace ui { |
| 38 | 38 |
| 39 namespace { | 39 namespace { |
| 40 | 40 |
| 41 const char kClipboard[] = "CLIPBOARD"; | 41 const char kClipboard[] = "CLIPBOARD"; |
| 42 const char kClipboardManager[] = "CLIPBOARD_MANAGER"; | 42 const char kClipboardManager[] = "CLIPBOARD_MANAGER"; |
| 43 const char kMimeTypeFilename[] = "chromium/filename"; | 43 const char kMimeTypeFilename[] = "chromium/filename"; |
| 44 const char kMimeTypePepperCustomData[] = "chromium/x-pepper-custom-data"; | |
| 45 const char kMimeTypeWebkitSmartPaste[] = "chromium/x-webkit-paste"; | |
| 46 const char kSaveTargets[] = "SAVE_TARGETS"; | 44 const char kSaveTargets[] = "SAVE_TARGETS"; |
| 47 const char kTargets[] = "TARGETS"; | 45 const char kTargets[] = "TARGETS"; |
| 48 | 46 |
| 49 const char* kAtomsToCache[] = { | 47 const char* kAtomsToCache[] = {kClipboard, |
| 50 kClipboard, | 48 kClipboardManager, |
| 51 kClipboardManager, | 49 Clipboard::kMimeTypePNG, |
| 52 Clipboard::kMimeTypePNG, | 50 kMimeTypeFilename, |
| 53 kMimeTypeFilename, | 51 Clipboard::kMimeTypeMozillaURL, |
| 54 kMimeTypeMozillaURL, | 52 Clipboard::kMimeTypeWebkitSmartPaste, |
| 55 kMimeTypeWebkitSmartPaste, | 53 kSaveTargets, |
| 56 kSaveTargets, | 54 kString, |
| 57 kString, | 55 kTargets, |
| 58 kTargets, | 56 kText, |
| 59 kText, | 57 kUtf8String, |
| 60 kUtf8String, | 58 nullptr}; |
| 61 NULL | |
| 62 }; | |
| 63 | 59 |
| 64 /////////////////////////////////////////////////////////////////////////////// | 60 /////////////////////////////////////////////////////////////////////////////// |
| 65 | 61 |
| 66 // Uses the XFixes API to provide sequence numbers for GetSequenceNumber(). | 62 // Uses the XFixes API to provide sequence numbers for GetSequenceNumber(). |
| 67 class SelectionChangeObserver : public ui::PlatformEventObserver { | 63 class SelectionChangeObserver : public ui::PlatformEventObserver { |
| 68 public: | 64 public: |
| 69 static SelectionChangeObserver* GetInstance(); | 65 static SelectionChangeObserver* GetInstance(); |
| 70 | 66 |
| 71 uint64_t clipboard_sequence_number() const { | 67 uint64_t clipboard_sequence_number() const { |
| 72 return clipboard_sequence_number_; | 68 return clipboard_sequence_number_; |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeURIList)); | 586 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeURIList)); |
| 591 return type; | 587 return type; |
| 592 } | 588 } |
| 593 | 589 |
| 594 // static | 590 // static |
| 595 const Clipboard::FormatType& Clipboard::GetUrlWFormatType() { | 591 const Clipboard::FormatType& Clipboard::GetUrlWFormatType() { |
| 596 return GetUrlFormatType(); | 592 return GetUrlFormatType(); |
| 597 } | 593 } |
| 598 | 594 |
| 599 // static | 595 // static |
| 596 const Clipboard::FormatType& Clipboard::GetMozUrlFormatType() { |
| 597 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeMozillaURL)); |
| 598 return type; |
| 599 } |
| 600 |
| 601 // static |
| 600 const Clipboard::FormatType& Clipboard::GetPlainTextFormatType() { | 602 const Clipboard::FormatType& Clipboard::GetPlainTextFormatType() { |
| 601 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeText)); | 603 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeText)); |
| 602 return type; | 604 return type; |
| 603 } | 605 } |
| 604 | 606 |
| 605 // static | 607 // static |
| 606 const Clipboard::FormatType& Clipboard::GetPlainTextWFormatType() { | 608 const Clipboard::FormatType& Clipboard::GetPlainTextWFormatType() { |
| 607 return GetPlainTextFormatType(); | 609 return GetPlainTextFormatType(); |
| 608 } | 610 } |
| 609 | 611 |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 933 if (format.Equals(GetBitmapFormatType())) | 935 if (format.Equals(GetBitmapFormatType())) |
| 934 return; | 936 return; |
| 935 | 937 |
| 936 std::vector<unsigned char> bytes(data_data, data_data + data_len); | 938 std::vector<unsigned char> bytes(data_data, data_data + data_len); |
| 937 scoped_refptr<base::RefCountedMemory> mem( | 939 scoped_refptr<base::RefCountedMemory> mem( |
| 938 base::RefCountedBytes::TakeVector(&bytes)); | 940 base::RefCountedBytes::TakeVector(&bytes)); |
| 939 aurax11_details_->InsertMapping(format.ToString(), mem); | 941 aurax11_details_->InsertMapping(format.ToString(), mem); |
| 940 } | 942 } |
| 941 | 943 |
| 942 } // namespace ui | 944 } // namespace ui |
| OLD | NEW |