OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_BROWSER_FRAME_HOST_RENDER_FRAME_MESSAGE_FILTER_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_MESSAGE_FILTER_H_ |
6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_MESSAGE_FILTER_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_MESSAGE_FILTER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
11 | 11 |
12 #include "content/common/frame_replication_state.h" | 12 #include "content/common/frame_replication_state.h" |
| 13 #include "content/common/render_frame_message_filter.mojom.h" |
| 14 #include "content/public/browser/browser_associated_interface.h" |
13 #include "content/public/browser/browser_message_filter.h" | 15 #include "content/public/browser/browser_message_filter.h" |
14 #include "content/public/common/three_d_api_types.h" | 16 #include "content/public/common/three_d_api_types.h" |
15 #include "net/cookies/canonical_cookie.h" | 17 #include "net/cookies/canonical_cookie.h" |
16 #include "third_party/WebKit/public/web/WebTreeScopeType.h" | 18 #include "third_party/WebKit/public/web/WebTreeScopeType.h" |
17 | 19 |
18 #if defined(ENABLE_PLUGINS) | 20 #if defined(ENABLE_PLUGINS) |
19 #include "content/common/pepper_renderer_instance_data.h" | 21 #include "content/common/pepper_renderer_instance_data.h" |
20 #endif | 22 #endif |
21 | 23 |
22 struct FrameHostMsg_CreateChildFrame_Params; | 24 struct FrameHostMsg_CreateChildFrame_Params; |
(...skipping 11 matching lines...) Expand all Loading... |
34 class RenderWidgetHelper; | 36 class RenderWidgetHelper; |
35 class ResourceContext; | 37 class ResourceContext; |
36 struct WebPluginInfo; | 38 struct WebPluginInfo; |
37 | 39 |
38 // RenderFrameMessageFilter intercepts FrameHost messages on the IO thread | 40 // RenderFrameMessageFilter intercepts FrameHost messages on the IO thread |
39 // that require low-latency processing. The canonical example of this is | 41 // that require low-latency processing. The canonical example of this is |
40 // child-frame creation which is a sync IPC that provides the renderer | 42 // child-frame creation which is a sync IPC that provides the renderer |
41 // with the routing id for a newly created RenderFrame. | 43 // with the routing id for a newly created RenderFrame. |
42 // | 44 // |
43 // This object is created on the UI thread and used on the IO thread. | 45 // This object is created on the UI thread and used on the IO thread. |
44 class CONTENT_EXPORT RenderFrameMessageFilter : public BrowserMessageFilter { | 46 class CONTENT_EXPORT RenderFrameMessageFilter |
| 47 : public BrowserMessageFilter, |
| 48 public BrowserAssociatedInterface<mojom::RenderFrameMessageFilter>, |
| 49 public NON_EXPORTED_BASE(mojom::RenderFrameMessageFilter) { |
45 public: | 50 public: |
46 RenderFrameMessageFilter(int render_process_id, | 51 RenderFrameMessageFilter(int render_process_id, |
47 PluginServiceImpl* plugin_service, | 52 PluginServiceImpl* plugin_service, |
48 BrowserContext* browser_context, | 53 BrowserContext* browser_context, |
49 net::URLRequestContextGetter* request_context, | 54 net::URLRequestContextGetter* request_context, |
50 RenderWidgetHelper* render_widget_helper); | 55 RenderWidgetHelper* render_widget_helper); |
51 | 56 |
52 // BrowserMessageFilter methods: | 57 // BrowserMessageFilter methods: |
53 bool OnMessageReceived(const IPC::Message& message) override; | 58 bool OnMessageReceived(const IPC::Message& message) override; |
| 59 void OnDestruct() const override; |
54 | 60 |
55 protected: | 61 protected: |
56 friend class TestSaveImageFromDataURL; | 62 friend class TestSaveImageFromDataURL; |
57 | 63 |
58 // This method will be overridden by TestSaveImageFromDataURL class for test. | 64 // This method will be overridden by TestSaveImageFromDataURL class for test. |
59 virtual void DownloadUrl(int render_view_id, | 65 virtual void DownloadUrl(int render_view_id, |
60 int render_frame_id, | 66 int render_frame_id, |
61 const GURL& url, | 67 const GURL& url, |
62 const Referrer& referrer, | 68 const Referrer& referrer, |
63 const base::string16& suggested_name, | 69 const base::string16& suggested_name, |
64 const bool use_prompt) const; | 70 const bool use_prompt) const; |
65 | 71 |
66 private: | 72 private: |
| 73 friend class BrowserThread; |
| 74 friend class base::DeleteHelper<RenderFrameMessageFilter>; |
| 75 |
67 class OpenChannelToPpapiPluginCallback; | 76 class OpenChannelToPpapiPluginCallback; |
68 class OpenChannelToPpapiBrokerCallback; | 77 class OpenChannelToPpapiBrokerCallback; |
69 | 78 |
70 ~RenderFrameMessageFilter() override; | 79 ~RenderFrameMessageFilter() override; |
71 | 80 |
72 void OnCreateChildFrame(const FrameHostMsg_CreateChildFrame_Params& params, | 81 void OnCreateChildFrame(const FrameHostMsg_CreateChildFrame_Params& params, |
73 int* new_render_frame_id); | 82 int* new_render_frame_id); |
74 void OnSetCookie(int render_frame_id, | |
75 const GURL& url, | |
76 const GURL& first_party_for_cookies, | |
77 const std::string& cookie); | |
78 void OnGetCookies(int render_frame_id, | 83 void OnGetCookies(int render_frame_id, |
79 const GURL& url, | 84 const GURL& url, |
80 const GURL& first_party_for_cookies, | 85 const GURL& first_party_for_cookies, |
81 IPC::Message* reply_msg); | 86 IPC::Message* reply_msg); |
82 void OnCookiesEnabled(int render_frame_id, | 87 void OnCookiesEnabled(int render_frame_id, |
83 const GURL& url, | 88 const GURL& url, |
84 const GURL& first_party_for_cookies, | 89 const GURL& first_party_for_cookies, |
85 bool* cookies_enabled); | 90 bool* cookies_enabled); |
86 | 91 |
87 // Check the policy for getting cookies. Gets the cookies if allowed. | 92 // Check the policy for getting cookies. Gets the cookies if allowed. |
(...skipping 17 matching lines...) Expand all Loading... |
105 int render_frame_id, | 110 int render_frame_id, |
106 const std::string& url_str); | 111 const std::string& url_str); |
107 | 112 |
108 void OnAre3DAPIsBlocked(int render_frame_id, | 113 void OnAre3DAPIsBlocked(int render_frame_id, |
109 const GURL& top_origin_url, | 114 const GURL& top_origin_url, |
110 ThreeDAPIType requester, | 115 ThreeDAPIType requester, |
111 bool* blocked); | 116 bool* blocked); |
112 | 117 |
113 void OnRenderProcessGone(); | 118 void OnRenderProcessGone(); |
114 | 119 |
| 120 // mojom::RenderFrameMessageFilter: |
| 121 void SetCookie(int32_t render_frame_id, |
| 122 const GURL& url, |
| 123 const GURL& first_party_for_cookies, |
| 124 const mojo::String& cookie) override; |
| 125 |
| 126 |
115 #if defined(ENABLE_PLUGINS) | 127 #if defined(ENABLE_PLUGINS) |
116 void OnGetPlugins(bool refresh, IPC::Message* reply_msg); | 128 void OnGetPlugins(bool refresh, IPC::Message* reply_msg); |
117 void GetPluginsCallback(IPC::Message* reply_msg, | 129 void GetPluginsCallback(IPC::Message* reply_msg, |
118 const std::vector<WebPluginInfo>& plugins); | 130 const std::vector<WebPluginInfo>& plugins); |
119 void OnGetPluginInfo(int render_frame_id, | 131 void OnGetPluginInfo(int render_frame_id, |
120 const GURL& url, | 132 const GURL& url, |
121 const GURL& policy_url, | 133 const GURL& policy_url, |
122 const std::string& mime_type, | 134 const std::string& mime_type, |
123 bool* found, | 135 bool* found, |
124 WebPluginInfo* info, | 136 WebPluginInfo* info, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 | 176 |
165 // Whether this process is used for incognito contents. | 177 // Whether this process is used for incognito contents. |
166 bool incognito_; | 178 bool incognito_; |
167 | 179 |
168 const int render_process_id_; | 180 const int render_process_id_; |
169 }; | 181 }; |
170 | 182 |
171 } // namespace content | 183 } // namespace content |
172 | 184 |
173 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_MESSAGE_FILTER_H_ | 185 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_MESSAGE_FILTER_H_ |
OLD | NEW |