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

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

Issue 10817006: Add more FS types and introduce type field into IsolatedContext (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 "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "chrome/common/chrome_paths.h" 13 #include "chrome/common/chrome_paths.h"
14 #include "content/public/browser/browser_thread.h" 14 #include "content/public/browser/browser_thread.h"
15 #include "content/public/browser/notification_source.h" 15 #include "content/public/browser/notification_source.h"
16 #include "content/public/browser/notification_types.h" 16 #include "content/public/browser/notification_types.h"
17 #include "content/public/browser/render_process_host.h" 17 #include "content/public/browser/render_process_host.h"
18 #include "webkit/fileapi/file_system_types.h"
18 #include "webkit/fileapi/isolated_context.h" 19 #include "webkit/fileapi/isolated_context.h"
19 20
20 namespace chrome { 21 namespace chrome {
21 22
22 static base::LazyInstance<MediaFileSystemRegistry>::Leaky 23 static base::LazyInstance<MediaFileSystemRegistry>::Leaky
23 g_media_file_system_registry = LAZY_INSTANCE_INITIALIZER; 24 g_media_file_system_registry = LAZY_INSTANCE_INITIALIZER;
24 25
25 using base::SystemMonitor; 26 using base::SystemMonitor;
26 using content::BrowserThread; 27 using content::BrowserThread;
27 using content::RenderProcessHost; 28 using content::RenderProcessHost;
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 140 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
140 141
141 // Sanity checks for |path|. 142 // Sanity checks for |path|.
142 CHECK(path.IsAbsolute()); 143 CHECK(path.IsAbsolute());
143 CHECK(!path.ReferencesParent()); 144 CHECK(!path.ReferencesParent());
144 145
145 // The directory name is not exposed to the js layer and we simply use 146 // The directory name is not exposed to the js layer and we simply use
146 // a fixed name (as we only register a single directory per file system). 147 // a fixed name (as we only register a single directory per file system).
147 std::string register_name("_"); 148 std::string register_name("_");
148 const std::string fsid = 149 const std::string fsid =
149 IsolatedContext::GetInstance()->RegisterFileSystemForFile( 150 IsolatedContext::GetInstance()->RegisterFileSystemForPath(
150 path, &register_name); 151 fileapi::kFileSystemTypeIsolated, path, &register_name);
151 CHECK(!fsid.empty()); 152 CHECK(!fsid.empty());
152 return fsid; 153 return fsid;
153 } 154 }
154 155
155 void MediaFileSystemRegistry::RevokeMediaFileSystem(const FilePath& path) { 156 void MediaFileSystemRegistry::RevokeMediaFileSystem(const FilePath& path) {
156 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 157 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
157 158
158 IsolatedContext* isolated_context = IsolatedContext::GetInstance(); 159 IsolatedContext* isolated_context = IsolatedContext::GetInstance();
159 for (ChildIdToMediaFSMap::iterator child_it = media_fs_map_.begin(); 160 for (ChildIdToMediaFSMap::iterator child_it = media_fs_map_.begin();
160 child_it != media_fs_map_.end(); 161 child_it != media_fs_map_.end();
161 ++child_it) { 162 ++child_it) {
162 MediaPathToFSIDMap& child_map = child_it->second; 163 MediaPathToFSIDMap& child_map = child_it->second;
163 MediaPathToFSIDMap::iterator media_path_it = child_map.find(path); 164 MediaPathToFSIDMap::iterator media_path_it = child_map.find(path);
164 if (media_path_it == child_map.end()) 165 if (media_path_it == child_map.end())
165 continue; 166 continue;
166 isolated_context->RevokeFileSystem(media_path_it->second); 167 isolated_context->RevokeFileSystem(media_path_it->second);
167 child_map.erase(media_path_it); 168 child_map.erase(media_path_it);
168 } 169 }
169 } 170 }
170 171
171 } // namespace chrome 172 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/intents/device_attached_intent_source.cc ('k') | content/browser/intents/intent_injector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698