| Index: chrome/browser/extensions/platform_app_launcher.cc
|
| diff --git a/chrome/browser/extensions/platform_app_launcher.cc b/chrome/browser/extensions/platform_app_launcher.cc
|
| index 78548d843f1770c1da2402e30cb077b8a1116dac..93756a872a662a39d507e7a3895db4256f57a140 100644
|
| --- a/chrome/browser/extensions/platform_app_launcher.cc
|
| +++ b/chrome/browser/extensions/platform_app_launcher.cc
|
| @@ -29,6 +29,13 @@
|
| #include "webkit/fileapi/file_system_types.h"
|
| #include "webkit/fileapi/isolated_context.h"
|
|
|
| +#if defined(OS_CHROMEOS)
|
| +#include "chrome/browser/chromeos/drive/drive_file_error.h"
|
| +#include "chrome/browser/chromeos/drive/drive_file_system_interface.h"
|
| +#include "chrome/browser/chromeos/drive/drive_file_system_util.h"
|
| +#include "chrome/browser/chromeos/drive/drive_system_service.h"
|
| +#endif
|
| +
|
| using content::BrowserThread;
|
| using extensions::app_file_handler_util::FileHandlerForId;
|
| using extensions::app_file_handler_util::FileHandlerCanHandleFileWithMimeType;
|
| @@ -102,6 +109,14 @@ class PlatformAppPathLauncher
|
| }
|
|
|
| DCHECK(file_path_.IsAbsolute());
|
| +
|
| +#if defined(OS_CHROMEOS)
|
| + if (drive::util::IsUnderDriveMountPoint(file_path_)) {
|
| + GetMimeTypeAndLaunchForDriveFile();
|
| + return;
|
| + }
|
| +#endif
|
| +
|
| BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, base::Bind(
|
| &PlatformAppPathLauncher::GetMimeTypeAndLaunch, this));
|
| }
|
| @@ -142,6 +157,38 @@ class PlatformAppPathLauncher
|
| &PlatformAppPathLauncher::LaunchWithMimeType, this, mime_type));
|
| }
|
|
|
| +#if defined(OS_CHROMEOS)
|
| + void GetMimeTypeAndLaunchForDriveFile() {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| +
|
| + drive::DriveSystemService* service =
|
| + drive::DriveSystemServiceFactory::FindForProfile(profile_);
|
| + if (!service) {
|
| + LaunchWithNoLaunchData();
|
| + return;
|
| + }
|
| +
|
| + service->file_system()->GetFileByPath(
|
| + drive::util::ExtractDrivePath(file_path_),
|
| + base::Bind(&PlatformAppPathLauncher::OnGotDriveFile, this));
|
| + }
|
| +
|
| + void OnGotDriveFile(drive::DriveFileError error,
|
| + const base::FilePath& file_path,
|
| + const std::string& mime_type,
|
| + drive::DriveFileType file_type) {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| +
|
| + if (error != drive::DRIVE_FILE_OK || mime_type.empty() ||
|
| + file_type != drive::REGULAR_FILE) {
|
| + LaunchWithNoLaunchData();
|
| + return;
|
| + }
|
| +
|
| + LaunchWithMimeType(mime_type);
|
| + }
|
| +#endif // defined(OS_CHROMEOS)
|
| +
|
| void LaunchWithNoLaunchData() {
|
| // This method is required as an entry point on the UI thread.
|
| LaunchPlatformAppWithNoData(profile_, extension_);
|
|
|