OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // This file defines utility functions for sending notifications (calling | 5 // This file defines utility functions for sending notifications (calling |
6 // methods that return void and do not have out params) to the RenderViewHost | 6 // methods that return void and do not have out params) to the RenderViewHost |
7 // or one of its delegate interfaces. The notifications are dispatched | 7 // or one of its delegate interfaces. The notifications are dispatched |
8 // asynchronously, and only if the specified RenderViewHost still exists. | 8 // asynchronously, and only if the specified RenderViewHost still exists. |
9 | 9 |
10 #ifndef CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_NOTIFICATION_TASK_H_ | 10 #ifndef CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_NOTIFICATION_TASK_H_ |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 ChromeThread::PostTask( | 140 ChromeThread::PostTask( |
141 ChromeThread::UI, FROM_HERE, | 141 ChromeThread::UI, FROM_HERE, |
142 new RenderViewHostNotificationTask< | 142 new RenderViewHostNotificationTask< |
143 Method, Params, RenderViewHostToRendererManagementDelegate>( | 143 Method, Params, RenderViewHostToRendererManagementDelegate>( |
144 render_process_id, | 144 render_process_id, |
145 render_view_id, | 145 render_view_id, |
146 method, | 146 method, |
147 params)); | 147 params)); |
148 } | 148 } |
149 | 149 |
| 150 // For proxying calls to RenderViewHostDelegate::SSL |
| 151 |
| 152 class RenderViewHostToSSLDelegate { |
| 153 public: |
| 154 typedef RenderViewHostDelegate::SSL MappedType; |
| 155 static MappedType* Map(RenderViewHost* rvh) { |
| 156 return rvh ? rvh->delegate()->GetSSLDelegate() : NULL; |
| 157 } |
| 158 }; |
| 159 |
| 160 template <typename Method, typename Params> |
| 161 inline void CallRenderViewHostSSLDelegateHelper( |
| 162 int render_process_id, |
| 163 int render_view_id, |
| 164 Method method, |
| 165 const Params& params) { |
| 166 ChromeThread::PostTask( |
| 167 ChromeThread::UI, FROM_HERE, |
| 168 new RenderViewHostNotificationTask< |
| 169 Method, Params, RenderViewHostToSSLDelegate>( |
| 170 render_process_id, |
| 171 render_view_id, |
| 172 method, |
| 173 params)); |
| 174 } |
| 175 |
150 } // namespace internal | 176 } // namespace internal |
151 | 177 |
152 // ---------------------------------------------------------------------------- | 178 // ---------------------------------------------------------------------------- |
153 // Proxy calls to the specified RenderViewHost. | 179 // Proxy calls to the specified RenderViewHost. |
154 | 180 |
155 template <typename Method> | 181 template <typename Method> |
156 inline void CallRenderViewHost(int render_process_id, | 182 inline void CallRenderViewHost(int render_process_id, |
157 int render_view_id, | 183 int render_view_id, |
158 Method method) { | 184 Method method) { |
159 internal::CallRenderViewHostHelper(render_process_id, | 185 internal::CallRenderViewHostHelper(render_process_id, |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 const A& a, | 329 const A& a, |
304 const B& b) { | 330 const B& b) { |
305 internal::CallRenderViewHostRendererManagementDelegateHelper( | 331 internal::CallRenderViewHostRendererManagementDelegateHelper( |
306 render_process_id, | 332 render_process_id, |
307 render_view_id, | 333 render_view_id, |
308 method, | 334 method, |
309 MakeTuple(a, b)); | 335 MakeTuple(a, b)); |
310 } | 336 } |
311 | 337 |
312 // ---------------------------------------------------------------------------- | 338 // ---------------------------------------------------------------------------- |
| 339 // Proxy calls to the specified RenderViewHost's SSL delegate. |
| 340 |
| 341 template <typename Method, typename A> |
| 342 inline void CallRenderViewHostSSLDelegate(int render_process_id, |
| 343 int render_view_id, |
| 344 Method method, |
| 345 const A& a) { |
| 346 internal::CallRenderViewHostSSLDelegateHelper( |
| 347 render_process_id, |
| 348 render_view_id, |
| 349 method, |
| 350 MakeTuple(a)); |
| 351 } |
| 352 |
| 353 template <typename Method, typename A, typename B> |
| 354 inline void CallRenderViewHostSSLDelegate(int render_process_id, |
| 355 int render_view_id, |
| 356 Method method, |
| 357 const A& a, |
| 358 const B& b) { |
| 359 internal::CallRenderViewHostSSLDelegateHelper( |
| 360 render_process_id, |
| 361 render_view_id, |
| 362 method, |
| 363 MakeTuple(a, b)); |
| 364 } |
| 365 |
| 366 // ---------------------------------------------------------------------------- |
313 | 367 |
314 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_NOTIFICATION_TASK_H_ | 368 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_NOTIFICATION_TASK_H_ |
OLD | NEW |