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

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

Issue 11026070: Add API to construct new vector interchange MIME data type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review comment changes Created 8 years, 2 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_RENDERER_WEB_INTENTS_HOST_H_ 5 #ifndef CONTENT_RENDERER_WEB_INTENTS_HOST_H_
6 #define CONTENT_RENDERER_WEB_INTENTS_HOST_H_ 6 #define CONTENT_RENDERER_WEB_INTENTS_HOST_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "content/public/renderer/render_view_observer.h" 11 #include "content/public/renderer/render_view_observer.h"
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBlob.h" 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBlob.h"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIntent.h"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" 14 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
14 #include "webkit/glue/web_intent_data.h" 15 #include "webkit/glue/web_intent_data.h"
15 #include "webkit/glue/web_intent_reply_data.h" 16 #include "webkit/glue/web_intent_reply_data.h"
16 17
17 class RenderViewImpl; 18 class RenderViewImpl;
18 19
19 namespace WebKit { 20 namespace WebKit {
20 class WebDeliveredIntentClient; 21 class WebDeliveredIntentClient;
21 class WebIntentRequest; 22 class WebIntentRequest;
22 class WebFrame; 23 class WebFrame;
(...skipping 14 matching lines...) Expand all
37 38
38 // Called by the RenderView to register a new Web Intent invocation. 39 // Called by the RenderView to register a new Web Intent invocation.
39 int RegisterWebIntent(const WebKit::WebIntentRequest& request); 40 int RegisterWebIntent(const WebKit::WebIntentRequest& request);
40 41
41 // Called into when the delivered intent object gets a postResult call. 42 // Called into when the delivered intent object gets a postResult call.
42 void OnResult(const WebKit::WebString& data); 43 void OnResult(const WebKit::WebString& data);
43 // Called into when the delivered intent object gets a postFailure call. 44 // Called into when the delivered intent object gets a postFailure call.
44 void OnFailure(const WebKit::WebString& data); 45 void OnFailure(const WebKit::WebString& data);
45 46
46 private: 47 private:
47 // A counter used to assign unique IDs to web intents invocations in this
48 // renderer.
49 int id_counter_;
50
51 // Map tracking registered Web Intent requests by assigned ID numbers to
52 // correctly route any return data.
53 std::map<int, WebKit::WebIntentRequest> intent_requests_;
54
55 // RenderView::Observer implementation. 48 // RenderView::Observer implementation.
56 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 49 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
57 virtual void DidClearWindowObject(WebKit::WebFrame* frame) OVERRIDE; 50 virtual void DidClearWindowObject(WebKit::WebFrame* frame) OVERRIDE;
58 51
52 // Converts incoming intent data to a WebIntent object.
53 WebKit::WebIntent CreateWebIntent(
54 WebKit::WebFrame* frame, const webkit_glue::WebIntentData& intent_data);
55
59 // TODO(gbillock): Do we need various ***ClientRedirect methods to implement 56 // TODO(gbillock): Do we need various ***ClientRedirect methods to implement
60 // intent cancelling policy? Figure this out. 57 // intent cancelling policy? Figure this out.
61 58
62 // On the service page, handler method for the IntentsMsg_SetWebIntent 59 // On the service page, handler method for the IntentsMsg_SetWebIntent
63 // message. 60 // message.
64 void OnSetIntent(const webkit_glue::WebIntentData& intent); 61 CONTENT_EXPORT void OnSetIntent(const webkit_glue::WebIntentData& intent);
65 62
66 // On the client page, handler method for the IntentsMsg_WebIntentReply 63 // On the client page, handler method for the IntentsMsg_WebIntentReply
67 // message. Forwards the reply |data| to the registered WebIntentRequest 64 // message. Forwards the reply |data| to the registered WebIntentRequest
68 // (found by |intent_id|), where it is dispatched to the client JS callback. 65 // (found by |intent_id|), where it is dispatched to the client JS callback.
69 void OnWebIntentReply(webkit_glue::WebIntentReplyType reply_type, 66 void OnWebIntentReply(webkit_glue::WebIntentReplyType reply_type,
70 const WebKit::WebString& data, 67 const WebKit::WebString& data,
71 int intent_id); 68 int intent_id);
72 69
70 friend class WebIntentsHostTest;
71
72 // A counter used to assign unique IDs to web intents invocations in this
73 // renderer.
74 int id_counter_;
75
76 // Map tracking registered Web Intent requests by assigned ID numbers to
77 // correctly route any return data.
78 std::map<int, WebKit::WebIntentRequest> intent_requests_;
79
73 // Delivered intent data from the caller. 80 // Delivered intent data from the caller.
74 scoped_ptr<webkit_glue::WebIntentData> intent_; 81 scoped_ptr<webkit_glue::WebIntentData> intent_;
75 82
76 // The client object which will receive callback notifications from the 83 // The client object which will receive callback notifications from the
77 // delivered intent. 84 // delivered intent.
78 scoped_ptr<WebKit::WebDeliveredIntentClient> delivered_intent_client_; 85 scoped_ptr<WebKit::WebDeliveredIntentClient> delivered_intent_client_;
79 86
80 // If we deliver a browser-originated blob intent to the client, 87 // If we deliver a browser-originated blob intent to the client,
81 // this is that Blob. 88 // this is that Blob.
82 WebKit::WebBlob web_blob_; 89 WebKit::WebBlob web_blob_;
83 90
84 DISALLOW_COPY_AND_ASSIGN(WebIntentsHost); 91 DISALLOW_COPY_AND_ASSIGN(WebIntentsHost);
85 }; 92 };
86 93
87 #endif // CONTENT_RENDERER_WEB_INTENTS_HOST_H_ 94 #endif // CONTENT_RENDERER_WEB_INTENTS_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698