| 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/storage_monitor/image_capture_device.h" | 5 #import "chrome/browser/storage_monitor/image_capture_device.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 - (void)close { | 86 - (void)close { |
| 87 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 87 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 88 closing_ = true; | 88 closing_ = true; |
| 89 [camera_ cancelDownload]; | 89 [camera_ cancelDownload]; |
| 90 [camera_ requestCloseSession]; | 90 [camera_ requestCloseSession]; |
| 91 [camera_ setDelegate:nil]; | 91 [camera_ setDelegate:nil]; |
| 92 listener_.reset(); | 92 listener_.reset(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 - (void)eject { |
| 96 [camera_ requestEjectOrDisconnect]; |
| 97 } |
| 98 |
| 95 - (void)downloadFile:(const std::string&)name | 99 - (void)downloadFile:(const std::string&)name |
| 96 localPath:(const base::FilePath&)localPath { | 100 localPath:(const base::FilePath&)localPath { |
| 97 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 101 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 98 | 102 |
| 99 // Find the file with that name and start download. | 103 // Find the file with that name and start download. |
| 100 for (ICCameraItem* item in [camera_ mediaFiles]) { | 104 for (ICCameraItem* item in [camera_ mediaFiles]) { |
| 101 std::string itemName = PathForCameraItem(item).value(); | 105 std::string itemName = PathForCameraItem(item).value(); |
| 102 if (itemName == name) { | 106 if (itemName == name) { |
| 103 // To create save options for ImageCapture, we need to | 107 // To create save options for ImageCapture, we need to |
| 104 // split the target filename into directory/name | 108 // split the target filename into directory/name |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 // Shared result value from file-copy closure to tell-listener closure. | 216 // Shared result value from file-copy closure to tell-listener closure. |
| 213 base::PlatformFileError* copyResult = new base::PlatformFileError(); | 217 base::PlatformFileError* copyResult = new base::PlatformFileError(); |
| 214 content::BrowserThread::PostTaskAndReply( | 218 content::BrowserThread::PostTaskAndReply( |
| 215 content::BrowserThread::FILE, | 219 content::BrowserThread::FILE, |
| 216 FROM_HERE, | 220 FROM_HERE, |
| 217 base::Bind(&RenameFile, savedPath, saveAsPath, copyResult), | 221 base::Bind(&RenameFile, savedPath, saveAsPath, copyResult), |
| 218 base::Bind(&ReturnRenameResultToListener, listener_, name, copyResult)); | 222 base::Bind(&ReturnRenameResultToListener, listener_, name, copyResult)); |
| 219 } | 223 } |
| 220 | 224 |
| 221 @end // ImageCaptureDevice | 225 @end // ImageCaptureDevice |
| OLD | NEW |