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

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

Issue 208313009: Fix the HTML5 drag and drop demos on Linux and CrOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 #include "ui/base/dragdrop/os_exchange_data_provider_aurax11.h" 5 #include "ui/base/dragdrop/os_exchange_data_provider_aurax11.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ref_counted_memory.h" 8 #include "base/memory/ref_counted_memory.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 std::vector<unsigned char> data; 148 std::vector<unsigned char> data;
149 ui::AddString16ToVector(spec, &data); 149 ui::AddString16ToVector(spec, &data);
150 ui::AddString16ToVector(base::ASCIIToUTF16("\n"), &data); 150 ui::AddString16ToVector(base::ASCIIToUTF16("\n"), &data);
151 ui::AddString16ToVector(title, &data); 151 ui::AddString16ToVector(title, &data);
152 scoped_refptr<base::RefCountedMemory> mem( 152 scoped_refptr<base::RefCountedMemory> mem(
153 base::RefCountedBytes::TakeVector(&data)); 153 base::RefCountedBytes::TakeVector(&data));
154 154
155 format_map_.Insert(atom_cache_.GetAtom(kMimeTypeMozillaURL), mem); 155 format_map_.Insert(atom_cache_.GetAtom(kMimeTypeMozillaURL), mem);
156 156
157 // Set a string fallback as well. 157 // Set a string fallback as well.
158 SetString(spec); 158 if (!HasString())
159 SetString(spec);
159 160
160 // Return early if this drag already contains file contents (this implies 161 // Return early if this drag already contains file contents (this implies
161 // that file contents must be populated before URLs). Nautilus (and possibly 162 // that file contents must be populated before URLs). Nautilus (and possibly
162 // other file managers) prefer _NETSCAPE_URL over the X Direct Save 163 // other file managers) prefer _NETSCAPE_URL over the X Direct Save
163 // protocol, but we want to prioritize XDS in this case. 164 // protocol, but we want to prioritize XDS in this case.
164 if (!file_contents_name_.empty()) 165 if (!file_contents_name_.empty())
165 return; 166 return;
166 167
167 // Set _NETSCAPE_URL for file managers like Nautilus that use it as a hint 168 // Set _NETSCAPE_URL for file managers like Nautilus that use it as a hint
168 // to create a link to the URL. Setting text/uri-list doesn't work because 169 // to create a link to the URL. Setting text/uri-list doesn't work because
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 542
542 /////////////////////////////////////////////////////////////////////////////// 543 ///////////////////////////////////////////////////////////////////////////////
543 // OSExchangeData, public: 544 // OSExchangeData, public:
544 545
545 // static 546 // static
546 OSExchangeData::Provider* OSExchangeData::CreateProvider() { 547 OSExchangeData::Provider* OSExchangeData::CreateProvider() {
547 return new OSExchangeDataProviderAuraX11(); 548 return new OSExchangeDataProviderAuraX11();
548 } 549 }
549 550
550 } // namespace ui 551 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698