diff options
author | kinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-29 01:50:28 +0000 |
---|---|---|
committer | kinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-29 01:50:28 +0000 |
commit | 3576d4645180fee42ab40475dd182fcd2afdebea (patch) | |
tree | 8c26659a8628589a78e23e658543fa83ba8d27fb /apps | |
parent | afb84fc79640129ef90df715f24dd4d0e03381cd (diff) | |
download | chromium_src-3576d4645180fee42ab40475dd182fcd2afdebea.zip chromium_src-3576d4645180fee42ab40475dd182fcd2afdebea.tar.gz chromium_src-3576d4645180fee42ab40475dd182fcd2afdebea.tar.bz2 |
Refactor "IsUnderDriveMountPoint" in v2 app code for generalization to non-Drive volumes.
Chrome OS file manager is going to support more types of volumes
in addition to Google Drive that does not mapped to the local filesystem.
(E.g., volumes provided by extensions via fileSystemProvider API,
cloud devices, MTP, ...)
This CL extracts handling of such non-local files in apps fileSystem API code
and removes direct dependence to Google Drive code.
BUG=367028
Review URL: https://codereview.chromium.org/294163010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@273434 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'apps')
-rw-r--r-- | apps/DEPS | 2 | ||||
-rw-r--r-- | apps/launcher.cc | 40 |
2 files changed, 10 insertions, 32 deletions
@@ -17,7 +17,7 @@ include_rules = [ # Temporary allowed includes. # TODO(benwells): remove these (http://crbug.com/159366) "+chrome/browser/chrome_notification_types.h", - "+chrome/browser/chromeos/drive", + "+chrome/browser/chromeos/file_manager/filesystem_api_util.h", "+chrome/browser/chromeos/login/users/user_manager.h", "+chrome/browser/lifetime/application_lifetime.h", "+chrome/browser/profiles", diff --git a/apps/launcher.cc b/apps/launcher.cc index 52c1328..acaec41 100644 --- a/apps/launcher.cc +++ b/apps/launcher.cc @@ -38,9 +38,7 @@ #include "url/gurl.h" #if defined(OS_CHROMEOS) -#include "chrome/browser/chromeos/drive/file_errors.h" -#include "chrome/browser/chromeos/drive/file_system_interface.h" -#include "chrome/browser/chromeos/drive/file_system_util.h" +#include "chrome/browser/chromeos/file_manager/filesystem_api_util.h" #include "chrome/browser/chromeos/login/users/user_manager.h" #endif @@ -162,8 +160,11 @@ class PlatformAppPathLauncher void OnFileValid() { #if defined(OS_CHROMEOS) - if (drive::util::IsUnderDriveMountPoint(file_path_)) { - PlatformAppPathLauncher::GetMimeTypeAndLaunchForDriveFile(); + if (file_manager::util::IsUnderNonNativeLocalPath(profile_, file_path_)) { + file_manager::util::GetNonNativeLocalPathMimeType( + profile_, + file_path_, + base::Bind(&PlatformAppPathLauncher::OnGotMimeType, this)); return; } #endif @@ -212,37 +213,14 @@ class PlatformAppPathLauncher } #if defined(OS_CHROMEOS) - void GetMimeTypeAndLaunchForDriveFile() { - DCHECK_CURRENTLY_ON(BrowserThread::UI); - - drive::FileSystemInterface* file_system = - drive::util::GetFileSystemByProfile(profile_); - if (!file_system) { + void OnGotMimeType(bool success, const std::string& mime_type) { + if (!success) { LaunchWithNoLaunchData(); return; } - - file_system->GetFile( - drive::util::ExtractDrivePath(file_path_), - base::Bind(&PlatformAppPathLauncher::OnGotDriveFile, this)); - } - - void OnGotDriveFile(drive::FileError error, - const base::FilePath& file_path, - scoped_ptr<drive::ResourceEntry> entry) { - DCHECK_CURRENTLY_ON(BrowserThread::UI); - - if (error != drive::FILE_ERROR_OK || - !entry || entry->file_specific_info().is_hosted_document()) { - LaunchWithNoLaunchData(); - return; - } - - const std::string& mime_type = - entry->file_specific_info().content_mime_type(); LaunchWithMimeType(mime_type.empty() ? kFallbackMimeType : mime_type); } -#endif // defined(OS_CHROMEOS) +#endif void LaunchWithNoLaunchData() { // This method is required as an entry point on the UI thread. |