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

Side by Side Diff: chrome/browser/ui/views/tab_contents/tab_contents_drag_win.cc

Issue 6241001: wstring: make net::GetSuggestedFilename return utf-16 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed Created 9 years, 11 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
« no previous file with comments | « chrome/browser/download/save_package.cc ('k') | net/base/net_util.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/ui/views/tab_contents/tab_contents_drag_win.h" 5 #include "chrome/browser/ui/views/tab_contents/tab_contents_drag_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 } 224 }
225 225
226 void TabContentsDragWin::PrepareDragForFileContents( 226 void TabContentsDragWin::PrepareDragForFileContents(
227 const WebDropData& drop_data, ui::OSExchangeData* data) { 227 const WebDropData& drop_data, ui::OSExchangeData* data) {
228 // Images without ALT text will only have a file extension so we need to 228 // Images without ALT text will only have a file extension so we need to
229 // synthesize one from the provided extension and URL. 229 // synthesize one from the provided extension and URL.
230 FilePath file_name(drop_data.file_description_filename); 230 FilePath file_name(drop_data.file_description_filename);
231 file_name = file_name.BaseName().RemoveExtension(); 231 file_name = file_name.BaseName().RemoveExtension();
232 if (file_name.value().empty()) { 232 if (file_name.value().empty()) {
233 // Retrieve the name from the URL. 233 // Retrieve the name from the URL.
234 file_name = net::GetSuggestedFilename(drop_data.url, "", "", FilePath()); 234 file_name = FilePath(
235 net::GetSuggestedFilename(drop_data.url, "", "", string16()));
235 if (file_name.value().size() + drop_data.file_extension.size() + 1 > 236 if (file_name.value().size() + drop_data.file_extension.size() + 1 >
236 MAX_PATH) { 237 MAX_PATH) {
237 file_name = FilePath(file_name.value().substr( 238 file_name = FilePath(file_name.value().substr(
238 0, MAX_PATH - drop_data.file_extension.size() - 2)); 239 0, MAX_PATH - drop_data.file_extension.size() - 2));
239 } 240 }
240 } 241 }
241 file_name = file_name.ReplaceExtension(drop_data.file_extension); 242 file_name = file_name.ReplaceExtension(drop_data.file_extension);
242 data->SetFileContents(file_name.value(), drop_data.file_contents); 243 data->SetFileContents(file_name.value(), drop_data.file_contents);
243 } 244 }
244 245
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 359
359 void TabContentsDragWin::OnDataObjectDisposed() { 360 void TabContentsDragWin::OnDataObjectDisposed() {
360 DCHECK(drag_drop_thread_id_ == base::PlatformThread::CurrentId()); 361 DCHECK(drag_drop_thread_id_ == base::PlatformThread::CurrentId());
361 362
362 // The drag-and-drop thread is only closed after OLE is done with 363 // The drag-and-drop thread is only closed after OLE is done with
363 // DataObjectImpl. 364 // DataObjectImpl.
364 BrowserThread::PostTask( 365 BrowserThread::PostTask(
365 BrowserThread::UI, FROM_HERE, 366 BrowserThread::UI, FROM_HERE,
366 NewRunnableMethod(this, &TabContentsDragWin::CloseThread)); 367 NewRunnableMethod(this, &TabContentsDragWin::CloseThread));
367 } 368 }
OLDNEW
« no previous file with comments | « chrome/browser/download/save_package.cc ('k') | net/base/net_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698