| OLD | NEW |
| 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 #import "chrome/browser/ui/cocoa/tab_contents/web_drag_source.h" | 5 #import "chrome/browser/ui/cocoa/tab_contents/web_drag_source.h" |
| 6 | 6 |
| 7 #include <sys/param.h> | 7 #include <sys/param.h> |
| 8 | 8 |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 ScopedCrashKey key(kUrlKey, value); | 63 ScopedCrashKey key(kUrlKey, value); |
| 64 | 64 |
| 65 // Images without ALT text will only have a file extension so we need to | 65 // Images without ALT text will only have a file extension so we need to |
| 66 // synthesize one from the provided extension and URL. | 66 // synthesize one from the provided extension and URL. |
| 67 FilePath file_name(FilePathFromFilename(drop_data.file_description_filename)); | 67 FilePath file_name(FilePathFromFilename(drop_data.file_description_filename)); |
| 68 file_name = file_name.BaseName().RemoveExtension(); | 68 file_name = file_name.BaseName().RemoveExtension(); |
| 69 | 69 |
| 70 if (file_name.empty()) { | 70 if (file_name.empty()) { |
| 71 // Retrieve the name from the URL. | 71 // Retrieve the name from the URL. |
| 72 string16 suggested_filename = | 72 string16 suggested_filename = |
| 73 net::GetSuggestedFilename(drop_data.url, "", "", "", string16()); | 73 net::GetSuggestedFilename(drop_data.url, "", "", "", "", string16()); |
| 74 file_name = FilePathFromFilename(suggested_filename); | 74 file_name = FilePathFromFilename(suggested_filename); |
| 75 } | 75 } |
| 76 | 76 |
| 77 file_name = file_name.ReplaceExtension(UTF16ToUTF8(drop_data.file_extension)); | 77 file_name = file_name.ReplaceExtension(UTF16ToUTF8(drop_data.file_extension)); |
| 78 | 78 |
| 79 return file_name; | 79 return file_name; |
| 80 } | 80 } |
| 81 | 81 |
| 82 // This class's sole task is to write out data for a promised file; the caller | 82 // This class's sole task is to write out data for a promised file; the caller |
| 83 // is responsible for opening the file. | 83 // is responsible for opening the file. |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 | 444 |
| 445 - (NSImage*)dragImage { | 445 - (NSImage*)dragImage { |
| 446 if (dragImage_) | 446 if (dragImage_) |
| 447 return dragImage_; | 447 return dragImage_; |
| 448 | 448 |
| 449 // Default to returning a generic image. | 449 // Default to returning a generic image. |
| 450 return gfx::GetCachedImageWithName(@"nav.pdf"); | 450 return gfx::GetCachedImageWithName(@"nav.pdf"); |
| 451 } | 451 } |
| 452 | 452 |
| 453 @end // @implementation WebDragSource (Private) | 453 @end // @implementation WebDragSource (Private) |
| OLD | NEW |