OLD | NEW |
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 "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/chromeos/gdata/drive_api_service.h" | 10 #include "chrome/browser/chromeos/gdata/drive_api_service.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 AddDriveMountPoint(); | 127 AddDriveMountPoint(); |
128 | 128 |
129 if (!callback.is_null()) | 129 if (!callback.is_null()) |
130 callback.Run(error == DRIVE_FILE_OK); | 130 callback.Run(error == DRIVE_FILE_OK); |
131 } | 131 } |
132 | 132 |
133 void DriveSystemService::AddDriveMountPoint() { | 133 void DriveSystemService::AddDriveMountPoint() { |
134 if (!gdata::util::IsGDataAvailable(profile_)) | 134 if (!gdata::util::IsGDataAvailable(profile_)) |
135 return; | 135 return; |
136 | 136 |
137 const FilePath mount_point = gdata::util::GetGDataMountPointPath(); | 137 const FilePath mount_point = gdata::util::GetDriveMountPointPath(); |
138 fileapi::ExternalFileSystemMountPointProvider* provider = | 138 fileapi::ExternalFileSystemMountPointProvider* provider = |
139 BrowserContext::GetFileSystemContext(profile_)->external_provider(); | 139 BrowserContext::GetFileSystemContext(profile_)->external_provider(); |
140 if (provider && !provider->HasMountPoint(mount_point)) { | 140 if (provider && !provider->HasMountPoint(mount_point)) { |
141 provider->AddRemoteMountPoint( | 141 provider->AddRemoteMountPoint( |
142 mount_point, | 142 mount_point, |
143 new DriveFileSystemProxy(file_system_.get())); | 143 new DriveFileSystemProxy(file_system_.get())); |
144 } | 144 } |
145 | 145 |
146 file_system_->NotifyFileSystemMounted(); | 146 file_system_->NotifyFileSystemMounted(); |
147 } | 147 } |
148 | 148 |
149 void DriveSystemService::RemoveDriveMountPoint() { | 149 void DriveSystemService::RemoveDriveMountPoint() { |
150 file_system_->NotifyFileSystemToBeUnmounted(); | 150 file_system_->NotifyFileSystemToBeUnmounted(); |
151 file_system_->StopUpdates(); | 151 file_system_->StopUpdates(); |
152 | 152 |
153 const FilePath mount_point = gdata::util::GetGDataMountPointPath(); | 153 const FilePath mount_point = gdata::util::GetDriveMountPointPath(); |
154 fileapi::ExternalFileSystemMountPointProvider* provider = | 154 fileapi::ExternalFileSystemMountPointProvider* provider = |
155 BrowserContext::GetFileSystemContext(profile_)->external_provider(); | 155 BrowserContext::GetFileSystemContext(profile_)->external_provider(); |
156 if (provider && provider->HasMountPoint(mount_point)) | 156 if (provider && provider->HasMountPoint(mount_point)) |
157 provider->RemoveMountPoint(mount_point); | 157 provider->RemoveMountPoint(mount_point); |
158 } | 158 } |
159 | 159 |
160 //===================== DriveSystemServiceFactory ============================= | 160 //===================== DriveSystemServiceFactory ============================= |
161 | 161 |
162 // static | 162 // static |
163 DriveSystemService* DriveSystemServiceFactory::GetForProfile( | 163 DriveSystemService* DriveSystemServiceFactory::GetForProfile( |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 g_test_cache_root ? FilePath(*g_test_cache_root) : | 220 g_test_cache_root ? FilePath(*g_test_cache_root) : |
221 DriveCache::GetCacheRootPath(profile); | 221 DriveCache::GetCacheRootPath(profile); |
222 delete g_test_cache_root; | 222 delete g_test_cache_root; |
223 g_test_cache_root = NULL; | 223 g_test_cache_root = NULL; |
224 | 224 |
225 service->Initialize(drive_service, cache_root); | 225 service->Initialize(drive_service, cache_root); |
226 return service; | 226 return service; |
227 } | 227 } |
228 | 228 |
229 } // namespace gdata | 229 } // namespace gdata |
OLD | NEW |