| 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/media_galleries/mac/mtp_device_delegate_impl_mac.h" | 5 #include "chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/memory/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
| 10 #include "base/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
| 11 #include "chrome/browser/media_galleries/mtp_device_delegate_impl.h" | 11 #include "chrome/browser/media_galleries/mtp_device_delegate_impl.h" |
| 12 #include "chrome/browser/storage_monitor/image_capture_device.h" | 12 #include "chrome/browser/storage_monitor/image_capture_device.h" |
| 13 #include "chrome/browser/storage_monitor/image_capture_device_manager.h" | 13 #include "chrome/browser/storage_monitor/image_capture_device_manager.h" |
| 14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 15 #include "webkit/browser/fileapi/async_file_util.h" | 15 #include "webkit/browser/fileapi/async_file_util.h" |
| 16 | 16 |
| 17 namespace chrome { | 17 namespace chrome { |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 virtual void NoMoreItems() OVERRIDE; | 54 virtual void NoMoreItems() OVERRIDE; |
| 55 virtual void DownloadedFile(const std::string& name, | 55 virtual void DownloadedFile(const std::string& name, |
| 56 base::PlatformFileError error) OVERRIDE; | 56 base::PlatformFileError error) OVERRIDE; |
| 57 virtual void DeviceRemoved() OVERRIDE; | 57 virtual void DeviceRemoved() OVERRIDE; |
| 58 | 58 |
| 59 // Used during delegate destruction to ensure there are no more calls | 59 // Used during delegate destruction to ensure there are no more calls |
| 60 // to the delegate by the listener. | 60 // to the delegate by the listener. |
| 61 virtual void ResetDelegate(); | 61 virtual void ResetDelegate(); |
| 62 | 62 |
| 63 private: | 63 private: |
| 64 scoped_nsobject<ImageCaptureDevice> camera_device_; | 64 base::scoped_nsobject<ImageCaptureDevice> camera_device_; |
| 65 | 65 |
| 66 // Weak pointer | 66 // Weak pointer |
| 67 MTPDeviceDelegateImplMac* delegate_; | 67 MTPDeviceDelegateImplMac* delegate_; |
| 68 | 68 |
| 69 DISALLOW_COPY_AND_ASSIGN(DeviceListener); | 69 DISALLOW_COPY_AND_ASSIGN(DeviceListener); |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 void MTPDeviceDelegateImplMac::DeviceListener::OpenCameraSession( | 72 void MTPDeviceDelegateImplMac::DeviceListener::OpenCameraSession( |
| 73 const std::string& device_id) { | 73 const std::string& device_id) { |
| 74 camera_device_.reset( | 74 camera_device_.reset( |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 StorageInfo::Type type; | 474 StorageInfo::Type type; |
| 475 bool cracked = StorageInfo::CrackDeviceId(device_name, &type, &device_id); | 475 bool cracked = StorageInfo::CrackDeviceId(device_name, &type, &device_id); |
| 476 DCHECK(cracked); | 476 DCHECK(cracked); |
| 477 DCHECK_EQ(StorageInfo::MAC_IMAGE_CAPTURE, type); | 477 DCHECK_EQ(StorageInfo::MAC_IMAGE_CAPTURE, type); |
| 478 | 478 |
| 479 cb.Run(new MTPDeviceDelegateImplMac(device_id, device_location)); | 479 cb.Run(new MTPDeviceDelegateImplMac(device_id, device_location)); |
| 480 } | 480 } |
| 481 | 481 |
| 482 } // namespace chrome | 482 } // namespace chrome |
| 483 | 483 |
| OLD | NEW |