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

Side by Side Diff: ui/base/dragdrop/os_exchange_data_provider_aura.cc

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
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/dragdrop/os_exchange_data_provider_aura.h" 5 #include "ui/base/dragdrop/os_exchange_data_provider_aura.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ptr_util.h"
8 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
9 #include "net/base/filename_util.h" 10 #include "net/base/filename_util.h"
10 #include "ui/base/clipboard/clipboard.h" 11 #include "ui/base/clipboard/clipboard.h"
11 #include "ui/base/clipboard/scoped_clipboard_writer.h" 12 #include "ui/base/clipboard/scoped_clipboard_writer.h"
12 #include "ui/base/dragdrop/file_info.h" 13 #include "ui/base/dragdrop/file_info.h"
13 14
14 namespace ui { 15 namespace ui {
15 16
16 OSExchangeDataProviderAura::OSExchangeDataProviderAura() 17 OSExchangeDataProviderAura::OSExchangeDataProviderAura()
17 : formats_(0) { 18 : formats_(0) {
18 } 19 }
19 20
20 OSExchangeDataProviderAura::~OSExchangeDataProviderAura() {} 21 OSExchangeDataProviderAura::~OSExchangeDataProviderAura() {}
21 22
22 OSExchangeData::Provider* OSExchangeDataProviderAura::Clone() const { 23 std::unique_ptr<OSExchangeData::Provider>
24 OSExchangeDataProviderAura::Clone() const {
23 OSExchangeDataProviderAura* ret = new OSExchangeDataProviderAura(); 25 OSExchangeDataProviderAura* ret = new OSExchangeDataProviderAura();
24 ret->formats_ = formats_; 26 ret->formats_ = formats_;
25 ret->string_ = string_; 27 ret->string_ = string_;
26 ret->url_ = url_; 28 ret->url_ = url_;
27 ret->title_ = title_; 29 ret->title_ = title_;
28 ret->filenames_ = filenames_; 30 ret->filenames_ = filenames_;
29 ret->pickle_data_ = pickle_data_; 31 ret->pickle_data_ = pickle_data_;
30 // We skip copying the drag images. 32 // We skip copying the drag images.
31 ret->html_ = html_; 33 ret->html_ = html_;
32 ret->base_url_ = base_url_; 34 ret->base_url_ = base_url_;
33 35
34 return ret; 36 return base::WrapUnique<OSExchangeData::Provider>(ret);
35 } 37 }
36 38
37 void OSExchangeDataProviderAura::MarkOriginatedFromRenderer() { 39 void OSExchangeDataProviderAura::MarkOriginatedFromRenderer() {
38 // TODO(dcheng): Currently unneeded because ChromeOS Aura correctly separates 40 // TODO(dcheng): Currently unneeded because ChromeOS Aura correctly separates
39 // URL and filename metadata, and does not implement the DownloadURL protocol. 41 // URL and filename metadata, and does not implement the DownloadURL protocol.
40 } 42 }
41 43
42 bool OSExchangeDataProviderAura::DidOriginateFromRenderer() const { 44 bool OSExchangeDataProviderAura::DidOriginateFromRenderer() const {
43 return false; 45 return false;
44 } 46 }
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 212
211 GURL test_url(string_); 213 GURL test_url(string_);
212 if (!test_url.is_valid()) 214 if (!test_url.is_valid())
213 return false; 215 return false;
214 216
215 if (url) 217 if (url)
216 *url = test_url; 218 *url = test_url;
217 return true; 219 return true;
218 } 220 }
219 221
220 ///////////////////////////////////////////////////////////////////////////////
221 // OSExchangeData, public:
222
223 // static
224 OSExchangeData::Provider* OSExchangeData::CreateProvider() {
225 return new OSExchangeDataProviderAura();
226 }
227
228 } // namespace ui 222 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/dragdrop/os_exchange_data_provider_aura.h ('k') | ui/base/dragdrop/os_exchange_data_provider_aurax11.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698