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

Unified Diff: content/renderer/web_intents_host.cc

Issue 9186021: Update chromium code to use WebIntentRequest. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix comments Created 8 years, 11 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
« content/renderer/web_intents_host.h ('K') | « content/renderer/web_intents_host.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/web_intents_host.cc
diff --git a/content/renderer/web_intents_host.cc b/content/renderer/web_intents_host.cc
index 7d96f3d93f81e216c5a585af1757404ca9a8e345..2329e3350a0b9fc13fb527d782845bd93640e0ed 100644
--- a/content/renderer/web_intents_host.cc
+++ b/content/renderer/web_intents_host.cc
@@ -10,10 +10,11 @@
#include "content/renderer/render_view_impl.h"
#include "ipc/ipc_message.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSerializedScriptValue.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebIntentRequest.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSerializedScriptValue.h"
#include "v8/include/v8.h"
#include "webkit/glue/cpp_bound_class.h"
@@ -128,10 +129,19 @@ class WebIntentsHost::BoundDeliveredIntent : public CppBoundClass {
};
WebIntentsHost::WebIntentsHost(RenderViewImpl* render_view)
- : content::RenderViewObserver(render_view) {
+ : content::RenderViewObserver(render_view),
+ id_counter_(0) {
}
-WebIntentsHost::~WebIntentsHost() {}
+WebIntentsHost::~WebIntentsHost() {
+}
+
+int WebIntentsHost::RegisterWebIntent(
+ const WebKit::WebIntentRequest& request) {
+ int id = id_counter_++;
+ intent_requests_[id] = request;
+ return id;
+}
bool WebIntentsHost::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
@@ -151,13 +161,19 @@ void WebIntentsHost::OnWebIntentReply(
webkit_glue::WebIntentReplyType reply_type,
const WebKit::WebString& data,
int intent_id) {
+ std::map<int, WebKit::WebIntentRequest>::iterator request =
+ intent_requests_.find(intent_id);
+ if (request == intent_requests_.end())
+ return;
+ WebKit::WebIntentRequest intent_request = request->second;
+ intent_requests_.erase(request);
+ WebKit::WebSerializedScriptValue value =
+ WebKit::WebSerializedScriptValue::fromString(data);
if (reply_type == webkit_glue::WEB_INTENT_REPLY_SUCCESS) {
- render_view()->GetWebView()->mainFrame()->handleIntentResult(
- intent_id, data);
+ intent_request.postResult(value);
} else {
- render_view()->GetWebView()->mainFrame()->handleIntentFailure(
- intent_id, data);
+ intent_request.postFailure(value);
}
}
« content/renderer/web_intents_host.h ('K') | « content/renderer/web_intents_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698