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

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

Issue 7607013: Call GenerateSafeFilename() from GetSuggestedFilename(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 9 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
« no previous file with comments | « chrome/browser/ui/cocoa/tab_contents/web_drag_source.mm ('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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 223
224 void TabContentsDragWin::PrepareDragForFileContents( 224 void TabContentsDragWin::PrepareDragForFileContents(
225 const WebDropData& drop_data, ui::OSExchangeData* data) { 225 const WebDropData& drop_data, ui::OSExchangeData* data) {
226 // Images without ALT text will only have a file extension so we need to 226 // Images without ALT text will only have a file extension so we need to
227 // synthesize one from the provided extension and URL. 227 // synthesize one from the provided extension and URL.
228 FilePath file_name(drop_data.file_description_filename); 228 FilePath file_name(drop_data.file_description_filename);
229 file_name = file_name.BaseName().RemoveExtension(); 229 file_name = file_name.BaseName().RemoveExtension();
230 if (file_name.value().empty()) { 230 if (file_name.value().empty()) {
231 // Retrieve the name from the URL. 231 // Retrieve the name from the URL.
232 file_name = FilePath( 232 file_name = FilePath(
233 net::GetSuggestedFilename(drop_data.url, "", "", "", string16())); 233 net::GetSuggestedFilename(drop_data.url, "", "", "", "", string16()));
234 if (file_name.value().size() + drop_data.file_extension.size() + 1 > 234 if (file_name.value().size() + drop_data.file_extension.size() + 1 >
235 MAX_PATH) { 235 MAX_PATH) {
236 file_name = FilePath(file_name.value().substr( 236 file_name = FilePath(file_name.value().substr(
237 0, MAX_PATH - drop_data.file_extension.size() - 2)); 237 0, MAX_PATH - drop_data.file_extension.size() - 2));
238 } 238 }
239 } 239 }
240 file_name = file_name.ReplaceExtension(drop_data.file_extension); 240 file_name = file_name.ReplaceExtension(drop_data.file_extension);
241 data->SetFileContents(file_name, drop_data.file_contents); 241 data->SetFileContents(file_name, drop_data.file_contents);
242 } 242 }
243 243
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 357
358 void TabContentsDragWin::OnDataObjectDisposed() { 358 void TabContentsDragWin::OnDataObjectDisposed() {
359 DCHECK(drag_drop_thread_id_ == base::PlatformThread::CurrentId()); 359 DCHECK(drag_drop_thread_id_ == base::PlatformThread::CurrentId());
360 360
361 // The drag-and-drop thread is only closed after OLE is done with 361 // The drag-and-drop thread is only closed after OLE is done with
362 // DataObjectImpl. 362 // DataObjectImpl.
363 BrowserThread::PostTask( 363 BrowserThread::PostTask(
364 BrowserThread::UI, FROM_HERE, 364 BrowserThread::UI, FROM_HERE,
365 NewRunnableMethod(this, &TabContentsDragWin::CloseThread)); 365 NewRunnableMethod(this, &TabContentsDragWin::CloseThread));
366 } 366 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/tab_contents/web_drag_source.mm ('k') | net/base/net_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698