Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac.mm

Issue 947943002: Implement CopyFileFromLocal of MTPDeviceAsyncDelegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/mac/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"
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 void MTPDeviceDelegateImplMac::ReadBytes( 202 void MTPDeviceDelegateImplMac::ReadBytes(
203 const base::FilePath& device_file_path, 203 const base::FilePath& device_file_path,
204 const scoped_refptr<net::IOBuffer>& buf, 204 const scoped_refptr<net::IOBuffer>& buf,
205 int64 offset, 205 int64 offset,
206 int buf_len, 206 int buf_len,
207 const ReadBytesSuccessCallback& success_callback, 207 const ReadBytesSuccessCallback& success_callback,
208 const ErrorCallback& error_callback) { 208 const ErrorCallback& error_callback) {
209 NOTREACHED(); 209 NOTREACHED();
210 } 210 }
211 211
212 bool MTPDeviceDelegateImplMac::IsReadOnly() {
213 return true;
214 }
215
216 void MTPDeviceDelegateImplMac::CopyFileFromLocal(
217 const base::FilePath& source_file_path,
218 const base::FilePath& device_file_path,
219 const CopyFileFromLocalSuccessCallback& success_callback,
220 const ErrorCallback& error_callback) {
221 NOTREACHED();
222 }
223
212 void MTPDeviceDelegateImplMac::CancelPendingTasksAndDeleteDelegate() { 224 void MTPDeviceDelegateImplMac::CancelPendingTasksAndDeleteDelegate() {
213 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, 225 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
214 base::Bind(&MTPDeviceDelegateImplMac::CancelAndDelete, 226 base::Bind(&MTPDeviceDelegateImplMac::CancelAndDelete,
215 base::Unretained(this))); 227 base::Unretained(this)));
216 } 228 }
217 229
218 void MTPDeviceDelegateImplMac::GetFileInfoImpl( 230 void MTPDeviceDelegateImplMac::GetFileInfoImpl(
219 const base::FilePath& file_path, 231 const base::FilePath& file_path,
220 base::File::Info* file_info, 232 base::File::Info* file_info,
221 base::File::Error* error) { 233 base::File::Error* error) {
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 ReadDirectorySuccessCallback success_cb, 485 ReadDirectorySuccessCallback success_cb,
474 ErrorCallback error_cb) 486 ErrorCallback error_cb)
475 : directory(dir), 487 : directory(dir),
476 success_callback(success_cb), 488 success_callback(success_cb),
477 error_callback(error_cb) {} 489 error_callback(error_cb) {}
478 490
479 MTPDeviceDelegateImplMac::ReadDirectoryRequest::~ReadDirectoryRequest() {} 491 MTPDeviceDelegateImplMac::ReadDirectoryRequest::~ReadDirectoryRequest() {}
480 492
481 void CreateMTPDeviceAsyncDelegate( 493 void CreateMTPDeviceAsyncDelegate(
482 const base::FilePath::StringType& device_location, 494 const base::FilePath::StringType& device_location,
495 const bool read_only,
483 const CreateMTPDeviceAsyncDelegateCallback& cb) { 496 const CreateMTPDeviceAsyncDelegateCallback& cb) {
497 // Write operation is not supported on Mac.
498 DCHECK(read_only);
499
484 std::string device_name = base::FilePath(device_location).BaseName().value(); 500 std::string device_name = base::FilePath(device_location).BaseName().value();
485 std::string device_id; 501 std::string device_id;
486 storage_monitor::StorageInfo::Type type; 502 storage_monitor::StorageInfo::Type type;
487 bool cracked = storage_monitor::StorageInfo::CrackDeviceId( 503 bool cracked = storage_monitor::StorageInfo::CrackDeviceId(
488 device_name, &type, &device_id); 504 device_name, &type, &device_id);
489 DCHECK(cracked); 505 DCHECK(cracked);
490 DCHECK_EQ(storage_monitor::StorageInfo::MAC_IMAGE_CAPTURE, type); 506 DCHECK_EQ(storage_monitor::StorageInfo::MAC_IMAGE_CAPTURE, type);
491 507
492 cb.Run(new MTPDeviceDelegateImplMac(device_id, device_location)); 508 cb.Run(new MTPDeviceDelegateImplMac(device_id, device_location));
493 } 509 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698