Index: chrome/browser/chromeos/gdata/gdata_file_system.cc |
diff --git a/chrome/browser/chromeos/gdata/gdata_file_system.cc b/chrome/browser/chromeos/gdata/gdata_file_system.cc |
index fb4f8844d72dec9c46d9e558270e619ca1c48d07..c927bae84b5f538434c757307cbe8f34a43be204 100644 |
--- a/chrome/browser/chromeos/gdata/gdata_file_system.cc |
+++ b/chrome/browser/chromeos/gdata/gdata_file_system.cc |
@@ -7,6 +7,9 @@ |
#include <set> |
#include <utility> |
+#include "chrome/browser/chromeos/gdata/gdata_file_system_proxy.h" |
+#include "content/public/browser/browser_context.h" |
+ |
#include "base/bind.h" |
#include "base/file_util.h" |
#include "base/json/json_file_value_serializer.h" |
@@ -32,6 +35,8 @@ |
#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/notification_details.h" |
#include "net/base/mime_util.h" |
+#include "webkit/fileapi/file_system_context.h" |
+#include "webkit/fileapi/file_system_mount_point_provider.h" |
using content::BrowserThread; |
@@ -847,9 +852,16 @@ void GDataFileSystem::StartUpdates() { |
} |
void GDataFileSystem::StopUpdates() { |
+ // If unmount request comes from filesystem side, this method may be called |
+ // twice. First is just after unmounting on filesystem, second is after |
+ // unmounting on filemanager on JS. In other words, if this is called from |
+ // GDataFileSystem::RemoveDriveMountPoint(), this will be called again from |
+ // FileBrowserEventRouter::HandleRemoteUpdateRequestOnUIThread(). |
+ // We choose to stopping updates asynchronous without waiting for filemanager, |
+ // rather than waiting for completion of unmounting on filemanager. |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
- DCHECK(update_timer_.IsRunning()); |
- update_timer_.Stop(); |
+ if (update_timer_.IsRunning()) |
+ update_timer_.Stop(); |
} |
void GDataFileSystem::GetEntryInfoByResourceId( |
@@ -2886,6 +2898,33 @@ void GDataFileSystem::LoadRootFeedFromCacheForTesting() { |
FindEntryCallback()); |
} |
+void GDataFileSystem::AddDriveMountPoint() { |
+ const FilePath mount_point = gdata::util::GetGDataMountPointPath(); |
+ fileapi::ExternalFileSystemMountPointProvider* provider = |
+ content::BrowserContext::GetFileSystemContext(profile_)-> |
+ external_provider(); |
+ if (provider && !provider->HasMountPoint(mount_point)) { |
+ provider->AddRemoteMountPoint( |
+ mount_point, |
+ new GDataFileSystemProxy(this)); |
satorux1
2012/08/01 20:59:01
Hmm, why do we need to move the code to GDataFileS
yoshiki
2012/08/01 22:23:39
I moved this code in order to call NotifyFileSyste
satorux1
2012/08/02 01:17:12
What classes are interested in NotifyFileSystemMou
yoshiki
2012/08/02 05:53:42
Sorry for my confusing explanation.
This method (
satorux1
2012/08/02 06:19:44
My question was, why NotifyFileSystemMounted() has
satorux1
2012/08/02 06:38:32
I meant:
why OnFileSystemMounted() has to be part
|
+ directory_service_.reset(new GDataDirectoryService); |
+ NotifyFileSystemMounted(); |
+ } |
+} |
+ |
+void GDataFileSystem::RemoveDriveMountPoint() { |
+ const FilePath mount_point = gdata::util::GetGDataMountPointPath(); |
+ fileapi::ExternalFileSystemMountPointProvider* provider = |
+ content::BrowserContext::GetFileSystemContext(profile_)-> |
+ external_provider(); |
+ if (provider && provider->HasMountPoint(mount_point)) { |
+ NotifyFileSystemUnmounting(); |
+ // We have to stop update before removing mount point. |
+ StopUpdates(); |
+ provider->RemoveMountPoint(mount_point); |
+ } |
+} |
+ |
void GDataFileSystem::OnProtoLoaded(LoadRootFeedParams* params) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
@@ -3605,6 +3644,22 @@ void GDataFileSystem::NotifyDocumentFeedFetched(int num_accumulated_entries) { |
OnDocumentFeedFetched(num_accumulated_entries)); |
} |
+void GDataFileSystem::NotifyFileSystemMounted() { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ |
+ DVLOG(1) << "File System is mounted"; |
+ // Notify the observers that the file system is mounted. |
+ FOR_EACH_OBSERVER(Observer, observers_, OnFileSystemMounted()); |
+} |
+ |
+void GDataFileSystem::NotifyFileSystemUnmounting() { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ |
+ DVLOG(1) << "File System is getting unmounted"; |
+ // Notify the observers that the file system is getting unmounted. |
+ FOR_EACH_OBSERVER(Observer, observers_, OnFileSystemUnmounting()); |
+} |
+ |
void GDataFileSystem::RunAndNotifyInitialLoadFinished( |
const FindEntryCallback& callback, |
GDataFileError error, |