| 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 // Download utility implementation for Mac OS X. | 5 // Download utility implementation for Mac OS X. |
| 6 | 6 |
| 7 #include "chrome/browser/ui/cocoa/download/download_util_mac.h" | 7 #include "chrome/browser/ui/cocoa/download/download_util_mac.h" |
| 8 | 8 |
| 9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
| 10 #import "chrome/browser/ui/cocoa/dock_icon.h" | 10 #import "chrome/browser/ui/cocoa/dock_icon.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 FNNotifyByPath( | 34 FNNotifyByPath( |
| 35 reinterpret_cast<const UInt8*>([parentPath fileSystemRepresentation]), | 35 reinterpret_cast<const UInt8*>([parentPath fileSystemRepresentation]), |
| 36 kFNDirectoryModifiedMessage, | 36 kFNDirectoryModifiedMessage, |
| 37 kNilOptions); | 37 kNilOptions); |
| 38 } | 38 } |
| 39 | 39 |
| 40 void DragDownload(const DownloadItem* download, | 40 void DragDownload(const DownloadItem* download, |
| 41 gfx::Image* icon, | 41 gfx::Image* icon, |
| 42 gfx::NativeView view) { | 42 gfx::NativeView view) { |
| 43 NSPasteboard* pasteboard = [NSPasteboard pasteboardWithName:NSDragPboard]; | 43 NSPasteboard* pasteboard = [NSPasteboard pasteboardWithName:NSDragPboard]; |
| 44 AddFileToPasteboard(pasteboard, download->full_path()); | 44 AddFileToPasteboard(pasteboard, download->GetFullPath()); |
| 45 | 45 |
| 46 // Synthesize a drag event, since we don't have access to the actual event | 46 // Synthesize a drag event, since we don't have access to the actual event |
| 47 // that initiated a drag (possibly consumed by the Web UI, for example). | 47 // that initiated a drag (possibly consumed by the Web UI, for example). |
| 48 NSPoint position = [[view window] mouseLocationOutsideOfEventStream]; | 48 NSPoint position = [[view window] mouseLocationOutsideOfEventStream]; |
| 49 NSTimeInterval eventTime = [[NSApp currentEvent] timestamp]; | 49 NSTimeInterval eventTime = [[NSApp currentEvent] timestamp]; |
| 50 NSEvent* dragEvent = [NSEvent mouseEventWithType:NSLeftMouseDragged | 50 NSEvent* dragEvent = [NSEvent mouseEventWithType:NSLeftMouseDragged |
| 51 location:position | 51 location:position |
| 52 modifierFlags:NSLeftMouseDraggedMask | 52 modifierFlags:NSLeftMouseDraggedMask |
| 53 timestamp:eventTime | 53 timestamp:eventTime |
| 54 windowNumber:[[view window] windowNumber] | 54 windowNumber:[[view window] windowNumber] |
| (...skipping 16 matching lines...) Expand all Loading... |
| 71 bool progress_known, | 71 bool progress_known, |
| 72 float progress) { | 72 float progress) { |
| 73 DockIcon* dock_icon = [DockIcon sharedDockIcon]; | 73 DockIcon* dock_icon = [DockIcon sharedDockIcon]; |
| 74 [dock_icon setDownloads:download_count]; | 74 [dock_icon setDownloads:download_count]; |
| 75 [dock_icon setIndeterminate:!progress_known]; | 75 [dock_icon setIndeterminate:!progress_known]; |
| 76 [dock_icon setProgress:progress]; | 76 [dock_icon setProgress:progress]; |
| 77 [dock_icon updateIcon]; | 77 [dock_icon updateIcon]; |
| 78 } | 78 } |
| 79 | 79 |
| 80 } // namespace download_util | 80 } // namespace download_util |
| OLD | NEW |