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> |
(...skipping 13 matching lines...) Expand all Loading... |
24 class GURL; | 24 class GURL; |
25 | 25 |
26 namespace net { | 26 namespace net { |
27 class URLRequestContext; | 27 class URLRequestContext; |
28 class URLRequestContextGetter; | 28 class URLRequestContextGetter; |
29 } | 29 } |
30 | 30 |
31 namespace content { | 31 namespace content { |
32 class BrowserContext; | 32 class BrowserContext; |
33 class PluginServiceImpl; | 33 class PluginServiceImpl; |
| 34 struct Referrer; |
34 class RenderWidgetHelper; | 35 class RenderWidgetHelper; |
35 class ResourceContext; | 36 class ResourceContext; |
36 struct WebPluginInfo; | 37 struct WebPluginInfo; |
37 | 38 |
38 // RenderFrameMessageFilter intercepts FrameHost messages on the IO thread | 39 // RenderFrameMessageFilter intercepts FrameHost messages on the IO thread |
39 // that require low-latency processing. The canonical example of this is | 40 // that require low-latency processing. The canonical example of this is |
40 // child-frame creation which is a sync IPC that provides the renderer | 41 // child-frame creation which is a sync IPC that provides the renderer |
41 // with the routing id for a newly created RenderFrame. | 42 // with the routing id for a newly created RenderFrame. |
42 // | 43 // |
43 // This object is created on the UI thread and used on the IO thread. | 44 // This object is created on the UI thread and used on the IO thread. |
44 class RenderFrameMessageFilter : public BrowserMessageFilter { | 45 class CONTENT_EXPORT RenderFrameMessageFilter : public BrowserMessageFilter { |
45 public: | 46 public: |
46 RenderFrameMessageFilter(int render_process_id, | 47 RenderFrameMessageFilter(int render_process_id, |
47 PluginServiceImpl* plugin_service, | 48 PluginServiceImpl* plugin_service, |
48 BrowserContext* browser_context, | 49 BrowserContext* browser_context, |
49 net::URLRequestContextGetter* request_context, | 50 net::URLRequestContextGetter* request_context, |
50 RenderWidgetHelper* render_widget_helper); | 51 RenderWidgetHelper* render_widget_helper); |
51 | 52 |
52 // BrowserMessageFilter methods: | 53 // BrowserMessageFilter methods: |
53 bool OnMessageReceived(const IPC::Message& message) override; | 54 bool OnMessageReceived(const IPC::Message& message) override; |
54 | 55 |
| 56 protected: |
| 57 friend class TestSaveImageFromDataURL; |
| 58 |
| 59 // This method will be overridden by TestSaveImageFromDataURL class for test. |
| 60 virtual void DownloadUrl(int render_view_id, |
| 61 int render_frame_id, |
| 62 const GURL& url, |
| 63 const Referrer& referrer, |
| 64 const base::string16& suggested_name, |
| 65 const bool use_prompt) const; |
| 66 |
55 private: | 67 private: |
56 class OpenChannelToPpapiPluginCallback; | 68 class OpenChannelToPpapiPluginCallback; |
57 class OpenChannelToPpapiBrokerCallback; | 69 class OpenChannelToPpapiBrokerCallback; |
58 | 70 |
59 ~RenderFrameMessageFilter() override; | 71 ~RenderFrameMessageFilter() override; |
60 | 72 |
61 void OnCreateChildFrame(const FrameHostMsg_CreateChildFrame_Params& params, | 73 void OnCreateChildFrame(const FrameHostMsg_CreateChildFrame_Params& params, |
62 int* new_render_frame_id); | 74 int* new_render_frame_id); |
63 void OnSetCookie(int render_frame_id, | 75 void OnSetCookie(int render_frame_id, |
64 const GURL& url, | 76 const GURL& url, |
(...skipping 13 matching lines...) Expand all Loading... |
78 const GURL& url, | 90 const GURL& url, |
79 const GURL& first_party_for_cookies, | 91 const GURL& first_party_for_cookies, |
80 IPC::Message* reply_msg, | 92 IPC::Message* reply_msg, |
81 const net::CookieList& cookie_list); | 93 const net::CookieList& cookie_list); |
82 | 94 |
83 // Writes the cookies to reply messages, and sends the message. | 95 // Writes the cookies to reply messages, and sends the message. |
84 // Callback functions for getting cookies from cookie store. | 96 // Callback functions for getting cookies from cookie store. |
85 void SendGetCookiesResponse(IPC::Message* reply_msg, | 97 void SendGetCookiesResponse(IPC::Message* reply_msg, |
86 const std::string& cookies); | 98 const std::string& cookies); |
87 | 99 |
| 100 void OnDownloadUrl(int render_view_id, |
| 101 int render_frame_id, |
| 102 const GURL& url, |
| 103 const Referrer& referrer, |
| 104 const base::string16& suggested_name); |
| 105 void OnSaveImageFromDataURL(int render_view_id, |
| 106 int render_frame_id, |
| 107 const std::string& url_str); |
| 108 |
88 void OnAre3DAPIsBlocked(int render_frame_id, | 109 void OnAre3DAPIsBlocked(int render_frame_id, |
89 const GURL& top_origin_url, | 110 const GURL& top_origin_url, |
90 ThreeDAPIType requester, | 111 ThreeDAPIType requester, |
91 bool* blocked); | 112 bool* blocked); |
92 | 113 |
93 void OnRenderProcessGone(); | 114 void OnRenderProcessGone(); |
94 | 115 |
95 #if defined(ENABLE_PLUGINS) | 116 #if defined(ENABLE_PLUGINS) |
96 void OnGetPlugins(bool refresh, IPC::Message* reply_msg); | 117 void OnGetPlugins(bool refresh, IPC::Message* reply_msg); |
97 void GetPluginsCallback(IPC::Message* reply_msg, | 118 void GetPluginsCallback(IPC::Message* reply_msg, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 165 |
145 // Whether this process is used for incognito contents. | 166 // Whether this process is used for incognito contents. |
146 bool incognito_; | 167 bool incognito_; |
147 | 168 |
148 const int render_process_id_; | 169 const int render_process_id_; |
149 }; | 170 }; |
150 | 171 |
151 } // namespace content | 172 } // namespace content |
152 | 173 |
153 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_MESSAGE_FILTER_H_ | 174 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_MESSAGE_FILTER_H_ |
OLD | NEW |