diff options
author | zelidrag@chromium.org <zelidrag@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-17 01:46:30 +0000 |
---|---|---|
committer | zelidrag@chromium.org <zelidrag@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-17 01:46:30 +0000 |
commit | afd8141c1c1b355c7c425f6c1dbee440039ba9bb (patch) | |
tree | 53b3bd3eb46967d3cbdb2843c76fc8d62e3aff63 /chrome/browser/chromeos | |
parent | 180467d3ead6a0ea2e9fa2683258f6a3eb9c490e (diff) | |
download | chromium_src-afd8141c1c1b355c7c425f6c1dbee440039ba9bb.zip chromium_src-afd8141c1c1b355c7c425f6c1dbee440039ba9bb.tar.gz chromium_src-afd8141c1c1b355c7c425f6c1dbee440039ba9bb.tar.bz2 |
Merge 144830 - Moved code that adds Drive mount point to File API layer to be invoked during system init. We need to expose CrosMountPointProvider's path translation abilities even before file manager is instantiated.
BUG=133004
TEST=see bug for manual testing details
Review URL: https://chromiumcodereview.appspot.com/10708006
TBR=zelidrag@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10792028
git-svn-id: svn://svn.chromium.org/chrome/branches/1180/src@146945 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos')
3 files changed, 37 insertions, 8 deletions
diff --git a/chrome/browser/chromeos/extensions/file_browser_private_api.cc b/chrome/browser/chromeos/extensions/file_browser_private_api.cc index 40bc3c7..670581b 100644 --- a/chrome/browser/chromeos/extensions/file_browser_private_api.cc +++ b/chrome/browser/chromeos/extensions/file_browser_private_api.cc @@ -23,7 +23,6 @@ #include "chrome/browser/chromeos/gdata/drive_webapps_registry.h" #include "chrome/browser/chromeos/gdata/gdata.pb.h" #include "chrome/browser/chromeos/gdata/gdata_documents_service.h" -#include "chrome/browser/chromeos/gdata/gdata_file_system_proxy.h" #include "chrome/browser/chromeos/gdata/gdata_operation_registry.h" #include "chrome/browser/chromeos/gdata/gdata_system_service.h" #include "chrome/browser/chromeos/gdata/gdata_util.h" @@ -180,11 +179,12 @@ void AddGDataMountPoint( content::RenderViewHost* render_view_host) { fileapi::ExternalFileSystemMountPointProvider* provider = BrowserContext::GetFileSystemContext(profile)->external_provider(); + if (!provider) + return; + const FilePath mount_point = gdata::util::GetGDataMountPointPath(); if (!render_view_host || !render_view_host->GetProcess()) return; - if (!provider || provider->HasMountPoint(mount_point)) - return; // Grant R/W permissions to gdata 'folder'. File API layer still // expects this to be satisfied. @@ -214,11 +214,6 @@ void AddGDataMountPoint( gdata::GDataCache::CACHE_TYPE_PERSISTENT), file_handler_util::GetReadOnlyPermissions()); - gdata::GDataFileSystem* gdata_file_system = system_service->file_system(); - provider->AddRemoteMountPoint( - mount_point, - new gdata::GDataFileSystemProxy(gdata_file_system)); - FilePath mount_point_virtual; if (provider->GetVirtualPath(mount_point, &mount_point_virtual)) provider->GrantFileAccessToExtension(extension_id, mount_point_virtual); diff --git a/chrome/browser/chromeos/gdata/gdata_system_service.cc b/chrome/browser/chromeos/gdata/gdata_system_service.cc index 53f021c..e7db98c 100644 --- a/chrome/browser/chromeos/gdata/gdata_system_service.cc +++ b/chrome/browser/chromeos/gdata/gdata_system_service.cc @@ -10,15 +10,19 @@ #include "chrome/browser/download/download_service.h" #include "chrome/browser/download/download_service_factory.h" #include "chrome/browser/chromeos/gdata/drive_webapps_registry.h" +#include "chrome/browser/chromeos/gdata/gdata_file_system_proxy.h" #include "chrome/browser/chromeos/gdata/gdata_documents_service.h" #include "chrome/browser/chromeos/gdata/gdata_download_observer.h" #include "chrome/browser/chromeos/gdata/gdata_file_system.h" #include "chrome/browser/chromeos/gdata/gdata_sync_client.h" #include "chrome/browser/chromeos/gdata/gdata_uploader.h" +#include "chrome/browser/chromeos/gdata/gdata_util.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_dependency_manager.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" +#include "webkit/fileapi/file_system_context.h" +#include "webkit/fileapi/file_system_mount_point_provider.h" using content::BrowserContext; using content::BrowserThread; @@ -70,10 +74,13 @@ void GDataSystemService::Initialize() { download_manager, cache_->GetCacheDirectoryPath( GDataCache::CACHE_TYPE_TMP_DOWNLOADS)); + + AddDriveMountPoint(); } void GDataSystemService::Shutdown() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + RemoveDriveMountPoint(); // Shut down the member objects in the reverse order of creation. webapps_registry_.reset(); @@ -84,6 +91,28 @@ void GDataSystemService::Shutdown() { documents_service_.reset(); } +void GDataSystemService::AddDriveMountPoint() { + if (!gdata::util::IsGDataAvailable(profile_)) + return; + + const FilePath mount_point = gdata::util::GetGDataMountPointPath(); + fileapi::ExternalFileSystemMountPointProvider* provider = + BrowserContext::GetFileSystemContext(profile_)->external_provider(); + if (provider && !provider->HasMountPoint(mount_point)) { + provider->AddRemoteMountPoint( + mount_point, + new GDataFileSystemProxy(file_system_.get())); + } +} + +void GDataSystemService::RemoveDriveMountPoint() { + const FilePath mount_point = gdata::util::GetGDataMountPointPath(); + fileapi::ExternalFileSystemMountPointProvider* provider = + BrowserContext::GetFileSystemContext(profile_)->external_provider(); + if (provider && provider->HasMountPoint(mount_point)) + provider->RemoveMountPoint(mount_point); +} + //===================== GDataSystemServiceFactory ============================= // static diff --git a/chrome/browser/chromeos/gdata/gdata_system_service.h b/chrome/browser/chromeos/gdata/gdata_system_service.h index cb21314..f8982b9 100644 --- a/chrome/browser/chromeos/gdata/gdata_system_service.h +++ b/chrome/browser/chromeos/gdata/gdata_system_service.h @@ -54,6 +54,11 @@ class GDataSystemService : public ProfileKeyedService { // other functions. void Initialize(); + // Registers remote file system proxy for drive mount point. + void AddDriveMountPoint(); + // Unregisters drive mount point from File API. + void RemoveDriveMountPoint(); + friend class GDataSystemServiceFactory; Profile* profile_; |