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

Side by Side Diff: chrome/browser/media_gallery/media_file_system_registry.cc

Issue 10876093: Improve the device type constants. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 // MediaFileSystemRegistry implementation. 5 // MediaFileSystemRegistry implementation.
6 6
7 #include "chrome/browser/media_gallery/media_file_system_registry.h" 7 #include "chrome/browser/media_gallery/media_file_system_registry.h"
8 8
9 #include <set> 9 #include <set>
10 10
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 88 }
89 89
90 // TODO(thestig) Handle overlap between devices and media directories. 90 // TODO(thestig) Handle overlap between devices and media directories.
91 SystemMonitor* monitor = SystemMonitor::Get(); 91 SystemMonitor* monitor = SystemMonitor::Get();
92 const std::vector<SystemMonitor::RemovableStorageInfo> media_devices = 92 const std::vector<SystemMonitor::RemovableStorageInfo> media_devices =
93 monitor->GetAttachedRemovableStorage(); 93 monitor->GetAttachedRemovableStorage();
94 for (size_t i = 0; i < media_devices.size(); ++i) { 94 for (size_t i = 0; i < media_devices.size(); ++i) {
95 MediaStorageUtil::Type type; 95 MediaStorageUtil::Type type;
96 MediaStorageUtil::CrackDeviceId(media_devices[i].device_id, &type, NULL); 96 MediaStorageUtil::CrackDeviceId(media_devices[i].device_id, &type, NULL);
97 // TODO(vandebo) Handle MTP devices. 97 // TODO(vandebo) Handle MTP devices.
98 if (type != MediaStorageUtil::USB_MTP && 98 if (type != MediaStorageUtil::MTP_OR_PTP &&
99 IsGalleryPermittedForExtension(extension, media_devices[i].location)) { 99 IsGalleryPermittedForExtension(extension, media_devices[i].location)) {
100 device_id_map_.insert(std::make_pair(media_devices[i].device_id, 100 device_id_map_.insert(std::make_pair(media_devices[i].device_id,
101 media_devices[i])); 101 media_devices[i]));
102 FilePath path(media_devices[i].location); 102 FilePath path(media_devices[i].location);
103 const std::string fsid = RegisterPathAsFileSystem(path); 103 const std::string fsid = RegisterPathAsFileSystem(path);
104 child_it->second.insert(std::make_pair(path, fsid)); 104 child_it->second.insert(std::make_pair(path, fsid));
105 } 105 }
106 } 106 }
107 107
108 MediaPathToFSIDMap& child_map = child_it->second; 108 MediaPathToFSIDMap& child_map = child_it->second;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 MediaPathToFSIDMap& child_map = child_it->second; 219 MediaPathToFSIDMap& child_map = child_it->second;
220 MediaPathToFSIDMap::iterator media_path_it = child_map.find(path); 220 MediaPathToFSIDMap::iterator media_path_it = child_map.find(path);
221 if (media_path_it == child_map.end()) 221 if (media_path_it == child_map.end())
222 continue; 222 continue;
223 223
224 child_map.erase(media_path_it); 224 child_map.erase(media_path_it);
225 } 225 }
226 } 226 }
227 227
228 } // namespace chrome 228 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698