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

Side by Side Diff: chrome/browser/chromeos/gdata/drive_system_service.cc

Issue 10909182: Make FileSystemContext respect StoragePartitions. filesystem:// urls will be properly isolated (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch unittest fix from michael Created 8 years, 3 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/chromeos/gdata/drive_system_service.h" 5 #include "chrome/browser/chromeos/gdata/drive_system_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/chromeos/gdata/drive_api_service.h" 9 #include "chrome/browser/chromeos/gdata/drive_api_service.h"
10 #include "chrome/browser/chromeos/gdata/drive_download_observer.h" 10 #include "chrome/browser/chromeos/gdata/drive_download_observer.h"
11 #include "chrome/browser/chromeos/gdata/drive_file_system.h" 11 #include "chrome/browser/chromeos/gdata/drive_file_system.h"
12 #include "chrome/browser/chromeos/gdata/drive_file_system_proxy.h" 12 #include "chrome/browser/chromeos/gdata/drive_file_system_proxy.h"
13 #include "chrome/browser/chromeos/gdata/drive_file_system_util.h" 13 #include "chrome/browser/chromeos/gdata/drive_file_system_util.h"
14 #include "chrome/browser/chromeos/gdata/drive_sync_client.h" 14 #include "chrome/browser/chromeos/gdata/drive_sync_client.h"
15 #include "chrome/browser/chromeos/gdata/drive_uploader.h" 15 #include "chrome/browser/chromeos/gdata/drive_uploader.h"
16 #include "chrome/browser/chromeos/gdata/drive_webapps_registry.h" 16 #include "chrome/browser/chromeos/gdata/drive_webapps_registry.h"
17 #include "chrome/browser/chromeos/gdata/file_write_helper.h" 17 #include "chrome/browser/chromeos/gdata/file_write_helper.h"
18 #include "chrome/browser/chromeos/gdata/gdata_util.h" 18 #include "chrome/browser/chromeos/gdata/gdata_util.h"
19 #include "chrome/browser/chromeos/gdata/gdata_wapi_service.h" 19 #include "chrome/browser/chromeos/gdata/gdata_wapi_service.h"
20 #include "chrome/browser/chromeos/gdata/stale_cache_files_remover.h" 20 #include "chrome/browser/chromeos/gdata/stale_cache_files_remover.h"
21 #include "chrome/browser/download/download_service.h" 21 #include "chrome/browser/download/download_service.h"
22 #include "chrome/browser/download/download_service_factory.h" 22 #include "chrome/browser/download/download_service_factory.h"
23 #include "chrome/browser/profiles/profile.h" 23 #include "chrome/browser/profiles/profile.h"
24 #include "chrome/browser/profiles/profile_dependency_manager.h" 24 #include "chrome/browser/profiles/profile_dependency_manager.h"
25 #include "content/public/browser/browser_context.h" 25 #include "content/public/browser/browser_context.h"
26 #include "content/public/browser/browser_thread.h" 26 #include "content/public/browser/browser_thread.h"
27 #include "content/public/browser/storage_partition.h"
27 #include "webkit/fileapi/file_system_context.h" 28 #include "webkit/fileapi/file_system_context.h"
28 #include "webkit/fileapi/file_system_mount_point_provider.h" 29 #include "webkit/fileapi/file_system_mount_point_provider.h"
29 30
30 using content::BrowserContext; 31 using content::BrowserContext;
31 using content::BrowserThread; 32 using content::BrowserThread;
32 33
33 namespace gdata { 34 namespace gdata {
34 namespace { 35 namespace {
35 36
36 // Used in test to setup system service. 37 // Used in test to setup system service.
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 if (!callback.is_null()) 134 if (!callback.is_null())
134 callback.Run(error == DRIVE_FILE_OK); 135 callback.Run(error == DRIVE_FILE_OK);
135 } 136 }
136 137
137 void DriveSystemService::AddDriveMountPoint() { 138 void DriveSystemService::AddDriveMountPoint() {
138 if (!gdata::util::IsGDataAvailable(profile_)) 139 if (!gdata::util::IsGDataAvailable(profile_))
139 return; 140 return;
140 141
141 const FilePath mount_point = gdata::util::GetDriveMountPointPath(); 142 const FilePath mount_point = gdata::util::GetDriveMountPointPath();
142 fileapi::ExternalFileSystemMountPointProvider* provider = 143 fileapi::ExternalFileSystemMountPointProvider* provider =
143 BrowserContext::GetFileSystemContext(profile_)->external_provider(); 144 BrowserContext::GetDefaultStoragePartition(profile_)->
145 GetFileSystemContext()->external_provider();
144 if (provider && !provider->HasMountPoint(mount_point)) { 146 if (provider && !provider->HasMountPoint(mount_point)) {
145 provider->AddRemoteMountPoint( 147 provider->AddRemoteMountPoint(
146 mount_point, 148 mount_point,
147 new DriveFileSystemProxy(file_system_.get())); 149 new DriveFileSystemProxy(file_system_.get()));
148 } 150 }
149 151
150 file_system_->NotifyFileSystemMounted(); 152 file_system_->NotifyFileSystemMounted();
151 } 153 }
152 154
153 void DriveSystemService::RemoveDriveMountPoint() { 155 void DriveSystemService::RemoveDriveMountPoint() {
154 file_system_->NotifyFileSystemToBeUnmounted(); 156 file_system_->NotifyFileSystemToBeUnmounted();
155 file_system_->StopUpdates(); 157 file_system_->StopUpdates();
156 158
157 const FilePath mount_point = gdata::util::GetDriveMountPointPath(); 159 const FilePath mount_point = gdata::util::GetDriveMountPointPath();
158 fileapi::ExternalFileSystemMountPointProvider* provider = 160 fileapi::ExternalFileSystemMountPointProvider* provider =
159 BrowserContext::GetFileSystemContext(profile_)->external_provider(); 161 BrowserContext::GetDefaultStoragePartition(profile_)->
162 GetFileSystemContext()->external_provider();
160 if (provider && provider->HasMountPoint(mount_point)) 163 if (provider && provider->HasMountPoint(mount_point))
161 provider->RemoveMountPoint(mount_point); 164 provider->RemoveMountPoint(mount_point);
162 } 165 }
163 166
164 //===================== DriveSystemServiceFactory ============================= 167 //===================== DriveSystemServiceFactory =============================
165 168
166 // static 169 // static
167 DriveSystemService* DriveSystemServiceFactory::GetForProfile( 170 DriveSystemService* DriveSystemServiceFactory::GetForProfile(
168 Profile* profile) { 171 Profile* profile) {
169 return static_cast<DriveSystemService*>( 172 return static_cast<DriveSystemService*>(
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 g_test_cache_root ? FilePath(*g_test_cache_root) : 227 g_test_cache_root ? FilePath(*g_test_cache_root) :
225 DriveCache::GetCacheRootPath(profile); 228 DriveCache::GetCacheRootPath(profile);
226 delete g_test_cache_root; 229 delete g_test_cache_root;
227 g_test_cache_root = NULL; 230 g_test_cache_root = NULL;
228 231
229 service->Initialize(drive_service, cache_root); 232 service->Initialize(drive_service, cache_root);
230 return service; 233 return service;
231 } 234 }
232 235
233 } // namespace gdata 236 } // namespace gdata
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698