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

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

Issue 11442057: [Media Galleries] Add an ImageCaptureCore listener for Mac. (part 2) (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 scoped_refptr<ScopedMTPDeviceMapEntry> mtp_device_host; 347 scoped_refptr<ScopedMTPDeviceMapEntry> mtp_device_host;
348 fsid = file_system_context_->RegisterFileSystemForMTPDevice( 348 fsid = file_system_context_->RegisterFileSystemForMTPDevice(
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 } 633 }
634 634
635 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM) 635 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
636 virtual std::string RegisterFileSystemForMTPDevice( 636 virtual std::string RegisterFileSystemForMTPDevice(
637 const std::string& device_id, const FilePath& path, 637 const std::string& device_id, const FilePath& path,
638 scoped_refptr<ScopedMTPDeviceMapEntry>* entry) { 638 scoped_refptr<ScopedMTPDeviceMapEntry>* entry) {
639 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 639 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
640 DCHECK(!MediaStorageUtil::IsMassStorageDevice(device_id)); 640 DCHECK(!MediaStorageUtil::IsMassStorageDevice(device_id));
641 641
642 // Sanity checks for |path|. 642 // Sanity checks for |path|.
643 CHECK(path.IsAbsolute()); 643 CHECK(MediaStorageUtil::CanCreateFileSystem(device_id, path));
644 CHECK(!path.ReferencesParent());
645 std::string fs_name(extension_misc::kMediaFileSystemPathPart); 644 std::string fs_name(extension_misc::kMediaFileSystemPathPart);
646 const std::string fsid = 645 const std::string fsid =
647 IsolatedContext::GetInstance()->RegisterFileSystemForPath( 646 IsolatedContext::GetInstance()->RegisterFileSystemForPath(
648 fileapi::kFileSystemTypeDeviceMedia, path, &fs_name); 647 fileapi::kFileSystemTypeDeviceMedia, path, &fs_name);
649 CHECK(!fsid.empty()); 648 CHECK(!fsid.empty());
650 DCHECK(entry); 649 DCHECK(entry);
651 *entry = registry_->GetOrCreateScopedMTPDeviceMapEntry(path.value()); 650 *entry = registry_->GetOrCreateScopedMTPDeviceMapEntry(path.value());
652 return fsid; 651 return fsid;
653 } 652 }
654 #endif 653 #endif
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 756
758 PrefChangeRegistrarMap::iterator pref_it = 757 PrefChangeRegistrarMap::iterator pref_it =
759 pref_change_registrar_map_.find(profile); 758 pref_change_registrar_map_.find(profile);
760 DCHECK(pref_it != pref_change_registrar_map_.end()); 759 DCHECK(pref_it != pref_change_registrar_map_.end());
761 delete pref_it->second; 760 delete pref_it->second;
762 pref_change_registrar_map_.erase(pref_it); 761 pref_change_registrar_map_.erase(pref_it);
763 } 762 }
764 } 763 }
765 764
766 } // namespace chrome 765 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698