Chromium Code Reviews| 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..e2455a4e9efd863bf343f4d9f1408898363a0277 100644 |
| --- a/chrome/browser/extensions/platform_app_launcher.cc |
| +++ b/chrome/browser/extensions/platform_app_launcher.cc |
| @@ -22,6 +22,8 @@ |
| #include "content/public/browser/browser_thread.h" |
| #include "content/public/browser/child_process_security_policy.h" |
| #include "content/public/browser/render_process_host.h" |
| +#include "content/public/browser/web_contents.h" |
| +#include "content/public/browser/web_intents_dispatcher.h" |
| #include "net/base/mime_util.h" |
| #include "net/base/net_util.h" |
| #include "webkit/fileapi/file_system_types.h" |
| @@ -235,11 +237,13 @@ class PlatformAppBlobIntentLauncher |
| : public base::RefCountedThreadSafe<PlatformAppBlobIntentLauncher> { |
| public: |
| PlatformAppBlobIntentLauncher(Profile* profile, |
|
benwells
2012/08/29 12:19:21
Nit: Profile* profile, should be on the next line.
thorogood
2012/08/30 02:37:42
Done.
|
| - const Extension* extension, |
| - const webkit_glue::WebIntentData& data) |
| + const Extension* extension, |
| + content::WebIntentsDispatcher* intents_dispatcher, |
| + content::WebContents* source) |
| : profile_(profile), |
| extension_(extension), |
| - data_(data) {} |
| + intents_dispatcher_(intents_dispatcher), |
| + source_(source) {} |
| void Launch() { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| @@ -286,19 +290,22 @@ class PlatformAppBlobIntentLauncher |
| // 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); |
| + webkit_glue::WebIntentData data = intents_dispatcher_->GetIntent(); |
| + if (!policy->CanReadFile(renderer_id, data.blob_file)) |
| + policy->GrantReadFile(renderer_id, data.blob_file); |
| extensions::AppEventRouter::DispatchOnLaunchedEventWithWebIntent( |
| - profile_, extension_, data_); |
| + profile_, extension_, intents_dispatcher_, source_); |
| } |
| // The profile the app should be run in. |
| Profile* profile_; |
| // The extension providing the app. |
| const Extension* extension_; |
| - // The WebIntent data to be passed through to the app. |
| - const webkit_glue::WebIntentData data_; |
| + // The dispatcher so that platform apps can respond to this intent. |
| + content::WebIntentsDispatcher* intents_dispatcher_; |
| + // The source of this intent. |
| + content::WebContents* source_; |
| DISALLOW_COPY_AND_ASSIGN(PlatformAppBlobIntentLauncher); |
| }; |
| @@ -321,16 +328,19 @@ void LaunchPlatformApp(Profile* profile, |
| void LaunchPlatformAppWithWebIntent( |
| Profile* profile, |
| const Extension* extension, |
| - const webkit_glue::WebIntentData& web_intent_data) { |
| + content::WebIntentsDispatcher* intents_dispatcher, |
| + content::WebContents* source) { |
| + webkit_glue::WebIntentData web_intent_data = intents_dispatcher->GetIntent(); |
| if (web_intent_data.data_type == webkit_glue::WebIntentData::BLOB) { |
| scoped_refptr<PlatformAppBlobIntentLauncher> launcher = |
| - new PlatformAppBlobIntentLauncher(profile, extension, web_intent_data); |
| + new PlatformAppBlobIntentLauncher(profile, extension, |
| + intents_dispatcher, source); |
| launcher->Launch(); |
| return; |
| } |
| extensions::AppEventRouter::DispatchOnLaunchedEventWithWebIntent( |
| - profile, extension, web_intent_data); |
| + profile, extension, intents_dispatcher, source); |
| } |
| } // namespace extensions |