OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
9 #include "base/mac/sdk_forward_declarations.h" | 9 #include "base/mac/sdk_forward_declarations.h" |
10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 } | 94 } |
95 | 95 |
96 const char kCrNSProgressUserDataKey[] = "CrNSProgressUserData"; | 96 const char kCrNSProgressUserDataKey[] = "CrNSProgressUserData"; |
97 | 97 |
98 class CrNSProgressUserData : public base::SupportsUserData::Data { | 98 class CrNSProgressUserData : public base::SupportsUserData::Data { |
99 public: | 99 public: |
100 CrNSProgressUserData(NSProgress* progress, const base::FilePath& target) | 100 CrNSProgressUserData(NSProgress* progress, const base::FilePath& target) |
101 : target_(target) { | 101 : target_(target) { |
102 progress_.reset(progress); | 102 progress_.reset(progress); |
103 } | 103 } |
104 virtual ~CrNSProgressUserData() { | 104 ~CrNSProgressUserData() override { [progress_.get() unpublish]; } |
105 [progress_.get() unpublish]; | |
106 } | |
107 | 105 |
108 NSProgress* progress() const { return progress_.get(); } | 106 NSProgress* progress() const { return progress_.get(); } |
109 base::FilePath target() const { return target_; } | 107 base::FilePath target() const { return target_; } |
110 void setTarget(const base::FilePath& target) { target_ = target; } | 108 void setTarget(const base::FilePath& target) { target_ = target; } |
111 | 109 |
112 private: | 110 private: |
113 base::scoped_nsobject<NSProgress> progress_; | 111 base::scoped_nsobject<NSProgress> progress_; |
114 base::FilePath target_; | 112 base::FilePath target_; |
115 }; | 113 }; |
116 | 114 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 } | 242 } |
245 | 243 |
246 // Notify the Finder. | 244 // Notify the Finder. |
247 NSString* parent_path = [download_path stringByDeletingLastPathComponent]; | 245 NSString* parent_path = [download_path stringByDeletingLastPathComponent]; |
248 FNNotifyByPath( | 246 FNNotifyByPath( |
249 reinterpret_cast<const UInt8*>([parent_path fileSystemRepresentation]), | 247 reinterpret_cast<const UInt8*>([parent_path fileSystemRepresentation]), |
250 kFNDirectoryModifiedMessage, | 248 kFNDirectoryModifiedMessage, |
251 kNilOptions); | 249 kNilOptions); |
252 } | 250 } |
253 } | 251 } |
OLD | NEW |