diff options
author | gbillock@chromium.org <gbillock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-21 20:26:00 +0000 |
---|---|---|
committer | gbillock@chromium.org <gbillock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-21 20:26:00 +0000 |
commit | 0d9989d93967a155220c08d7ffe2687a4d3f00ae (patch) | |
tree | c8031b951248324e352a0feeda171c562577e9d5 /content/renderer/web_intents_host.h | |
parent | 757a8eb4c023fc3b9c6cc59be0005a9bf12c438e (diff) | |
download | chromium_src-0d9989d93967a155220c08d7ffe2687a4d3f00ae.zip chromium_src-0d9989d93967a155220c08d7ffe2687a4d3f00ae.tar.gz chromium_src-0d9989d93967a155220c08d7ffe2687a4d3f00ae.tar.bz2 |
Rename IntentsHost -> WebIntentsDispatcher and IntentsDispatcher -> WebIntentsHost.
R=jhawkins@chromium.org,jam@chromium.org
BUG=104980
TEST=WebIntentPickerControllerBrowsertest
Review URL: http://codereview.chromium.org/8934011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115385 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer/web_intents_host.h')
-rw-r--r-- | content/renderer/web_intents_host.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/content/renderer/web_intents_host.h b/content/renderer/web_intents_host.h new file mode 100644 index 0000000..4567dcd --- /dev/null +++ b/content/renderer/web_intents_host.h @@ -0,0 +1,69 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_RENDERER_WEB_INTENTS_HOST_H_ +#define CONTENT_RENDERER_WEB_INTENTS_HOST_H_ +#pragma once + +#include "base/memory/scoped_ptr.h" +#include "content/public/renderer/render_view_observer.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" +#include "webkit/glue/web_intent_data.h" +#include "webkit/glue/web_intent_reply_data.h" + +class RenderViewImpl; + +namespace WebKit { +class WebFrame; +} + +namespace webkit_glue { +struct WebIntentData; +} + +// WebIntentsHost is a delegate for Web Intents messages. It is the +// renderer-side handler for IPC messages delivering the intent payload data +// and preparing it for access by the service page. +class WebIntentsHost : public content::RenderViewObserver { + public: + // |render_view| must not be NULL. + explicit WebIntentsHost(RenderViewImpl* render_view); + virtual ~WebIntentsHost(); + + // Called by the bound intent object to register the result from the service + // page. + void OnResult(const WebKit::WebString& data); + void OnFailure(const WebKit::WebString& data); + + private: + class BoundDeliveredIntent; + + // RenderView::Observer implementation. + virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; + virtual void DidClearWindowObject(WebKit::WebFrame* frame) OVERRIDE; + + // TODO(gbillock): Do we need various ***ClientRedirect methods to implement + // intent cancelling policy? Figure this out. + + // On the service page, handler method for the IntentsMsg_SetWebIntent + // message. + void OnSetIntent(const webkit_glue::WebIntentData& intent); + + // On the client page, handler method for the IntentsMsg_WebIntentReply + // message. + void OnWebIntentReply(webkit_glue::WebIntentReplyType reply_type, + const WebKit::WebString& data, + int intent_id); + + // Delivered intent data from the caller. + scoped_ptr<webkit_glue::WebIntentData> intent_; + + // Representation of the intent data as a C++ bound NPAPI object to be + // injected into the Javascript context. + scoped_ptr<BoundDeliveredIntent> delivered_intent_; + + DISALLOW_COPY_AND_ASSIGN(WebIntentsHost); +}; + +#endif // CONTENT_RENDERER_WEB_INTENTS_HOST_H_ |