OLD | NEW |
---|---|
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" |
(...skipping 26 matching lines...) Expand all Loading... | |
37 | 37 |
38 // Called by the RenderView to register a new Web Intent invocation. | 38 // Called by the RenderView to register a new Web Intent invocation. |
39 int RegisterWebIntent(const WebKit::WebIntentRequest& request); | 39 int RegisterWebIntent(const WebKit::WebIntentRequest& request); |
40 | 40 |
41 // Called into when the delivered intent object gets a postResult call. | 41 // Called into when the delivered intent object gets a postResult call. |
42 void OnResult(const WebKit::WebString& data); | 42 void OnResult(const WebKit::WebString& data); |
43 // Called into when the delivered intent object gets a postFailure call. | 43 // Called into when the delivered intent object gets a postFailure call. |
44 void OnFailure(const WebKit::WebString& data); | 44 void OnFailure(const WebKit::WebString& data); |
45 | 45 |
46 private: | 46 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. | 47 // RenderView::Observer implementation. |
56 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 48 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
57 virtual void DidClearWindowObject(WebKit::WebFrame* frame) OVERRIDE; | 49 virtual void DidClearWindowObject(WebKit::WebFrame* frame) OVERRIDE; |
58 | 50 |
59 // TODO(gbillock): Do we need various ***ClientRedirect methods to implement | 51 // TODO(gbillock): Do we need various ***ClientRedirect methods to implement |
60 // intent cancelling policy? Figure this out. | 52 // intent cancelling policy? Figure this out. |
61 | 53 |
62 // On the service page, handler method for the IntentsMsg_SetWebIntent | 54 // On the service page, handler method for the IntentsMsg_SetWebIntent |
63 // message. | 55 // message. |
64 void OnSetIntent(const webkit_glue::WebIntentData& intent); | 56 void OnSetIntent(const webkit_glue::WebIntentData& intent); |
65 | 57 |
66 // On the client page, handler method for the IntentsMsg_WebIntentReply | 58 // On the client page, handler method for the IntentsMsg_WebIntentReply |
67 // message. Forwards the reply |data| to the registered WebIntentRequest | 59 // message. Forwards the reply |data| to the registered WebIntentRequest |
68 // (found by |intent_id|), where it is dispatched to the client JS callback. | 60 // (found by |intent_id|), where it is dispatched to the client JS callback. |
69 void OnWebIntentReply(webkit_glue::WebIntentReplyType reply_type, | 61 void OnWebIntentReply(webkit_glue::WebIntentReplyType reply_type, |
70 const WebKit::WebString& data, | 62 const WebKit::WebString& data, |
71 int intent_id); | 63 int intent_id); |
72 | 64 |
65 friend class WebIntentsHostTest; | |
groby-ooo-7-16
2012/10/05 17:56:35
Why not the more usual FRIEND_TEST_ALL_PREFIXES?
Greg Billock
2012/10/05 22:03:26
I had that, but I'm just calling it from the test
| |
66 | |
67 // A counter used to assign unique IDs to web intents invocations in this | |
68 // renderer. | |
69 int id_counter_; | |
70 | |
71 // Map tracking registered Web Intent requests by assigned ID numbers to | |
72 // correctly route any return data. | |
73 std::map<int, WebKit::WebIntentRequest> intent_requests_; | |
74 | |
73 // Delivered intent data from the caller. | 75 // Delivered intent data from the caller. |
74 scoped_ptr<webkit_glue::WebIntentData> intent_; | 76 scoped_ptr<webkit_glue::WebIntentData> intent_; |
75 | 77 |
76 // The client object which will receive callback notifications from the | 78 // The client object which will receive callback notifications from the |
77 // delivered intent. | 79 // delivered intent. |
78 scoped_ptr<WebKit::WebDeliveredIntentClient> delivered_intent_client_; | 80 scoped_ptr<WebKit::WebDeliveredIntentClient> delivered_intent_client_; |
79 | 81 |
80 // If we deliver a browser-originated blob intent to the client, | 82 // If we deliver a browser-originated blob intent to the client, |
81 // this is that Blob. | 83 // this is that Blob. |
82 WebKit::WebBlob web_blob_; | 84 WebKit::WebBlob web_blob_; |
83 | 85 |
84 DISALLOW_COPY_AND_ASSIGN(WebIntentsHost); | 86 DISALLOW_COPY_AND_ASSIGN(WebIntentsHost); |
85 }; | 87 }; |
86 | 88 |
87 #endif // CONTENT_RENDERER_WEB_INTENTS_HOST_H_ | 89 #endif // CONTENT_RENDERER_WEB_INTENTS_HOST_H_ |
OLD | NEW |