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

Side by Side Diff: chrome/browser/media_galleries/imported_media_gallery_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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/imported_media_gallery_registry.h" 5 #include "chrome/browser/media_galleries/imported_media_gallery_registry.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "chrome/browser/media_galleries/fileapi/iphoto_data_provider.h" 10 #include "chrome/browser/media_galleries/fileapi/iphoto_data_provider.h"
11 #include "chrome/browser/media_galleries/fileapi/itunes_data_provider.h" 11 #include "chrome/browser/media_galleries/fileapi/itunes_data_provider.h"
12 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" 12 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h"
13 #include "chrome/browser/media_galleries/fileapi/picasa_data_provider.h" 13 #include "chrome/browser/media_galleries/fileapi/picasa_data_provider.h"
14 #include "chrome/common/extensions/extension_constants.h" 14 #include "chrome/common/extensions/extension_constants.h"
15 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
16 #include "webkit/browser/fileapi/external_mount_points.h" 16 #include "storage/browser/fileapi/external_mount_points.h"
17 #include "webkit/common/fileapi/file_system_mount_option.h" 17 #include "storage/common/fileapi/file_system_mount_option.h"
18 18
19 using base::Bind; 19 using base::Bind;
20 using fileapi::ExternalMountPoints; 20 using storage::ExternalMountPoints;
21 21
22 namespace { 22 namespace {
23 23
24 static base::LazyInstance<ImportedMediaGalleryRegistry>::Leaky 24 static base::LazyInstance<ImportedMediaGalleryRegistry>::Leaky
25 g_imported_media_gallery_registry = LAZY_INSTANCE_INITIALIZER; 25 g_imported_media_gallery_registry = LAZY_INSTANCE_INITIALIZER;
26 26
27 } // namespace 27 } // namespace
28 28
29 // static 29 // static
30 ImportedMediaGalleryRegistry* ImportedMediaGalleryRegistry::GetInstance() { 30 ImportedMediaGalleryRegistry* ImportedMediaGalleryRegistry::GetInstance() {
(...skipping 17 matching lines...) Expand all
48 DCHECK(!fs_name.empty()); 48 DCHECK(!fs_name.empty());
49 DCHECK(!database_path.empty()); 49 DCHECK(!database_path.empty());
50 50
51 bool result = false; 51 bool result = false;
52 52
53 #if defined(OS_WIN) || defined(OS_MACOSX) 53 #if defined(OS_WIN) || defined(OS_MACOSX)
54 base::FilePath root = ImportedRoot(); 54 base::FilePath root = ImportedRoot();
55 if (root.empty()) 55 if (root.empty())
56 return false; 56 return false;
57 result = ExternalMountPoints::GetSystemInstance()->RegisterFileSystem( 57 result = ExternalMountPoints::GetSystemInstance()->RegisterFileSystem(
58 fs_name, fileapi::kFileSystemTypePicasa, fileapi::FileSystemMountOption(), 58 fs_name,
59 storage::kFileSystemTypePicasa,
60 storage::FileSystemMountOption(),
59 root.AppendASCII("picasa")); 61 root.AppendASCII("picasa"));
60 if (!result) 62 if (!result)
61 return result; 63 return result;
62 64
63 picasa_fs_names_.insert(fs_name); 65 picasa_fs_names_.insert(fs_name);
64 66
65 if (picasa_fs_names_.size() == 1) { 67 if (picasa_fs_names_.size() == 1) {
66 MediaFileSystemBackend::MediaTaskRunner()->PostTask( 68 MediaFileSystemBackend::MediaTaskRunner()->PostTask(
67 FROM_HERE, 69 FROM_HERE,
68 Bind(&ImportedMediaGalleryRegistry::RegisterPicasaFileSystem, 70 Bind(&ImportedMediaGalleryRegistry::RegisterPicasaFileSystem,
(...skipping 14 matching lines...) Expand all
83 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 85 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
84 DCHECK(!library_xml_path.empty()); 86 DCHECK(!library_xml_path.empty());
85 87
86 bool result = false; 88 bool result = false;
87 89
88 #if defined(OS_WIN) || defined(OS_MACOSX) 90 #if defined(OS_WIN) || defined(OS_MACOSX)
89 base::FilePath root = ImportedRoot(); 91 base::FilePath root = ImportedRoot();
90 if (root.empty()) 92 if (root.empty())
91 return false; 93 return false;
92 result = ExternalMountPoints::GetSystemInstance()->RegisterFileSystem( 94 result = ExternalMountPoints::GetSystemInstance()->RegisterFileSystem(
93 fs_name, fileapi::kFileSystemTypeItunes, fileapi::FileSystemMountOption(), 95 fs_name,
96 storage::kFileSystemTypeItunes,
97 storage::FileSystemMountOption(),
94 root.AppendASCII("itunes")); 98 root.AppendASCII("itunes"));
95 if (!result) 99 if (!result)
96 return result; 100 return result;
97 101
98 itunes_fs_names_.insert(fs_name); 102 itunes_fs_names_.insert(fs_name);
99 103
100 if (itunes_fs_names_.size() == 1) { 104 if (itunes_fs_names_.size() == 1) {
101 MediaFileSystemBackend::MediaTaskRunner()->PostTask( 105 MediaFileSystemBackend::MediaTaskRunner()->PostTask(
102 FROM_HERE, 106 FROM_HERE,
103 Bind(&ImportedMediaGalleryRegistry::RegisterITunesFileSystem, 107 Bind(&ImportedMediaGalleryRegistry::RegisterITunesFileSystem,
(...skipping 16 matching lines...) Expand all
120 124
121 bool result = false; 125 bool result = false;
122 126
123 // TODO(gbillock): Investigate how to refactor this to reduce duplicated 127 // TODO(gbillock): Investigate how to refactor this to reduce duplicated
124 // code. 128 // code.
125 #if defined(OS_MACOSX) 129 #if defined(OS_MACOSX)
126 base::FilePath root = ImportedRoot(); 130 base::FilePath root = ImportedRoot();
127 if (root.empty()) 131 if (root.empty())
128 return false; 132 return false;
129 result = ExternalMountPoints::GetSystemInstance()->RegisterFileSystem( 133 result = ExternalMountPoints::GetSystemInstance()->RegisterFileSystem(
130 fs_name, fileapi::kFileSystemTypeIphoto, fileapi::FileSystemMountOption(), 134 fs_name,
135 storage::kFileSystemTypeIphoto,
136 storage::FileSystemMountOption(),
131 root.AppendASCII("iphoto")); 137 root.AppendASCII("iphoto"));
132 if (!result) 138 if (!result)
133 return result; 139 return result;
134 140
135 iphoto_fs_names_.insert(fs_name); 141 iphoto_fs_names_.insert(fs_name);
136 142
137 if (iphoto_fs_names_.size() == 1) { 143 if (iphoto_fs_names_.size() == 1) {
138 MediaFileSystemBackend::MediaTaskRunner()->PostTask( 144 MediaFileSystemBackend::MediaTaskRunner()->PostTask(
139 FROM_HERE, 145 FROM_HERE,
140 Bind(&ImportedMediaGalleryRegistry::RegisterIPhotoFileSystem, 146 Bind(&ImportedMediaGalleryRegistry::RegisterIPhotoFileSystem,
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 DCHECK(!iphoto_data_provider_); 279 DCHECK(!iphoto_data_provider_);
274 iphoto_data_provider_.reset(new iphoto::IPhotoDataProvider(xml_library_path)); 280 iphoto_data_provider_.reset(new iphoto::IPhotoDataProvider(xml_library_path));
275 } 281 }
276 282
277 void ImportedMediaGalleryRegistry::RevokeIPhotoFileSystem() { 283 void ImportedMediaGalleryRegistry::RevokeIPhotoFileSystem() {
278 DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread()); 284 DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread());
279 DCHECK(iphoto_data_provider_); 285 DCHECK(iphoto_data_provider_);
280 iphoto_data_provider_.reset(); 286 iphoto_data_provider_.reset();
281 } 287 }
282 #endif // defined(OS_MACOSX) 288 #endif // defined(OS_MACOSX)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698