| 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 #import "chrome/browser/system_monitor/image_capture_device.h" | 5 #import "chrome/browser/system_monitor/image_capture_device.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/system_monitor/system_monitor.h" | 8 #include "base/system_monitor/system_monitor.h" |
| 9 #include "chrome/browser/system_monitor/media_storage_util.h" | 9 #include "chrome/browser/system_monitor/media_storage_util.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 listener_->NoMoreItems(); | 152 listener_->NoMoreItems(); |
| 153 } | 153 } |
| 154 | 154 |
| 155 - (void)didDownloadFile:(ICCameraFile*)file | 155 - (void)didDownloadFile:(ICCameraFile*)file |
| 156 error:(NSError*)error | 156 error:(NSError*)error |
| 157 options:(NSDictionary*)options | 157 options:(NSDictionary*)options |
| 158 contextInfo:(void*)contextInfo { | 158 contextInfo:(void*)contextInfo { |
| 159 std::string name = base::SysNSStringToUTF8([file name]); | 159 std::string name = base::SysNSStringToUTF8([file name]); |
| 160 | 160 |
| 161 if (error) { | 161 if (error) { |
| 162 DLOG(INFO) << "error..." |
| 163 << base::SysNSStringToUTF8([error localizedDescription]); |
| 162 if (listener_) | 164 if (listener_) |
| 163 listener_->DownloadedFile(name, base::PLATFORM_FILE_ERROR_FAILED); | 165 listener_->DownloadedFile(name, base::PLATFORM_FILE_ERROR_FAILED); |
| 164 return; | 166 return; |
| 165 } | 167 } |
| 166 | 168 |
| 167 std::string savedFilename = | 169 std::string savedFilename = |
| 168 base::SysNSStringToUTF8([options objectForKey:ICSavedFilename]); | 170 base::SysNSStringToUTF8([options objectForKey:ICSavedFilename]); |
| 169 std::string saveAsFilename = | 171 std::string saveAsFilename = |
| 170 base::SysNSStringToUTF8([options objectForKey:ICSaveAsFilename]); | 172 base::SysNSStringToUTF8([options objectForKey:ICSaveAsFilename]); |
| 171 if (savedFilename == saveAsFilename) { | 173 if (savedFilename == saveAsFilename) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 184 // Shared result value from file-copy closure to tell-listener closure. | 186 // Shared result value from file-copy closure to tell-listener closure. |
| 185 base::PlatformFileError* copyResult = new base::PlatformFileError(); | 187 base::PlatformFileError* copyResult = new base::PlatformFileError(); |
| 186 content::BrowserThread::PostTaskAndReply( | 188 content::BrowserThread::PostTaskAndReply( |
| 187 content::BrowserThread::FILE, | 189 content::BrowserThread::FILE, |
| 188 FROM_HERE, | 190 FROM_HERE, |
| 189 base::Bind(&RenameFile, savedPath, saveAsPath, copyResult), | 191 base::Bind(&RenameFile, savedPath, saveAsPath, copyResult), |
| 190 base::Bind(&ReturnRenameResultToListener, listener_, name, copyResult)); | 192 base::Bind(&ReturnRenameResultToListener, listener_, name, copyResult)); |
| 191 } | 193 } |
| 192 | 194 |
| 193 @end // ImageCaptureDevice | 195 @end // ImageCaptureDevice |
| OLD | NEW |