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

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

Issue 11490010: [Media Galleries] Introduce a new type for Mac Image Capture. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix FILE_PATH_LITERAL Created 8 years 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
« no previous file with comments | « no previous file | chrome/browser/system_monitor/disk_info_mac.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include <vector> 10 #include <vector>
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 249
250 PrefIdFsInfoMap::const_iterator existing_info = 250 PrefIdFsInfoMap::const_iterator existing_info =
251 pref_id_map_.find(pref_id); 251 pref_id_map_.find(pref_id);
252 if (existing_info != pref_id_map_.end()) { 252 if (existing_info != pref_id_map_.end()) {
253 result.push_back(existing_info->second); 253 result.push_back(existing_info->second);
254 new_galleries.insert(pref_id); 254 new_galleries.insert(pref_id);
255 continue; 255 continue;
256 } 256 }
257 257
258 FilePath path = gallery_info.AbsolutePath(); 258 FilePath path = gallery_info.AbsolutePath();
259 if (!path.IsAbsolute()) 259 if (!MediaStorageUtil::CanCreateFileSystem(device_id, path))
260 continue; 260 continue;
261 261
262 std::string fsid; 262 std::string fsid;
263 if (MediaStorageUtil::IsMassStorageDevice(device_id)) { 263 if (MediaStorageUtil::IsMassStorageDevice(device_id)) {
264 fsid = file_system_context_->RegisterFileSystemForMassStorage( 264 fsid = file_system_context_->RegisterFileSystemForMassStorage(
265 device_id, path); 265 device_id, path);
266 } else { 266 } else {
267 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM) 267 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
268 scoped_refptr<ScopedMTPDeviceMapEntry> mtp_device_host; 268 scoped_refptr<ScopedMTPDeviceMapEntry> mtp_device_host;
269 fsid = file_system_context_->RegisterFileSystemForMTPDevice( 269 fsid = file_system_context_->RegisterFileSystemForMTPDevice(
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 } 595 }
596 596
597 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM) 597 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
598 virtual std::string RegisterFileSystemForMTPDevice( 598 virtual std::string RegisterFileSystemForMTPDevice(
599 const std::string& device_id, const FilePath& path, 599 const std::string& device_id, const FilePath& path,
600 scoped_refptr<ScopedMTPDeviceMapEntry>* entry) OVERRIDE { 600 scoped_refptr<ScopedMTPDeviceMapEntry>* entry) OVERRIDE {
601 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 601 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
602 DCHECK(!MediaStorageUtil::IsMassStorageDevice(device_id)); 602 DCHECK(!MediaStorageUtil::IsMassStorageDevice(device_id));
603 603
604 // Sanity checks for |path|. 604 // Sanity checks for |path|.
605 CHECK(path.IsAbsolute()); 605 CHECK(MediaStorageUtil::CanCreateFileSystem(device_id, path));
606 CHECK(!path.ReferencesParent());
607 std::string fs_name(extension_misc::kMediaFileSystemPathPart); 606 std::string fs_name(extension_misc::kMediaFileSystemPathPart);
608 const std::string fsid = 607 const std::string fsid =
609 IsolatedContext::GetInstance()->RegisterFileSystemForPath( 608 IsolatedContext::GetInstance()->RegisterFileSystemForPath(
610 fileapi::kFileSystemTypeDeviceMedia, path, &fs_name); 609 fileapi::kFileSystemTypeDeviceMedia, path, &fs_name);
611 CHECK(!fsid.empty()); 610 CHECK(!fsid.empty());
612 DCHECK(entry); 611 DCHECK(entry);
613 *entry = registry_->GetOrCreateScopedMTPDeviceMapEntry(path.value()); 612 *entry = registry_->GetOrCreateScopedMTPDeviceMapEntry(path.value());
614 return fsid; 613 return fsid;
615 } 614 }
616 #endif 615 #endif
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 730
732 PrefChangeRegistrarMap::iterator pref_it = 731 PrefChangeRegistrarMap::iterator pref_it =
733 pref_change_registrar_map_.find(profile); 732 pref_change_registrar_map_.find(profile);
734 DCHECK(pref_it != pref_change_registrar_map_.end()); 733 DCHECK(pref_it != pref_change_registrar_map_.end());
735 delete pref_it->second; 734 delete pref_it->second;
736 pref_change_registrar_map_.erase(pref_it); 735 pref_change_registrar_map_.erase(pref_it);
737 } 736 }
738 } 737 }
739 738
740 } // namespace chrome 739 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/system_monitor/disk_info_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698