Chromium Code Reviews| 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/storage_monitor/image_capture_device_manager.h" | 5 #include "chrome/browser/storage_monitor/image_capture_device_manager.h" |
| 6 | 6 |
| 7 #import <ImageCaptureCore/ImageCaptureCore.h> | 7 #import <ImageCaptureCore/ImageCaptureCore.h> |
| 8 | 8 |
| 9 #import "chrome/browser/storage_monitor/image_capture_device.h" | 9 #import "chrome/browser/storage_monitor/image_capture_device.h" |
| 10 #include "chrome/browser/storage_monitor/storage_info.h" | 10 #include "chrome/browser/storage_monitor/storage_info.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 ImageCaptureDeviceManager::~ImageCaptureDeviceManager() { | 139 ImageCaptureDeviceManager::~ImageCaptureDeviceManager() { |
| 140 g_image_capture_device_manager = NULL; | 140 g_image_capture_device_manager = NULL; |
| 141 [device_browser_ close]; | 141 [device_browser_ close]; |
| 142 } | 142 } |
| 143 | 143 |
| 144 void ImageCaptureDeviceManager::SetNotifications( | 144 void ImageCaptureDeviceManager::SetNotifications( |
| 145 StorageMonitor::Receiver* notifications) { | 145 StorageMonitor::Receiver* notifications) { |
| 146 [device_browser_ setNotifications:notifications]; | 146 [device_browser_ setNotifications:notifications]; |
| 147 } | 147 } |
| 148 | 148 |
| 149 void ImageCaptureDeviceManager::EjectDevice( | |
| 150 const std::string& uuid, | |
| 151 base::Callback<void(StorageMonitor::EjectStatus)> callback) { | |
| 152 base::scoped_nsobject<ImageCaptureDevice> camera_device( | |
|
sail
2013/09/09 21:26:13
Is there a reason you need to keep a strong refere
Greg Billock
2013/09/12 17:43:59
No, not really. This is how we did it elsewhere, s
| |
| 153 [[device_browser_ deviceForUUID:uuid] retain]); | |
| 154 [camera_device eject]; | |
| 155 [camera_device close]; | |
| 156 callback.Run(StorageMonitor::EJECT_OK); | |
| 157 } | |
| 158 | |
| 149 // static | 159 // static |
| 150 ImageCaptureDevice* ImageCaptureDeviceManager::deviceForUUID( | 160 ImageCaptureDevice* ImageCaptureDeviceManager::deviceForUUID( |
| 151 const std::string& uuid) { | 161 const std::string& uuid) { |
| 152 ImageCaptureDeviceManagerImpl* manager = | 162 ImageCaptureDeviceManagerImpl* manager = |
| 153 g_image_capture_device_manager->device_browser_; | 163 g_image_capture_device_manager->device_browser_; |
| 154 return [manager deviceForUUID:uuid]; | 164 return [manager deviceForUUID:uuid]; |
| 155 } | 165 } |
| 156 | 166 |
| 157 id<ICDeviceBrowserDelegate> ImageCaptureDeviceManager::device_browser() { | 167 id<ICDeviceBrowserDelegate> ImageCaptureDeviceManager::device_browser() { |
| 158 return device_browser_.get(); | 168 return device_browser_.get(); |
| 159 } | 169 } |
| 160 | 170 |
| 161 } // namespace chrome | 171 } // namespace chrome |
| OLD | NEW |