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

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

Issue 22901023: linux_aura: Fix crash when dragging NTP icons. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: exclude files on chromeos Created 7 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 | 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/message_loop/message_pump_aurax11.h" 9 #include "base/message_loop/message_pump_aurax11.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 // but that doesn't match the assumptions of the rest of the system which 189 // but that doesn't match the assumptions of the rest of the system which
190 // expect single types. 190 // expect single types.
191 191
192 if (data.GetType() == atom_cache_.GetAtom(kMimeTypeMozillaURL)) { 192 if (data.GetType() == atom_cache_.GetAtom(kMimeTypeMozillaURL)) {
193 // Mozilla URLs are (UTF16: URL, newline, title). 193 // Mozilla URLs are (UTF16: URL, newline, title).
194 base::string16 unparsed; 194 base::string16 unparsed;
195 data.AssignTo(&unparsed); 195 data.AssignTo(&unparsed);
196 196
197 std::vector<base::string16> tokens; 197 std::vector<base::string16> tokens;
198 size_t num_tokens = Tokenize(unparsed, ASCIIToUTF16("\n"), &tokens); 198 size_t num_tokens = Tokenize(unparsed, ASCIIToUTF16("\n"), &tokens);
199 if (num_tokens >= 2) { 199 if (num_tokens > 0) {
200 if (num_tokens > 1)
201 *title = tokens[1];
202 else
203 *title = string16();
204
200 *url = GURL(tokens[0]); 205 *url = GURL(tokens[0]);
201 *title = tokens[1];
202 return true; 206 return true;
203 } else {
204 NOTREACHED() << "Data that claimed to be a Mozilla URL has "
205 << num_tokens << " tokens instead of 2.";
206 } 207 }
207 } else if (data.GetType() == atom_cache_.GetAtom( 208 } else if (data.GetType() == atom_cache_.GetAtom(
208 Clipboard::kMimeTypeURIList)) { 209 Clipboard::kMimeTypeURIList)) {
209 // uri-lists are newline separated file lists in URL encoding. 210 // uri-lists are newline separated file lists in URL encoding.
210 std::string unparsed; 211 std::string unparsed;
211 data.AssignTo(&unparsed); 212 data.AssignTo(&unparsed);
212 213
213 std::vector<std::string> tokens; 214 std::vector<std::string> tokens;
214 size_t num_tokens = Tokenize(unparsed, "\n", &tokens); 215 size_t num_tokens = Tokenize(unparsed, "\n", &tokens);
215 if (!num_tokens) { 216 if (!num_tokens) {
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 373
373 /////////////////////////////////////////////////////////////////////////////// 374 ///////////////////////////////////////////////////////////////////////////////
374 // OSExchangeData, public: 375 // OSExchangeData, public:
375 376
376 // static 377 // static
377 OSExchangeData::Provider* OSExchangeData::CreateProvider() { 378 OSExchangeData::Provider* OSExchangeData::CreateProvider() {
378 return new OSExchangeDataProviderAuraX11(); 379 return new OSExchangeDataProviderAuraX11();
379 } 380 }
380 381
381 } // namespace ui 382 } // namespace ui
OLDNEW
« no previous file with comments | « build/filename_rules.gypi ('k') | ui/base/dragdrop/os_exchange_data_provider_aurax11_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698