OLD | NEW |
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 "chrome/browser/download/download_status_updater.h" | 5 #include "chrome/browser/download/download_status_updater.h" |
6 | 6 |
7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
8 #include "base/memory/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
| 9 #include "base/strings/sys_string_conversions.h" |
9 #include "base/supports_user_data.h" | 10 #include "base/supports_user_data.h" |
10 #include "base/strings/sys_string_conversions.h" | 11 #import "chrome/browser/ui/cocoa/dock_icon.h" |
11 #include "content/public/browser/download_item.h" | 12 #include "content/public/browser/download_item.h" |
12 #import "chrome/browser/ui/cocoa/dock_icon.h" | |
13 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
14 | 14 |
15 // --- Private 10.8 API for showing progress --- | 15 // --- Private 10.8 API for showing progress --- |
16 // rdar://12058866 http://www.openradar.me/12058866 | 16 // rdar://12058866 http://www.openradar.me/12058866 |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 NSString* const kNSProgressAppBundleIdentifierKey = | 20 NSString* const kNSProgressAppBundleIdentifierKey = |
21 @"NSProgressAppBundleIdentifierKey"; | 21 @"NSProgressAppBundleIdentifierKey"; |
22 NSString* const kNSProgressEstimatedTimeKey = | 22 NSString* const kNSProgressEstimatedTimeKey = |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 } | 162 } |
163 virtual ~CrNSProgressUserData() { | 163 virtual ~CrNSProgressUserData() { |
164 [progress_.get() unpublish]; | 164 [progress_.get() unpublish]; |
165 } | 165 } |
166 | 166 |
167 NSProgress* progress() const { return progress_.get(); } | 167 NSProgress* progress() const { return progress_.get(); } |
168 base::FilePath target() const { return target_; } | 168 base::FilePath target() const { return target_; } |
169 void setTarget(const base::FilePath& target) { target_ = target; } | 169 void setTarget(const base::FilePath& target) { target_ = target; } |
170 | 170 |
171 private: | 171 private: |
172 scoped_nsobject<NSProgress> progress_; | 172 base::scoped_nsobject<NSProgress> progress_; |
173 base::FilePath target_; | 173 base::FilePath target_; |
174 }; | 174 }; |
175 | 175 |
176 void UpdateAppIcon(int download_count, | 176 void UpdateAppIcon(int download_count, |
177 bool progress_known, | 177 bool progress_known, |
178 float progress) { | 178 float progress) { |
179 DockIcon* dock_icon = [DockIcon sharedDockIcon]; | 179 DockIcon* dock_icon = [DockIcon sharedDockIcon]; |
180 [dock_icon setDownloads:download_count]; | 180 [dock_icon setDownloads:download_count]; |
181 [dock_icon setIndeterminate:!progress_known]; | 181 [dock_icon setIndeterminate:!progress_known]; |
182 [dock_icon setProgress:progress]; | 182 [dock_icon setProgress:progress]; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 } | 299 } |
300 | 300 |
301 // Notify the Finder. | 301 // Notify the Finder. |
302 NSString* parent_path = [download_path stringByDeletingLastPathComponent]; | 302 NSString* parent_path = [download_path stringByDeletingLastPathComponent]; |
303 FNNotifyByPath( | 303 FNNotifyByPath( |
304 reinterpret_cast<const UInt8*>([parent_path fileSystemRepresentation]), | 304 reinterpret_cast<const UInt8*>([parent_path fileSystemRepresentation]), |
305 kFNDirectoryModifiedMessage, | 305 kFNDirectoryModifiedMessage, |
306 kNilOptions); | 306 kNilOptions); |
307 } | 307 } |
308 } | 308 } |
OLD | NEW |