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

Side by Side Diff: content/renderer/web_intents_host.h

Issue 12225076: Delete most web intents code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | content/renderer/web_intents_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_RENDERER_WEB_INTENTS_HOST_H_
6 #define CONTENT_RENDERER_WEB_INTENTS_HOST_H_
7
8 #include <map>
9
10 #include "base/memory/scoped_ptr.h"
11 #include "content/public/renderer/render_view_observer.h"
12 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBlob.h"
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIntent.h"
15 #include "v8/include/v8.h"
16 #include "webkit/glue/web_intent_data.h"
17 #include "webkit/glue/web_intent_reply_data.h"
18
19 namespace WebKit {
20 class WebDeliveredIntentClient;
21 class WebIntentRequest;
22 class WebFrame;
23 }
24
25 namespace webkit_glue {
26 struct WebIntentData;
27 }
28
29 namespace content {
30 class RenderViewImpl;
31
32 // WebIntentsHost is a delegate for Web Intents messages. It is the
33 // renderer-side handler for IPC messages delivering the intent payload data
34 // and preparing it for access by the service page.
35 class WebIntentsHost : public RenderViewObserver {
36 public:
37 // |render_view| must not be NULL.
38 explicit WebIntentsHost(RenderViewImpl* render_view);
39 virtual ~WebIntentsHost();
40
41 // Called by the RenderView to register a new Web Intent invocation.
42 int RegisterWebIntent(const WebKit::WebIntentRequest& request);
43
44 // Called into when the delivered intent object gets a postResult call.
45 void OnResult(const WebKit::WebString& data);
46 // Called into when the delivered intent object gets a postFailure call.
47 void OnFailure(const WebKit::WebString& data);
48
49 // Forwarded from RenderViewImpl. Notification that a new script context was
50 // created within webkit.
51 virtual void DidCreateScriptContext(WebKit::WebFrame* frame,
52 v8::Handle<v8::Context> ctx,
53 int extension_group,
54 int world_id);
55
56 private:
57 // RenderView::Observer implementation.
58 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
59
60 // Converts incoming intent data to a WebIntent object.
61 WebKit::WebIntent CreateWebIntent(
62 WebKit::WebFrame* frame, const webkit_glue::WebIntentData& intent_data);
63
64 // TODO(gbillock): Do we need various ***ClientRedirect methods to implement
65 // intent cancelling policy? Figure this out.
66
67 // On the service page, handler method for the IntentsMsg_SetWebIntent
68 // message.
69 CONTENT_EXPORT void OnSetIntent(const webkit_glue::WebIntentData& intent);
70
71 // On the client page, handler method for the IntentsMsg_WebIntentReply
72 // message. Forwards |reply| to the registered WebIntentRequest
73 // (found by |intent_id|), where it is dispatched to the client JS callback.
74 void OnWebIntentReply(const webkit_glue::WebIntentReply& reply,
75 int intent_id);
76
77 friend class WebIntentsHostTest;
78
79 // A counter used to assign unique IDs to web intents invocations in this
80 // renderer.
81 int id_counter_;
82
83 // Map tracking registered Web Intent requests by assigned ID numbers to
84 // correctly route any return data.
85 std::map<int, WebKit::WebIntentRequest> intent_requests_;
86
87 // Delivered intent data from the caller.
88 scoped_ptr<webkit_glue::WebIntentData> intent_;
89
90 // The client object which will receive callback notifications from the
91 // delivered intent.
92 scoped_ptr<WebKit::WebDeliveredIntentClient> delivered_intent_client_;
93
94 // If we deliver a browser-originated blob intent to the client,
95 // this is that Blob.
96 WebKit::WebBlob web_blob_;
97
98 DISALLOW_COPY_AND_ASSIGN(WebIntentsHost);
99 };
100
101 } // namespace content
102
103 #endif // CONTENT_RENDERER_WEB_INTENTS_HOST_H_
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | content/renderer/web_intents_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698