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

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: 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
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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 328
329 PrefIdFsInfoMap::const_iterator existing_info = 329 PrefIdFsInfoMap::const_iterator existing_info =
330 pref_id_map_.find(pref_id); 330 pref_id_map_.find(pref_id);
331 if (existing_info != pref_id_map_.end()) { 331 if (existing_info != pref_id_map_.end()) {
332 result.push_back(existing_info->second); 332 result.push_back(existing_info->second);
333 new_galleries.insert(pref_id); 333 new_galleries.insert(pref_id);
334 continue; 334 continue;
335 } 335 }
336 336
337 FilePath path = gallery_info.AbsolutePath(); 337 FilePath path = gallery_info.AbsolutePath();
338 if (!path.IsAbsolute()) 338 if (!MediaStorageUtil::CanCreateFileSystem(device_id, path))
339 continue; 339 continue;
340 340
341 std::string fsid; 341 std::string fsid;
342 if (MediaStorageUtil::IsMassStorageDevice(device_id)) { 342 if (MediaStorageUtil::IsMassStorageDevice(device_id)) {
343 fsid = file_system_context_->RegisterFileSystemForMassStorage( 343 fsid = file_system_context_->RegisterFileSystemForMassStorage(
344 device_id, path); 344 device_id, path);
345 } else { 345 } else {
346 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM) 346 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
347 LOG(INFO) << "Getting MTP fs for " << path.value();
Lei Zhang 2012/12/10 21:53:41 Remove these debugging statements?
Greg Billock 2012/12/10 22:39:41 Done.
347 scoped_refptr<ScopedMTPDeviceMapEntry> mtp_device_host; 348 scoped_refptr<ScopedMTPDeviceMapEntry> mtp_device_host;
348 fsid = file_system_context_->RegisterFileSystemForMTPDevice( 349 fsid = file_system_context_->RegisterFileSystemForMTPDevice(
349 device_id, path, &mtp_device_host); 350 device_id, path, &mtp_device_host);
350 DCHECK(mtp_device_host.get()); 351 DCHECK(mtp_device_host.get());
351 media_device_map_references_[pref_id] = mtp_device_host; 352 media_device_map_references_[pref_id] = mtp_device_host;
352 #else 353 #else
353 NOTIMPLEMENTED(); 354 NOTIMPLEMENTED();
354 continue; 355 continue;
355 #endif 356 #endif
356 } 357 }
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 } 634 }
634 635
635 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM) 636 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
636 virtual std::string RegisterFileSystemForMTPDevice( 637 virtual std::string RegisterFileSystemForMTPDevice(
637 const std::string& device_id, const FilePath& path, 638 const std::string& device_id, const FilePath& path,
638 scoped_refptr<ScopedMTPDeviceMapEntry>* entry) { 639 scoped_refptr<ScopedMTPDeviceMapEntry>* entry) {
639 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 640 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
640 DCHECK(!MediaStorageUtil::IsMassStorageDevice(device_id)); 641 DCHECK(!MediaStorageUtil::IsMassStorageDevice(device_id));
641 642
642 // Sanity checks for |path|. 643 // Sanity checks for |path|.
643 CHECK(path.IsAbsolute()); 644 CHECK(MediaStorageUtil::CanCreateFileSystem(device_id, path));
644 CHECK(!path.ReferencesParent());
645 std::string fs_name(extension_misc::kMediaFileSystemPathPart); 645 std::string fs_name(extension_misc::kMediaFileSystemPathPart);
646 const std::string fsid = 646 const std::string fsid =
647 IsolatedContext::GetInstance()->RegisterFileSystemForPath( 647 IsolatedContext::GetInstance()->RegisterFileSystemForPath(
648 fileapi::kFileSystemTypeDeviceMedia, path, &fs_name); 648 fileapi::kFileSystemTypeDeviceMedia, path, &fs_name);
649 LOG(INFO) << "Registered for type device-media : " << path.value();
649 CHECK(!fsid.empty()); 650 CHECK(!fsid.empty());
650 DCHECK(entry); 651 DCHECK(entry);
651 *entry = registry_->GetOrCreateScopedMTPDeviceMapEntry(path.value()); 652 *entry = registry_->GetOrCreateScopedMTPDeviceMapEntry(path.value());
652 return fsid; 653 return fsid;
653 } 654 }
654 #endif 655 #endif
655 656
656 virtual void RevokeFileSystem(const std::string& fsid) { 657 virtual void RevokeFileSystem(const std::string& fsid) {
657 IsolatedContext::GetInstance()->RevokeFileSystem(fsid); 658 IsolatedContext::GetInstance()->RevokeFileSystem(fsid);
658 } 659 }
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 758
758 PrefChangeRegistrarMap::iterator pref_it = 759 PrefChangeRegistrarMap::iterator pref_it =
759 pref_change_registrar_map_.find(profile); 760 pref_change_registrar_map_.find(profile);
760 DCHECK(pref_it != pref_change_registrar_map_.end()); 761 DCHECK(pref_it != pref_change_registrar_map_.end());
761 delete pref_it->second; 762 delete pref_it->second;
762 pref_change_registrar_map_.erase(pref_it); 763 pref_change_registrar_map_.erase(pref_it);
763 } 764 }
764 } 765 }
765 766
766 } // namespace chrome 767 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/system_monitor/disk_info_mac.h » ('j') | chrome/browser/system_monitor/disk_info_mac.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698