Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1802)

Unified Diff: chrome/browser/extensions/platform_app_launcher.cc

Issue 10828172: Allow platform apps to respond to Web Intents (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: comments Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 d50fdec8231ecedc3d46aeb1d5895ae79b4ab376..44d54db16667e6ab21413de001269750458d04ac 100644
--- a/chrome/browser/extensions/platform_app_launcher.cc
+++ b/chrome/browser/extensions/platform_app_launcher.cc
@@ -22,6 +22,7 @@
#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_intents_dispatcher.h"
#include "net/base/mime_util.h"
#include "net/base/net_util.h"
#include "webkit/fileapi/file_system_types.h"
@@ -235,11 +236,11 @@ class PlatformAppBlobIntentLauncher
: public base::RefCountedThreadSafe<PlatformAppBlobIntentLauncher> {
public:
PlatformAppBlobIntentLauncher(Profile* profile,
- const Extension* extension,
- const webkit_glue::WebIntentData& data)
+ const Extension* extension,
+ content::WebIntentsDispatcher* intents_dispatcher)
: profile_(profile),
extension_(extension),
- data_(data) {}
+ intents_dispatcher_(intents_dispatcher) {}
void Launch() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -286,19 +287,20 @@ 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_);
}
// 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_;
DISALLOW_COPY_AND_ASSIGN(PlatformAppBlobIntentLauncher);
};
@@ -323,16 +325,18 @@ void LaunchPlatformApp(Profile* profile,
void LaunchPlatformAppWithWebIntent(
Profile* profile,
const Extension* extension,
- const webkit_glue::WebIntentData& web_intent_data) {
+ content::WebIntentsDispatcher* intents_dispatcher) {
+ 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);
launcher->Launch();
return;
}
extensions::AppEventRouter::DispatchOnLaunchedEventWithWebIntent(
- profile, extension, web_intent_data);
+ profile, extension, intents_dispatcher);
}
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698