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

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

Issue 2179813003: Allow OSExchangeData::Provider to be overridden at run time. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac + win Created 4 years, 4 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
« no previous file with comments | « ui/base/BUILD.gn ('k') | ui/base/dragdrop/os_exchange_data.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 #ifndef UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_H_ 5 #ifndef UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_H_
6 #define UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_H_ 6 #define UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 scoped_refptr<DownloadFileProvider> downloader; 80 scoped_refptr<DownloadFileProvider> downloader;
81 }; 81 };
82 82
83 // Provider defines the platform specific part of OSExchangeData that 83 // Provider defines the platform specific part of OSExchangeData that
84 // interacts with the native system. 84 // interacts with the native system.
85 class UI_BASE_EXPORT Provider { 85 class UI_BASE_EXPORT Provider {
86 public: 86 public:
87 Provider() {} 87 Provider() {}
88 virtual ~Provider() {} 88 virtual ~Provider() {}
89 89
90 virtual Provider* Clone() const = 0; 90 virtual std::unique_ptr<Provider> Clone() const = 0;
91 91
92 virtual void MarkOriginatedFromRenderer() = 0; 92 virtual void MarkOriginatedFromRenderer() = 0;
93 virtual bool DidOriginateFromRenderer() const = 0; 93 virtual bool DidOriginateFromRenderer() const = 0;
94 94
95 virtual void SetString(const base::string16& data) = 0; 95 virtual void SetString(const base::string16& data) = 0;
96 virtual void SetURL(const GURL& url, const base::string16& title) = 0; 96 virtual void SetURL(const GURL& url, const base::string16& title) = 0;
97 virtual void SetFilename(const base::FilePath& path) = 0; 97 virtual void SetFilename(const base::FilePath& path) = 0;
98 virtual void SetFilenames(const std::vector<FileInfo>& file_names) = 0; 98 virtual void SetFilenames(const std::vector<FileInfo>& file_names) = 0;
99 virtual void SetPickledData(const Clipboard::FormatType& format, 99 virtual void SetPickledData(const Clipboard::FormatType& format,
100 const base::Pickle& data) = 0; 100 const base::Pickle& data) = 0;
(...skipping 30 matching lines...) Expand all
131 #endif 131 #endif
132 132
133 #if defined(USE_AURA) || defined(OS_MACOSX) 133 #if defined(USE_AURA) || defined(OS_MACOSX)
134 virtual void SetDragImage(const gfx::ImageSkia& image, 134 virtual void SetDragImage(const gfx::ImageSkia& image,
135 const gfx::Vector2d& cursor_offset) = 0; 135 const gfx::Vector2d& cursor_offset) = 0;
136 virtual const gfx::ImageSkia& GetDragImage() const = 0; 136 virtual const gfx::ImageSkia& GetDragImage() const = 0;
137 virtual const gfx::Vector2d& GetDragImageOffset() const = 0; 137 virtual const gfx::Vector2d& GetDragImageOffset() const = 0;
138 #endif 138 #endif
139 }; 139 };
140 140
141 // Creates the platform specific Provider.
142 static Provider* CreateProvider();
143
144 OSExchangeData(); 141 OSExchangeData();
145 // Creates an OSExchangeData with the specified provider. OSExchangeData 142 // Creates an OSExchangeData with the specified provider. OSExchangeData
146 // takes ownership of the supplied provider. 143 // takes ownership of the supplied provider.
147 explicit OSExchangeData(Provider* provider); 144 explicit OSExchangeData(std::unique_ptr<Provider> provider);
148 145
149 ~OSExchangeData(); 146 ~OSExchangeData();
150 147
151 // Returns the Provider, which actually stores and manages the data. 148 // Returns the Provider, which actually stores and manages the data.
152 const Provider& provider() const { return *provider_; } 149 const Provider& provider() const { return *provider_; }
153 Provider& provider() { return *provider_; } 150 Provider& provider() { return *provider_; }
154 151
155 // Marks drag data as tainted if it originates from the renderer. This is used 152 // Marks drag data as tainted if it originates from the renderer. This is used
156 // to avoid granting privileges to a renderer when dragging in tainted data, 153 // to avoid granting privileges to a renderer when dragging in tainted data,
157 // since it could allow potential escalation of privileges. 154 // since it could allow potential escalation of privileges.
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 private: 227 private:
231 // Provides the actual data. 228 // Provides the actual data.
232 std::unique_ptr<Provider> provider_; 229 std::unique_ptr<Provider> provider_;
233 230
234 DISALLOW_COPY_AND_ASSIGN(OSExchangeData); 231 DISALLOW_COPY_AND_ASSIGN(OSExchangeData);
235 }; 232 };
236 233
237 } // namespace ui 234 } // namespace ui
238 235
239 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_H_ 236 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_H_
OLDNEW
« no previous file with comments | « ui/base/BUILD.gn ('k') | ui/base/dragdrop/os_exchange_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698