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/linux/mtp_device_delegate_impl_linux.h" | 5 #include "chrome/browser/media_galleries/linux/mtp_device_delegate_impl_linux.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 | 10 |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 uint32_t file_id, | 419 uint32_t file_id, |
420 const std::string& file_name, | 420 const std::string& file_name, |
421 MTPFileNode* parent, | 421 MTPFileNode* parent, |
422 FileIdToMTPFileNodeMap* file_id_to_node_map) | 422 FileIdToMTPFileNodeMap* file_id_to_node_map) |
423 : file_id_(file_id), | 423 : file_id_(file_id), |
424 file_name_(file_name), | 424 file_name_(file_name), |
425 parent_(parent), | 425 parent_(parent), |
426 file_id_to_node_map_(file_id_to_node_map) { | 426 file_id_to_node_map_(file_id_to_node_map) { |
427 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 427 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
428 DCHECK(file_id_to_node_map_); | 428 DCHECK(file_id_to_node_map_); |
429 DCHECK(!ContainsKey(*file_id_to_node_map_, file_id_)); | 429 DCHECK(!base::ContainsKey(*file_id_to_node_map_, file_id_)); |
430 (*file_id_to_node_map_)[file_id_] = this; | 430 (*file_id_to_node_map_)[file_id_] = this; |
431 } | 431 } |
432 | 432 |
433 MTPDeviceDelegateImplLinux::MTPFileNode::~MTPFileNode() { | 433 MTPDeviceDelegateImplLinux::MTPFileNode::~MTPFileNode() { |
434 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 434 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
435 size_t erased = file_id_to_node_map_->erase(file_id_); | 435 size_t erased = file_id_to_node_map_->erase(file_id_); |
436 DCHECK_EQ(1U, erased); | 436 DCHECK_EQ(1U, erased); |
437 } | 437 } |
438 | 438 |
439 const MTPDeviceDelegateImplLinux::MTPFileNode* | 439 const MTPDeviceDelegateImplLinux::MTPFileNode* |
(...skipping 14 matching lines...) Expand all Loading... |
454 children_.set(name, base::WrapUnique(new MTPFileNode(id, name, this, | 454 children_.set(name, base::WrapUnique(new MTPFileNode(id, name, this, |
455 file_id_to_node_map_))); | 455 file_id_to_node_map_))); |
456 } | 456 } |
457 | 457 |
458 void MTPDeviceDelegateImplLinux::MTPFileNode::ClearNonexistentChildren( | 458 void MTPDeviceDelegateImplLinux::MTPFileNode::ClearNonexistentChildren( |
459 const std::set<std::string>& children_to_keep) { | 459 const std::set<std::string>& children_to_keep) { |
460 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 460 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
461 std::set<std::string> children_to_erase; | 461 std::set<std::string> children_to_erase; |
462 for (ChildNodes::const_iterator it = children_.begin(); | 462 for (ChildNodes::const_iterator it = children_.begin(); |
463 it != children_.end(); ++it) { | 463 it != children_.end(); ++it) { |
464 if (ContainsKey(children_to_keep, it->first)) | 464 if (base::ContainsKey(children_to_keep, it->first)) |
465 continue; | 465 continue; |
466 children_to_erase.insert(it->first); | 466 children_to_erase.insert(it->first); |
467 } | 467 } |
468 for (std::set<std::string>::iterator it = children_to_erase.begin(); | 468 for (std::set<std::string>::iterator it = children_to_erase.begin(); |
469 it != children_to_erase.end(); ++it) { | 469 it != children_to_erase.end(); ++it) { |
470 children_.take_and_erase(*it); | 470 children_.take_and_erase(*it); |
471 } | 471 } |
472 } | 472 } |
473 | 473 |
474 bool MTPDeviceDelegateImplLinux::MTPFileNode::DeleteChild(uint32_t file_id) { | 474 bool MTPDeviceDelegateImplLinux::MTPFileNode::DeleteChild(uint32_t file_id) { |
(...skipping 1415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1890 } | 1890 } |
1891 } | 1891 } |
1892 | 1892 |
1893 void CreateMTPDeviceAsyncDelegate( | 1893 void CreateMTPDeviceAsyncDelegate( |
1894 const std::string& device_location, | 1894 const std::string& device_location, |
1895 const bool read_only, | 1895 const bool read_only, |
1896 const CreateMTPDeviceAsyncDelegateCallback& callback) { | 1896 const CreateMTPDeviceAsyncDelegateCallback& callback) { |
1897 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 1897 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
1898 callback.Run(new MTPDeviceDelegateImplLinux(device_location, read_only)); | 1898 callback.Run(new MTPDeviceDelegateImplLinux(device_location, read_only)); |
1899 } | 1899 } |
OLD | NEW |