| 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"; |
| 44 const char kSaveTargets[] = "SAVE_TARGETS"; | 46 const char kSaveTargets[] = "SAVE_TARGETS"; |
| 45 const char kTargets[] = "TARGETS"; | 47 const char kTargets[] = "TARGETS"; |
| 46 | 48 |
| 47 const char* kAtomsToCache[] = {kClipboard, | 49 const char* kAtomsToCache[] = { |
| 48 kClipboardManager, | 50 kClipboard, |
| 49 Clipboard::kMimeTypePNG, | 51 kClipboardManager, |
| 50 kMimeTypeFilename, | 52 Clipboard::kMimeTypePNG, |
| 51 Clipboard::kMimeTypeMozillaURL, | 53 kMimeTypeFilename, |
| 52 Clipboard::kMimeTypeWebkitSmartPaste, | 54 kMimeTypeMozillaURL, |
| 53 kSaveTargets, | 55 kMimeTypeWebkitSmartPaste, |
| 54 kString, | 56 kSaveTargets, |
| 55 kTargets, | 57 kString, |
| 56 kText, | 58 kTargets, |
| 57 kUtf8String, | 59 kText, |
| 58 nullptr}; | 60 kUtf8String, |
| 61 NULL |
| 62 }; |
| 59 | 63 |
| 60 /////////////////////////////////////////////////////////////////////////////// | 64 /////////////////////////////////////////////////////////////////////////////// |
| 61 | 65 |
| 62 // Uses the XFixes API to provide sequence numbers for GetSequenceNumber(). | 66 // Uses the XFixes API to provide sequence numbers for GetSequenceNumber(). |
| 63 class SelectionChangeObserver : public ui::PlatformEventObserver { | 67 class SelectionChangeObserver : public ui::PlatformEventObserver { |
| 64 public: | 68 public: |
| 65 static SelectionChangeObserver* GetInstance(); | 69 static SelectionChangeObserver* GetInstance(); |
| 66 | 70 |
| 67 uint64_t clipboard_sequence_number() const { | 71 uint64_t clipboard_sequence_number() const { |
| 68 return clipboard_sequence_number_; | 72 return clipboard_sequence_number_; |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeURIList)); | 590 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeURIList)); |
| 587 return type; | 591 return type; |
| 588 } | 592 } |
| 589 | 593 |
| 590 // static | 594 // static |
| 591 const Clipboard::FormatType& Clipboard::GetUrlWFormatType() { | 595 const Clipboard::FormatType& Clipboard::GetUrlWFormatType() { |
| 592 return GetUrlFormatType(); | 596 return GetUrlFormatType(); |
| 593 } | 597 } |
| 594 | 598 |
| 595 // static | 599 // static |
| 596 const Clipboard::FormatType& Clipboard::GetMozUrlFormatType() { | |
| 597 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeMozillaURL)); | |
| 598 return type; | |
| 599 } | |
| 600 | |
| 601 // static | |
| 602 const Clipboard::FormatType& Clipboard::GetPlainTextFormatType() { | 600 const Clipboard::FormatType& Clipboard::GetPlainTextFormatType() { |
| 603 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeText)); | 601 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeText)); |
| 604 return type; | 602 return type; |
| 605 } | 603 } |
| 606 | 604 |
| 607 // static | 605 // static |
| 608 const Clipboard::FormatType& Clipboard::GetPlainTextWFormatType() { | 606 const Clipboard::FormatType& Clipboard::GetPlainTextWFormatType() { |
| 609 return GetPlainTextFormatType(); | 607 return GetPlainTextFormatType(); |
| 610 } | 608 } |
| 611 | 609 |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 935 if (format.Equals(GetBitmapFormatType())) | 933 if (format.Equals(GetBitmapFormatType())) |
| 936 return; | 934 return; |
| 937 | 935 |
| 938 std::vector<unsigned char> bytes(data_data, data_data + data_len); | 936 std::vector<unsigned char> bytes(data_data, data_data + data_len); |
| 939 scoped_refptr<base::RefCountedMemory> mem( | 937 scoped_refptr<base::RefCountedMemory> mem( |
| 940 base::RefCountedBytes::TakeVector(&bytes)); | 938 base::RefCountedBytes::TakeVector(&bytes)); |
| 941 aurax11_details_->InsertMapping(format.ToString(), mem); | 939 aurax11_details_->InsertMapping(format.ToString(), mem); |
| 942 } | 940 } |
| 943 | 941 |
| 944 } // namespace ui | 942 } // namespace ui |
| OLD | NEW |