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

Side by Side Diff: chrome/browser/storage_monitor/storage_monitor_chromeos.cc

Issue 19489006: Media Galleries: Move gallery name generation back to StorageMonitor. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: rebase Created 7 years, 4 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 | Annotate | Revision Log
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 // chromeos::StorageMonitorCros implementation. 5 // chromeos::StorageMonitorCros implementation.
6 6
7 #include "chrome/browser/storage_monitor/storage_monitor_chromeos.h" 7 #include "chrome/browser/storage_monitor/storage_monitor_chromeos.h"
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 device_label); 63 device_label);
64 if (unique_id.empty()) 64 if (unique_id.empty())
65 return false; 65 return false;
66 66
67 chrome::StorageInfo::Type type = has_dcim ? 67 chrome::StorageInfo::Type type = has_dcim ?
68 chrome::StorageInfo::REMOVABLE_MASS_STORAGE_WITH_DCIM : 68 chrome::StorageInfo::REMOVABLE_MASS_STORAGE_WITH_DCIM :
69 chrome::StorageInfo::REMOVABLE_MASS_STORAGE_NO_DCIM; 69 chrome::StorageInfo::REMOVABLE_MASS_STORAGE_NO_DCIM;
70 70
71 *info = chrome::StorageInfo( 71 *info = chrome::StorageInfo(
72 chrome::StorageInfo::MakeDeviceId(type, unique_id), 72 chrome::StorageInfo::MakeDeviceId(type, unique_id),
73 string16(),
74 mount_info.mount_path, 73 mount_info.mount_path,
75 device_label, 74 device_label,
76 UTF8ToUTF16(disk->vendor_name()), 75 base::UTF8ToUTF16(disk->vendor_name()),
77 UTF8ToUTF16(disk->product_name()), 76 base::UTF8ToUTF16(disk->product_name()),
78 disk->total_size_in_bytes()); 77 disk->total_size_in_bytes());
79 return true; 78 return true;
80 } 79 }
81 80
82 // Returns whether the mount point in |mount_info| is a media device or not. 81 // Returns whether the mount point in |mount_info| is a media device or not.
83 bool CheckMountedPathOnFileThread( 82 bool CheckMountedPathOnFileThread(
84 const disks::DiskMountManager::MountPointInfo& mount_info) { 83 const disks::DiskMountManager::MountPointInfo& mount_info) {
85 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); 84 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
86 return chrome::MediaStorageUtil::HasDcim( 85 return chrome::MediaStorageUtil::HasDcim(
87 base::FilePath(mount_info.mount_path)); 86 base::FilePath(mount_info.mount_path));
88 } 87 }
89 88
90 } // namespace 89 } // namespace
91 90
92 using content::BrowserThread; 91 using content::BrowserThread;
93 using chrome::StorageInfo;
94 92
95 StorageMonitorCros::StorageMonitorCros() 93 StorageMonitorCros::StorageMonitorCros()
96 : weak_ptr_factory_(this) { 94 : weak_ptr_factory_(this) {
97 } 95 }
98 96
99 StorageMonitorCros::~StorageMonitorCros() { 97 StorageMonitorCros::~StorageMonitorCros() {
100 disks::DiskMountManager* manager = disks::DiskMountManager::GetInstance(); 98 disks::DiskMountManager* manager = disks::DiskMountManager::GetInstance();
101 if (manager) { 99 if (manager) {
102 manager->RemoveObserver(this); 100 manager->RemoveObserver(this);
103 } 101 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 199
202 void StorageMonitorCros::SetMediaTransferProtocolManagerForTest( 200 void StorageMonitorCros::SetMediaTransferProtocolManagerForTest(
203 device::MediaTransferProtocolManager* test_manager) { 201 device::MediaTransferProtocolManager* test_manager) {
204 DCHECK(!media_transfer_protocol_manager_); 202 DCHECK(!media_transfer_protocol_manager_);
205 media_transfer_protocol_manager_.reset(test_manager); 203 media_transfer_protocol_manager_.reset(test_manager);
206 } 204 }
207 205
208 206
209 bool StorageMonitorCros::GetStorageInfoForPath( 207 bool StorageMonitorCros::GetStorageInfoForPath(
210 const base::FilePath& path, 208 const base::FilePath& path,
211 StorageInfo* device_info) const { 209 chrome::StorageInfo* device_info) const {
212 DCHECK(device_info); 210 DCHECK(device_info);
213 211
214 if (media_transfer_protocol_device_observer_->GetStorageInfoForPath( 212 if (media_transfer_protocol_device_observer_->GetStorageInfoForPath(
215 path, device_info)) { 213 path, device_info)) {
216 return true; 214 return true;
217 } 215 }
218 216
219 if (!path.IsAbsolute()) 217 if (!path.IsAbsolute())
220 return false; 218 return false;
221 219
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 298
301 } // namespace chromeos 299 } // namespace chromeos
302 300
303 namespace chrome { 301 namespace chrome {
304 302
305 StorageMonitor* StorageMonitor::Create() { 303 StorageMonitor* StorageMonitor::Create() {
306 return new chromeos::StorageMonitorCros(); 304 return new chromeos::StorageMonitorCros();
307 } 305 }
308 306
309 } // namespace chrome 307 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/storage_monitor/storage_monitor.cc ('k') | chrome/browser/storage_monitor/storage_monitor_chromeos_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698