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

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

Issue 17029020: linux_aura: Redo how memory is handled in clipboard/drag code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes for sky; ptal Created 7 years, 6 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 "googleurl/src/gurl.h" 18 #include "googleurl/src/gurl.h"
19 #include "ui/base/dragdrop/os_exchange_data.h" 19 #include "ui/base/dragdrop/os_exchange_data.h"
20 #include "ui/base/x/selection_owner.h" 20 #include "ui/base/x/selection_owner.h"
21 #include "ui/base/x/selection_requestor.h" 21 #include "ui/base/x/selection_requestor.h"
22 #include "ui/base/x/selection_utils.h"
22 #include "ui/base/x/x11_atom_cache.h" 23 #include "ui/base/x/x11_atom_cache.h"
23 #include "ui/gfx/image/image_skia.h" 24 #include "ui/gfx/image/image_skia.h"
24 #include "ui/gfx/vector2d.h" 25 #include "ui/gfx/vector2d.h"
25 26
26 namespace ui { 27 namespace ui {
27 28
28 class Clipboard; 29 class Clipboard;
29 30
30 // OSExchangeData::Provider implementation for aura on linux. 31 // OSExchangeData::Provider implementation for aura on linux.
31 class UI_EXPORT OSExchangeDataProviderAuraX11 32 class UI_EXPORT OSExchangeDataProviderAuraX11
32 : public OSExchangeData::Provider, 33 : public OSExchangeData::Provider,
33 public base::MessagePumpDispatcher { 34 public base::MessagePumpDispatcher {
34 public: 35 public:
35 // |x_window| is the window the cursor is over, and |selection| is the set of 36 // |x_window| is the window the cursor is over, and |selection| is the set of
36 // data being offered. 37 // data being offered.
37 OSExchangeDataProviderAuraX11(::Window x_window, 38 OSExchangeDataProviderAuraX11(::Window x_window,
38 scoped_ptr<SelectionFormatMap> selection); 39 const SelectionFormatMap& selection);
39 40
40 // Creates a Provider for sending drag information. This creates its own, 41 // Creates a Provider for sending drag information. This creates its own,
41 // hidden X11 window to own send data. 42 // hidden X11 window to own send data.
42 OSExchangeDataProviderAuraX11(); 43 OSExchangeDataProviderAuraX11();
43 44
44 virtual ~OSExchangeDataProviderAuraX11(); 45 virtual ~OSExchangeDataProviderAuraX11();
45 46
46 // After all the Set* methods have built up the data we're offering, call 47 // After all the Set* methods have built up the data we're offering, call
47 // this to take ownership of the XdndSelection clipboard. 48 // this to take ownership of the XdndSelection clipboard.
48 void TakeOwnershipOfSelection() const; 49 void TakeOwnershipOfSelection() const;
49 50
50 // Retrieves a list of types we're offering. Noop if we haven't taken the 51 // Retrieves a list of types we're offering. Noop if we haven't taken the
51 // selection. 52 // selection.
52 void RetrieveTargets(std::vector<Atom>* targets) const; 53 void RetrieveTargets(std::vector<Atom>* targets) const;
53 54
54 // Makes a copy of the format map currently being offered. 55 // Makes a copy of the format map currently being offered.
55 scoped_ptr<SelectionFormatMap> CloneFormatMap() const; 56 SelectionFormatMap GetFormatMap() const;
56 57
57 // Overridden from OSExchangeData::Provider: 58 // Overridden from OSExchangeData::Provider:
58 virtual void SetString(const string16& data) OVERRIDE; 59 virtual void SetString(const string16& data) OVERRIDE;
59 virtual void SetURL(const GURL& url, const string16& title) OVERRIDE; 60 virtual void SetURL(const GURL& url, const string16& title) OVERRIDE;
60 virtual void SetFilename(const base::FilePath& path) OVERRIDE; 61 virtual void SetFilename(const base::FilePath& path) OVERRIDE;
61 virtual void SetFilenames( 62 virtual void SetFilenames(
62 const std::vector<OSExchangeData::FileInfo>& filenames) OVERRIDE; 63 const std::vector<OSExchangeData::FileInfo>& filenames) OVERRIDE;
63 virtual void SetPickledData(const OSExchangeData::CustomFormat& format, 64 virtual void SetPickledData(const OSExchangeData::CustomFormat& format,
64 const Pickle& data) OVERRIDE; 65 const Pickle& data) OVERRIDE;
65 virtual bool GetString(string16* data) const OVERRIDE; 66 virtual bool GetString(string16* data) const OVERRIDE;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 // our own xwindow just to receive events on it. 113 // our own xwindow just to receive events on it.
113 const bool own_window_; 114 const bool own_window_;
114 115
115 ::Window x_window_; 116 ::Window x_window_;
116 117
117 X11AtomCache atom_cache_; 118 X11AtomCache atom_cache_;
118 119
119 // A representation of data. This is either passed to us from the other 120 // A representation of data. This is either passed to us from the other
120 // process, or built up through a sequence of Set*() calls. It can be passed 121 // process, or built up through a sequence of Set*() calls. It can be passed
121 // to |selection_owner_| when we take the selection. 122 // to |selection_owner_| when we take the selection.
122 scoped_ptr<SelectionFormatMap> format_map_; 123 SelectionFormatMap format_map_;
123 124
124 // Takes a snapshot of |format_map_| and offers it to other windows. 125 // Takes a snapshot of |format_map_| and offers it to other windows.
125 mutable SelectionOwner selection_owner_; 126 mutable SelectionOwner selection_owner_;
126 127
127 DISALLOW_COPY_AND_ASSIGN(OSExchangeDataProviderAuraX11); 128 DISALLOW_COPY_AND_ASSIGN(OSExchangeDataProviderAuraX11);
128 }; 129 };
129 130
130 } // namespace ui 131 } // namespace ui
131 132
132 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_AURAX11_H_ 133 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_AURAX11_H_
OLDNEW
« no previous file with comments | « ui/base/clipboard/clipboard_aurax11.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