| 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 3af7454a25ab3221dd2d1fa85cb3c01c7a13e6af..6654cfa16964f3542cd48e6d7dd79da84eac003d 100644
|
| --- a/chrome/browser/extensions/platform_app_launcher.cc
|
| +++ b/chrome/browser/extensions/platform_app_launcher.cc
|
| @@ -231,12 +231,12 @@ class PlatformAppCommandLineLauncher
|
| // instances is managed by reference counted pointers. As long as an instance
|
| // has outstanding tasks on a message queue it will be retained; once all
|
| // outstanding tasks are completed it will be deleted.
|
| -class PlatformAppBlobIntentLauncher
|
| - : public base::RefCountedThreadSafe<PlatformAppBlobIntentLauncher> {
|
| +class PlatformAppGrantIntentLauncher
|
| + : public base::RefCountedThreadSafe<PlatformAppGrantIntentLauncher> {
|
| public:
|
| - PlatformAppBlobIntentLauncher(Profile* profile,
|
| - const Extension* extension,
|
| - const webkit_glue::WebIntentData& data)
|
| + PlatformAppGrantIntentLauncher(Profile* profile,
|
| + const Extension* extension,
|
| + const webkit_glue::WebIntentData& data)
|
| : profile_(profile),
|
| extension_(extension),
|
| data_(data) {}
|
| @@ -253,7 +253,7 @@ class PlatformAppBlobIntentLauncher
|
| ExtensionSystem::Get(profile_)->lazy_background_task_queue();
|
| if (queue->ShouldEnqueueTask(profile_, extension_)) {
|
| queue->AddPendingTask(profile_, extension_->id(), base::Bind(
|
| - &PlatformAppBlobIntentLauncher::GrantAccessToFileAndLaunch,
|
| + &PlatformAppGrantIntentLauncher::GrantAccessToFileAndLaunch,
|
| this));
|
| return;
|
| }
|
| @@ -267,9 +267,9 @@ class PlatformAppBlobIntentLauncher
|
| }
|
|
|
| private:
|
| - friend class base::RefCountedThreadSafe<PlatformAppBlobIntentLauncher>;
|
| + friend class base::RefCountedThreadSafe<PlatformAppGrantIntentLauncher>;
|
|
|
| - virtual ~PlatformAppBlobIntentLauncher() {}
|
| + virtual ~PlatformAppGrantIntentLauncher() {}
|
|
|
| void GrantAccessToFileAndLaunch(extensions::ExtensionHost* host) {
|
| // If there was an error loading the app page, |host| will be NULL.
|
| @@ -282,12 +282,23 @@ class PlatformAppBlobIntentLauncher
|
| content::ChildProcessSecurityPolicy::GetInstance();
|
| int renderer_id = host->render_process_host()->GetID();
|
|
|
| - // Granting read file permission to allow reading file content.
|
| - // If the renderer already has permission to read these paths, it is not
|
| - // regranted, as this would overwrite any other permissions which the
|
| - // renderer may already have.
|
| - if (!policy->CanReadFile(renderer_id, data_.blob_file))
|
| - policy->GrantReadFile(renderer_id, data_.blob_file);
|
| + if (data_.data_type == webkit_glue::WebIntentData::BLOB) {
|
| + // Granting read file permission to allow reading file content.
|
| + // If the renderer already has permission to read these paths, it is not
|
| + // regranted, as this would overwrite any other permissions which the
|
| + // renderer may already have.
|
| + if (!policy->CanReadFile(renderer_id, data_.blob_file))
|
| + policy->GrantReadFile(renderer_id, data_.blob_file);
|
| + } else if (data_.data_type == webkit_glue::WebIntentData::FILESYSTEM) {
|
| + // Grant read filesystem and read directory permission to allow reading
|
| + // any part of the specified filesystem.
|
| + policy->GrantReadFileSystem(renderer_id, data_.filesystem_id);
|
| +// TODO(thorogood): We may need to revisit this.
|
| +// if (!policy->CanReadDirectory(renderer_id, data_.root_path))
|
| +// policy->GrantReadDirectory(renderer_id, data_.root_path);
|
| + } else {
|
| + NOTREACHED();
|
| + }
|
|
|
| extensions::AppEventRouter::DispatchOnLaunchedEventWithWebIntent(
|
| profile_, extension_, data_);
|
| @@ -300,7 +311,7 @@ class PlatformAppBlobIntentLauncher
|
| // The WebIntent data to be passed through to the app.
|
| const webkit_glue::WebIntentData data_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(PlatformAppBlobIntentLauncher);
|
| + DISALLOW_COPY_AND_ASSIGN(PlatformAppGrantIntentLauncher);
|
| };
|
|
|
| } // namespace
|
| @@ -322,9 +333,10 @@ void LaunchPlatformAppWithWebIntent(
|
| Profile* profile,
|
| const Extension* extension,
|
| const webkit_glue::WebIntentData& web_intent_data) {
|
| - if (web_intent_data.data_type == webkit_glue::WebIntentData::BLOB) {
|
| - scoped_refptr<PlatformAppBlobIntentLauncher> launcher =
|
| - new PlatformAppBlobIntentLauncher(profile, extension, web_intent_data);
|
| + if (web_intent_data.data_type == webkit_glue::WebIntentData::BLOB ||
|
| + web_intent_data.data_type == webkit_glue::WebIntentData::FILESYSTEM) {
|
| + scoped_refptr<PlatformAppGrantIntentLauncher> launcher =
|
| + new PlatformAppGrantIntentLauncher(profile, extension, web_intent_data);
|
| launcher->Launch();
|
| return;
|
| }
|
|
|