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

Side by Side Diff: ui/base/dragdrop/os_exchange_data_provider_aurax11.h

Issue 219743002: x11: Move X event handling out of the message-pump. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tot-merge-r261267 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
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 #ifndef UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_AURAX11_H_ 5 #ifndef UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_AURAX11_H_
6 #define UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_AURAX11_H_ 6 #define UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_AURAX11_H_
7 7
8 #include <X11/Xlib.h> 8 #include <X11/Xlib.h>
9 9
10 // Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class. 10 // Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class.
11 #undef RootWindow 11 #undef RootWindow
12 12
13 #include <map> 13 #include <map>
14 14
15 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
16 #include "base/message_loop/message_pump_dispatcher.h" 16 #include "base/message_loop/message_pump_dispatcher.h"
17 #include "base/pickle.h" 17 #include "base/pickle.h"
18 #include "ui/base/dragdrop/os_exchange_data.h" 18 #include "ui/base/dragdrop/os_exchange_data.h"
19 #include "ui/base/x/selection_owner.h" 19 #include "ui/base/x/selection_owner.h"
20 #include "ui/base/x/selection_requestor.h" 20 #include "ui/base/x/selection_requestor.h"
21 #include "ui/base/x/selection_utils.h" 21 #include "ui/base/x/selection_utils.h"
22 #include "ui/events/platform/platform_event_dispatcher.h"
22 #include "ui/gfx/image/image_skia.h" 23 #include "ui/gfx/image/image_skia.h"
23 #include "ui/gfx/vector2d.h" 24 #include "ui/gfx/vector2d.h"
24 #include "ui/gfx/x/x11_atom_cache.h" 25 #include "ui/gfx/x/x11_atom_cache.h"
25 #include "url/gurl.h" 26 #include "url/gurl.h"
26 27
27 namespace ui { 28 namespace ui {
28 29
29 class Clipboard; 30 class Clipboard;
30 class OSExchangeDataProviderAuraX11Test; 31 class OSExchangeDataProviderAuraX11Test;
31 32
32 // OSExchangeData::Provider implementation for aura on linux. 33 // OSExchangeData::Provider implementation for aura on linux.
33 class UI_BASE_EXPORT OSExchangeDataProviderAuraX11 34 class UI_BASE_EXPORT OSExchangeDataProviderAuraX11
34 : public OSExchangeData::Provider, 35 : public OSExchangeData::Provider,
35 public base::MessagePumpDispatcher { 36 public ui::PlatformEventDispatcher {
36 public: 37 public:
37 // |x_window| is the window the cursor is over, and |selection| is the set of 38 // |x_window| is the window the cursor is over, and |selection| is the set of
38 // data being offered. 39 // data being offered.
39 OSExchangeDataProviderAuraX11(::Window x_window, 40 OSExchangeDataProviderAuraX11(::Window x_window,
40 const SelectionFormatMap& selection); 41 const SelectionFormatMap& selection);
41 42
42 // Creates a Provider for sending drag information. This creates its own, 43 // Creates a Provider for sending drag information. This creates its own,
43 // hidden X11 window to own send data. 44 // hidden X11 window to own send data.
44 OSExchangeDataProviderAuraX11(); 45 OSExchangeDataProviderAuraX11();
45 46
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 91
91 virtual void SetHtml(const base::string16& html, 92 virtual void SetHtml(const base::string16& html,
92 const GURL& base_url) OVERRIDE; 93 const GURL& base_url) OVERRIDE;
93 virtual bool GetHtml(base::string16* html, GURL* base_url) const OVERRIDE; 94 virtual bool GetHtml(base::string16* html, GURL* base_url) const OVERRIDE;
94 virtual bool HasHtml() const OVERRIDE; 95 virtual bool HasHtml() const OVERRIDE;
95 virtual void SetDragImage(const gfx::ImageSkia& image, 96 virtual void SetDragImage(const gfx::ImageSkia& image,
96 const gfx::Vector2d& cursor_offset) OVERRIDE; 97 const gfx::Vector2d& cursor_offset) OVERRIDE;
97 virtual const gfx::ImageSkia& GetDragImage() const OVERRIDE; 98 virtual const gfx::ImageSkia& GetDragImage() const OVERRIDE;
98 virtual const gfx::Vector2d& GetDragImageOffset() const OVERRIDE; 99 virtual const gfx::Vector2d& GetDragImageOffset() const OVERRIDE;
99 100
100 // Overridden from base::MessagePumpDispatcher: 101 // ui::PlatformEventDispatcher:
101 virtual uint32_t Dispatch(const base::NativeEvent& event) OVERRIDE; 102 virtual bool CanDispatchEvent(const PlatformEvent& event) OVERRIDE;
103 virtual uint32_t DispatchEvent(const PlatformEvent& event) OVERRIDE;
102 104
103 private: 105 private:
104 friend class OSExchangeDataProviderAuraX11Test; 106 friend class OSExchangeDataProviderAuraX11Test;
105 typedef std::map<OSExchangeData::CustomFormat, Pickle> PickleData; 107 typedef std::map<OSExchangeData::CustomFormat, Pickle> PickleData;
106 108
107 // Returns true if |formats_| contains a string format and the string can be 109 // Returns true if |formats_| contains a string format and the string can be
108 // parsed as a URL. 110 // parsed as a URL.
109 bool GetPlainTextURL(GURL* url) const; 111 bool GetPlainTextURL(GURL* url) const;
110 112
111 // Returns the targets in |format_map_|. 113 // Returns the targets in |format_map_|.
(...skipping 29 matching lines...) Expand all
141 143
142 // Takes a snapshot of |format_map_| and offers it to other windows. 144 // Takes a snapshot of |format_map_| and offers it to other windows.
143 mutable SelectionOwner selection_owner_; 145 mutable SelectionOwner selection_owner_;
144 146
145 DISALLOW_COPY_AND_ASSIGN(OSExchangeDataProviderAuraX11); 147 DISALLOW_COPY_AND_ASSIGN(OSExchangeDataProviderAuraX11);
146 }; 148 };
147 149
148 } // namespace ui 150 } // namespace ui
149 151
150 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_AURAX11_H_ 152 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_AURAX11_H_
OLDNEW
« no previous file with comments | « ui/base/clipboard/clipboard_unittest.cc ('k') | ui/base/dragdrop/os_exchange_data_provider_aurax11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698