Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(523)

Side by Side Diff: ui/base/clipboard/clipboard_aurax11.cc

Issue 223483002: base: Do not allow MessagePumpObservers to consume events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tot-merge-r262009 Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/aura/window_tree_host_x11.cc ('k') | ui/display/chromeos/x11/native_display_delegate_x11.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.h" 5 #include "ui/base/clipboard/clipboard.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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } 66 }
67 uint64 primary_sequence_number() const { return primary_sequence_number_; } 67 uint64 primary_sequence_number() const { return primary_sequence_number_; }
68 68
69 private: 69 private:
70 friend struct DefaultSingletonTraits<SelectionChangeObserver>; 70 friend struct DefaultSingletonTraits<SelectionChangeObserver>;
71 71
72 SelectionChangeObserver(); 72 SelectionChangeObserver();
73 virtual ~SelectionChangeObserver(); 73 virtual ~SelectionChangeObserver();
74 74
75 // Overridden from base::MessagePumpObserver: 75 // Overridden from base::MessagePumpObserver:
76 virtual base::EventStatus WillProcessEvent( 76 virtual void WillProcessEvent(const base::NativeEvent& event) OVERRIDE;
77 const base::NativeEvent& event) OVERRIDE;
78 virtual void DidProcessEvent( 77 virtual void DidProcessEvent(
79 const base::NativeEvent& event) OVERRIDE {} 78 const base::NativeEvent& event) OVERRIDE {}
80 79
81 int event_base_; 80 int event_base_;
82 Atom clipboard_atom_; 81 Atom clipboard_atom_;
83 uint64 clipboard_sequence_number_; 82 uint64 clipboard_sequence_number_;
84 uint64 primary_sequence_number_; 83 uint64 primary_sequence_number_;
85 84
86 DISALLOW_COPY_AND_ASSIGN(SelectionChangeObserver); 85 DISALLOW_COPY_AND_ASSIGN(SelectionChangeObserver);
87 }; 86 };
(...skipping 25 matching lines...) Expand all
113 } 112 }
114 113
115 SelectionChangeObserver::~SelectionChangeObserver() { 114 SelectionChangeObserver::~SelectionChangeObserver() {
116 // We are a singleton; we will outlive our message pump. 115 // We are a singleton; we will outlive our message pump.
117 } 116 }
118 117
119 SelectionChangeObserver* SelectionChangeObserver::GetInstance() { 118 SelectionChangeObserver* SelectionChangeObserver::GetInstance() {
120 return Singleton<SelectionChangeObserver>::get(); 119 return Singleton<SelectionChangeObserver>::get();
121 } 120 }
122 121
123 base::EventStatus SelectionChangeObserver::WillProcessEvent( 122 void SelectionChangeObserver::WillProcessEvent(const base::NativeEvent& event) {
124 const base::NativeEvent& event) {
125 if (event->type == event_base_ + XFixesSelectionNotify) { 123 if (event->type == event_base_ + XFixesSelectionNotify) {
126 XFixesSelectionNotifyEvent* ev = 124 XFixesSelectionNotifyEvent* ev =
127 reinterpret_cast<XFixesSelectionNotifyEvent*>(event); 125 reinterpret_cast<XFixesSelectionNotifyEvent*>(event);
128 if (ev->selection == clipboard_atom_) { 126 if (ev->selection == clipboard_atom_) {
129 clipboard_sequence_number_++; 127 clipboard_sequence_number_++;
130 } else if (ev->selection == XA_PRIMARY) { 128 } else if (ev->selection == XA_PRIMARY) {
131 primary_sequence_number_++; 129 primary_sequence_number_++;
132 } else { 130 } else {
133 DLOG(ERROR) << "Unexpected selection atom: " << ev->selection; 131 DLOG(ERROR) << "Unexpected selection atom: " << ev->selection;
134 } 132 }
135 } 133 }
136 return base::EVENT_CONTINUE;
137 } 134 }
138 135
139 /////////////////////////////////////////////////////////////////////////////// 136 ///////////////////////////////////////////////////////////////////////////////
140 137
141 // Represents a list of possible return types. Copy constructable. 138 // Represents a list of possible return types. Copy constructable.
142 class TargetList { 139 class TargetList {
143 public: 140 public:
144 typedef std::vector< ::Atom> AtomVector; 141 typedef std::vector< ::Atom> AtomVector;
145 142
146 TargetList(const AtomVector& target_list, X11AtomCache* atom_cache); 143 TargetList(const AtomVector& target_list, X11AtomCache* atom_cache);
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 return type; 866 return type;
870 } 867 }
871 868
872 // static 869 // static
873 const Clipboard::FormatType& Clipboard::GetPepperCustomDataFormatType() { 870 const Clipboard::FormatType& Clipboard::GetPepperCustomDataFormatType() {
874 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypePepperCustomData)); 871 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypePepperCustomData));
875 return type; 872 return type;
876 } 873 }
877 874
878 } // namespace ui 875 } // namespace ui
OLDNEW
« no previous file with comments | « ui/aura/window_tree_host_x11.cc ('k') | ui/display/chromeos/x11/native_display_delegate_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698