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

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

Issue 10810053: Enables internal filesystem types via Isolated filesystems (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 // 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 10
11 #include "base/path_service.h" 11 #include "base/path_service.h"
12 #include "chrome/common/chrome_paths.h" 12 #include "chrome/common/chrome_paths.h"
13 #include "content/public/browser/browser_thread.h" 13 #include "content/public/browser/browser_thread.h"
14 #include "content/public/browser/notification_source.h" 14 #include "content/public/browser/notification_source.h"
15 #include "content/public/browser/notification_types.h" 15 #include "content/public/browser/notification_types.h"
16 #include "content/public/browser/render_process_host.h" 16 #include "content/public/browser/render_process_host.h"
17 #include "webkit/fileapi/file_system_types.h"
17 #include "webkit/fileapi/isolated_context.h" 18 #include "webkit/fileapi/isolated_context.h"
18 19
19 namespace chrome { 20 namespace chrome {
20 21
21 static base::LazyInstance<MediaFileSystemRegistry>::Leaky 22 static base::LazyInstance<MediaFileSystemRegistry>::Leaky
22 g_media_file_system_registry = LAZY_INSTANCE_INITIALIZER; 23 g_media_file_system_registry = LAZY_INSTANCE_INITIALIZER;
23 24
24 using base::SystemMonitor; 25 using base::SystemMonitor;
25 using content::BrowserThread; 26 using content::BrowserThread;
26 using content::RenderProcessHost; 27 using content::RenderProcessHost;
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 139 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
139 140
140 // Sanity checks for |path|. 141 // Sanity checks for |path|.
141 CHECK(path.IsAbsolute()); 142 CHECK(path.IsAbsolute());
142 CHECK(!path.ReferencesParent()); 143 CHECK(!path.ReferencesParent());
143 144
144 // The directory name is not exposed to the js layer and we simply use 145 // The directory name is not exposed to the js layer and we simply use
145 // a fixed name (as we only register a single directory per file system). 146 // a fixed name (as we only register a single directory per file system).
146 std::string register_name("_"); 147 std::string register_name("_");
147 const std::string fsid = 148 const std::string fsid =
148 IsolatedContext::GetInstance()->RegisterFileSystemForFile( 149 IsolatedContext::GetInstance()->RegisterFileSystemForPath(
149 path, &register_name); 150 fileapi::kFileSystemTypeMedia, path, &register_name);
kmadhusu 2012/07/24 22:02:12 Let the initial changes specify the file system ty
150 CHECK(!fsid.empty()); 151 CHECK(!fsid.empty());
151 return fsid; 152 return fsid;
152 } 153 }
153 154
154 void MediaFileSystemRegistry::RevokeMediaFileSystem(const FilePath& path) { 155 void MediaFileSystemRegistry::RevokeMediaFileSystem(const FilePath& path) {
155 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 156 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
156 157
157 IsolatedContext* isolated_context = IsolatedContext::GetInstance(); 158 IsolatedContext* isolated_context = IsolatedContext::GetInstance();
158 for (ChildIdToMediaFSMap::iterator child_it = media_fs_map_.begin(); 159 for (ChildIdToMediaFSMap::iterator child_it = media_fs_map_.begin();
159 child_it != media_fs_map_.end(); 160 child_it != media_fs_map_.end();
160 ++child_it) { 161 ++child_it) {
161 MediaPathToFSIDMap& child_map = child_it->second; 162 MediaPathToFSIDMap& child_map = child_it->second;
162 MediaPathToFSIDMap::iterator media_path_it = child_map.find(path); 163 MediaPathToFSIDMap::iterator media_path_it = child_map.find(path);
163 if (media_path_it == child_map.end()) 164 if (media_path_it == child_map.end())
164 continue; 165 continue;
165 isolated_context->RevokeFileSystem(media_path_it->second); 166 isolated_context->RevokeFileSystem(media_path_it->second);
166 child_map.erase(media_path_it); 167 child_map.erase(media_path_it);
167 } 168 }
168 } 169 }
169 170
170 } // namespace chrome 171 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698