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

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

Issue 442383002: Move storage-related files from webkit/ to new top-level directory storage/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 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 #include "chrome/browser/media_galleries/media_file_system_registry.h" 5 #include "chrome/browser/media_galleries/media_file_system_registry.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 20 matching lines...) Expand all
31 #include "content/public/browser/browser_thread.h" 31 #include "content/public/browser/browser_thread.h"
32 #include "content/public/browser/navigation_details.h" 32 #include "content/public/browser/navigation_details.h"
33 #include "content/public/browser/render_process_host.h" 33 #include "content/public/browser/render_process_host.h"
34 #include "content/public/browser/render_process_host_observer.h" 34 #include "content/public/browser/render_process_host_observer.h"
35 #include "content/public/browser/render_view_host.h" 35 #include "content/public/browser/render_view_host.h"
36 #include "content/public/browser/web_contents.h" 36 #include "content/public/browser/web_contents.h"
37 #include "content/public/browser/web_contents_observer.h" 37 #include "content/public/browser/web_contents_observer.h"
38 #include "extensions/browser/extension_system.h" 38 #include "extensions/browser/extension_system.h"
39 #include "extensions/common/extension.h" 39 #include "extensions/common/extension.h"
40 #include "extensions/common/extension_set.h" 40 #include "extensions/common/extension_set.h"
41 #include "webkit/browser/fileapi/external_mount_points.h" 41 #include "storage/browser/fileapi/external_mount_points.h"
42 #include "webkit/common/fileapi/file_system_mount_option.h" 42 #include "storage/common/fileapi/file_system_mount_option.h"
43 #include "webkit/common/fileapi/file_system_types.h" 43 #include "storage/common/fileapi/file_system_types.h"
44 44
45 using content::BrowserThread; 45 using content::BrowserThread;
46 using content::NavigationController; 46 using content::NavigationController;
47 using content::RenderProcessHost; 47 using content::RenderProcessHost;
48 using content::WebContents; 48 using content::WebContents;
49 using fileapi::ExternalMountPoints; 49 using storage::ExternalMountPoints;
50 using storage_monitor::MediaStorageUtil; 50 using storage_monitor::MediaStorageUtil;
51 using storage_monitor::StorageInfo; 51 using storage_monitor::StorageInfo;
52 using storage_monitor::StorageMonitor; 52 using storage_monitor::StorageMonitor;
53 53
54 namespace { 54 namespace {
55 55
56 struct InvalidatedGalleriesInfo { 56 struct InvalidatedGalleriesInfo {
57 std::set<ExtensionGalleriesHost*> extension_hosts; 57 std::set<ExtensionGalleriesHost*> extension_hosts;
58 std::set<MediaGalleryPrefId> pref_ids; 58 std::set<MediaGalleryPrefId> pref_ids;
59 }; 59 };
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 } else if (StorageInfo::IsPicasaDevice(device_id)) { 696 } else if (StorageInfo::IsPicasaDevice(device_id)) {
697 ImportedMediaGalleryRegistry* registry = 697 ImportedMediaGalleryRegistry* registry =
698 ImportedMediaGalleryRegistry::GetInstance(); 698 ImportedMediaGalleryRegistry::GetInstance();
699 result = registry->RegisterPicasaFilesystemOnUIThread(fs_name, path); 699 result = registry->RegisterPicasaFilesystemOnUIThread(fs_name, path);
700 } else if (StorageInfo::IsIPhotoDevice(device_id)) { 700 } else if (StorageInfo::IsIPhotoDevice(device_id)) {
701 ImportedMediaGalleryRegistry* registry = 701 ImportedMediaGalleryRegistry* registry =
702 ImportedMediaGalleryRegistry::GetInstance(); 702 ImportedMediaGalleryRegistry::GetInstance();
703 result = registry->RegisterIPhotoFilesystemOnUIThread(fs_name, path); 703 result = registry->RegisterIPhotoFilesystemOnUIThread(fs_name, path);
704 } else { 704 } else {
705 result = ExternalMountPoints::GetSystemInstance()->RegisterFileSystem( 705 result = ExternalMountPoints::GetSystemInstance()->RegisterFileSystem(
706 fs_name, fileapi::kFileSystemTypeNativeMedia, 706 fs_name,
707 fileapi::FileSystemMountOption(), path); 707 storage::kFileSystemTypeNativeMedia,
708 storage::FileSystemMountOption(),
709 path);
708 } 710 }
709 return result; 711 return result;
710 } 712 }
711 713
712 bool RegisterFileSystemForMTPDevice(const std::string& device_id, 714 bool RegisterFileSystemForMTPDevice(const std::string& device_id,
713 const std::string fs_name, 715 const std::string fs_name,
714 const base::FilePath& path) { 716 const base::FilePath& path) {
715 DCHECK_CURRENTLY_ON(BrowserThread::UI); 717 DCHECK_CURRENTLY_ON(BrowserThread::UI);
716 DCHECK(!StorageInfo::IsMassStorageDevice(device_id)); 718 DCHECK(!StorageInfo::IsMassStorageDevice(device_id));
717 719
718 // Sanity checks for |path|. 720 // Sanity checks for |path|.
719 CHECK(MediaStorageUtil::CanCreateFileSystem(device_id, path)); 721 CHECK(MediaStorageUtil::CanCreateFileSystem(device_id, path));
720 bool result = ExternalMountPoints::GetSystemInstance()->RegisterFileSystem( 722 bool result = ExternalMountPoints::GetSystemInstance()->RegisterFileSystem(
721 fs_name, fileapi::kFileSystemTypeDeviceMedia, 723 fs_name,
722 fileapi::FileSystemMountOption(), path); 724 storage::kFileSystemTypeDeviceMedia,
725 storage::FileSystemMountOption(),
726 path);
723 CHECK(result); 727 CHECK(result);
724 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( 728 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind(
725 &MTPDeviceMapService::RegisterMTPFileSystem, 729 &MTPDeviceMapService::RegisterMTPFileSystem,
726 base::Unretained(MTPDeviceMapService::GetInstance()), 730 base::Unretained(MTPDeviceMapService::GetInstance()),
727 path.value(), fs_name)); 731 path.value(), fs_name));
728 return result; 732 return result;
729 } 733 }
730 734
731 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemContextImpl); 735 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemContextImpl);
732 }; 736 };
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 DCHECK_EQ(1U, erase_count); 840 DCHECK_EQ(1U, erase_count);
837 if (extension_hosts->second.empty()) { 841 if (extension_hosts->second.empty()) {
838 // When a profile has no ExtensionGalleriesHosts left, remove the 842 // When a profile has no ExtensionGalleriesHosts left, remove the
839 // matching gallery-change-watcher since it is no longer needed. Leave the 843 // matching gallery-change-watcher since it is no longer needed. Leave the
840 // |extension_hosts| entry alone, since it indicates the profile has been 844 // |extension_hosts| entry alone, since it indicates the profile has been
841 // previously used. 845 // previously used.
842 MediaGalleriesPreferences* preferences = GetPreferences(profile); 846 MediaGalleriesPreferences* preferences = GetPreferences(profile);
843 preferences->RemoveGalleryChangeObserver(this); 847 preferences->RemoveGalleryChangeObserver(this);
844 } 848 }
845 } 849 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698