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