| 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/extensions/Xfixes.h> | 7 #include <X11/extensions/Xfixes.h> |
| 8 #include <X11/Xatom.h> | 8 #include <X11/Xatom.h> |
| 9 #include <list> | 9 #include <list> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 class SelectionChangeObserver : public ui::PlatformEventObserver { | 64 class SelectionChangeObserver : public ui::PlatformEventObserver { |
| 65 public: | 65 public: |
| 66 static SelectionChangeObserver* GetInstance(); | 66 static SelectionChangeObserver* GetInstance(); |
| 67 | 67 |
| 68 uint64 clipboard_sequence_number() const { | 68 uint64 clipboard_sequence_number() const { |
| 69 return clipboard_sequence_number_; | 69 return clipboard_sequence_number_; |
| 70 } | 70 } |
| 71 uint64 primary_sequence_number() const { return primary_sequence_number_; } | 71 uint64 primary_sequence_number() const { return primary_sequence_number_; } |
| 72 | 72 |
| 73 private: | 73 private: |
| 74 friend struct DefaultSingletonTraits<SelectionChangeObserver>; | 74 friend struct base::DefaultSingletonTraits<SelectionChangeObserver>; |
| 75 | 75 |
| 76 SelectionChangeObserver(); | 76 SelectionChangeObserver(); |
| 77 ~SelectionChangeObserver() override; | 77 ~SelectionChangeObserver() override; |
| 78 | 78 |
| 79 // ui::PlatformEventObserver: | 79 // ui::PlatformEventObserver: |
| 80 void WillProcessEvent(const ui::PlatformEvent& event) override; | 80 void WillProcessEvent(const ui::PlatformEvent& event) override; |
| 81 void DidProcessEvent(const ui::PlatformEvent& event) override {} | 81 void DidProcessEvent(const ui::PlatformEvent& event) override {} |
| 82 | 82 |
| 83 int event_base_; | 83 int event_base_; |
| 84 Atom clipboard_atom_; | 84 Atom clipboard_atom_; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 112 | 112 |
| 113 ui::PlatformEventSource::GetInstance()->AddPlatformEventObserver(this); | 113 ui::PlatformEventSource::GetInstance()->AddPlatformEventObserver(this); |
| 114 } | 114 } |
| 115 } | 115 } |
| 116 | 116 |
| 117 SelectionChangeObserver::~SelectionChangeObserver() { | 117 SelectionChangeObserver::~SelectionChangeObserver() { |
| 118 // We are a singleton; we will outlive the event source. | 118 // We are a singleton; we will outlive the event source. |
| 119 } | 119 } |
| 120 | 120 |
| 121 SelectionChangeObserver* SelectionChangeObserver::GetInstance() { | 121 SelectionChangeObserver* SelectionChangeObserver::GetInstance() { |
| 122 return Singleton<SelectionChangeObserver>::get(); | 122 return base::Singleton<SelectionChangeObserver>::get(); |
| 123 } | 123 } |
| 124 | 124 |
| 125 void SelectionChangeObserver::WillProcessEvent(const ui::PlatformEvent& event) { | 125 void SelectionChangeObserver::WillProcessEvent(const ui::PlatformEvent& event) { |
| 126 if (event->type == event_base_ + XFixesSelectionNotify) { | 126 if (event->type == event_base_ + XFixesSelectionNotify) { |
| 127 XFixesSelectionNotifyEvent* ev = | 127 XFixesSelectionNotifyEvent* ev = |
| 128 reinterpret_cast<XFixesSelectionNotifyEvent*>(event); | 128 reinterpret_cast<XFixesSelectionNotifyEvent*>(event); |
| 129 if (ev->selection == clipboard_atom_) { | 129 if (ev->selection == clipboard_atom_) { |
| 130 clipboard_sequence_number_++; | 130 clipboard_sequence_number_++; |
| 131 } else if (ev->selection == XA_PRIMARY) { | 131 } else if (ev->selection == XA_PRIMARY) { |
| 132 primary_sequence_number_++; | 132 primary_sequence_number_++; |
| (...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 930 if (format.Equals(GetBitmapFormatType())) | 930 if (format.Equals(GetBitmapFormatType())) |
| 931 return; | 931 return; |
| 932 | 932 |
| 933 std::vector<unsigned char> bytes(data_data, data_data + data_len); | 933 std::vector<unsigned char> bytes(data_data, data_data + data_len); |
| 934 scoped_refptr<base::RefCountedMemory> mem( | 934 scoped_refptr<base::RefCountedMemory> mem( |
| 935 base::RefCountedBytes::TakeVector(&bytes)); | 935 base::RefCountedBytes::TakeVector(&bytes)); |
| 936 aurax11_details_->InsertMapping(format.ToString(), mem); | 936 aurax11_details_->InsertMapping(format.ToString(), mem); |
| 937 } | 937 } |
| 938 | 938 |
| 939 } // namespace ui | 939 } // namespace ui |
| OLD | NEW |