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_BROWSER_RENDERER_HOST_RENDER_WIDGET_HELPER_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HELPER_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HELPER_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HELPER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 | 11 |
12 #include "base/atomic_sequence_num.h" | 12 #include "base/atomic_sequence_num.h" |
13 #include "base/containers/hash_tables.h" | 13 #include "base/containers/hash_tables.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/process/process.h" | 16 #include "base/process/process.h" |
17 #include "content/common/render_message_filter.mojom.h" | 17 #include "content/common/render_message_filter.mojom.h" |
18 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
19 #include "content/public/browser/content_browser_client.h" | 19 #include "content/public/browser/content_browser_client.h" |
20 #include "content/public/browser/global_request_id.h" | 20 #include "content/public/browser/global_request_id.h" |
21 #include "third_party/WebKit/public/web/WebPopupType.h" | 21 #include "third_party/WebKit/public/web/WebPopupType.h" |
22 #include "ui/gfx/native_widget_types.h" | 22 #include "ui/gfx/native_widget_types.h" |
23 | 23 |
24 namespace content { | 24 namespace content { |
| 25 |
25 class ResourceDispatcherHostImpl; | 26 class ResourceDispatcherHostImpl; |
26 class SessionStorageNamespace; | |
27 | 27 |
28 // Instantiated per RenderProcessHost to provide various optimizations on | 28 // Instantiated per RenderProcessHost to provide various optimizations on |
29 // behalf of a RenderWidgetHost. This class bridges between the IO thread | 29 // behalf of a RenderWidgetHost. This class bridges between the IO thread |
30 // where the RenderProcessHost's MessageFilter lives and the UI thread where | 30 // where the RenderProcessHost's MessageFilter lives and the UI thread where |
31 // the RenderWidgetHost lives. | 31 // the RenderWidgetHost lives. |
32 class RenderWidgetHelper | 32 class RenderWidgetHelper |
33 : public base::RefCountedThreadSafe<RenderWidgetHelper, | 33 : public base::RefCountedThreadSafe<RenderWidgetHelper, |
34 BrowserThread::DeleteOnIOThread> { | 34 BrowserThread::DeleteOnIOThread> { |
35 public: | 35 public: |
36 RenderWidgetHelper(); | 36 RenderWidgetHelper(); |
(...skipping 12 matching lines...) Expand all Loading... |
49 static RenderWidgetHelper* FromProcessHostID(int render_process_host_id); | 49 static RenderWidgetHelper* FromProcessHostID(int render_process_host_id); |
50 | 50 |
51 // UI THREAD ONLY ----------------------------------------------------------- | 51 // UI THREAD ONLY ----------------------------------------------------------- |
52 | 52 |
53 // These two functions provide the backend implementation of the | 53 // These two functions provide the backend implementation of the |
54 // corresponding functions in RenderProcessHost. See those declarations | 54 // corresponding functions in RenderProcessHost. See those declarations |
55 // for documentation. | 55 // for documentation. |
56 void ResumeDeferredNavigation(const GlobalRequestID& request_id); | 56 void ResumeDeferredNavigation(const GlobalRequestID& request_id); |
57 | 57 |
58 // IO THREAD ONLY ----------------------------------------------------------- | 58 // IO THREAD ONLY ----------------------------------------------------------- |
59 | |
60 void CreateNewWindow(mojom::CreateNewWindowParamsPtr params, | |
61 bool no_javascript_access, | |
62 int32_t* render_view_route_id, | |
63 int32_t* main_frame_route_id, | |
64 int32_t* main_frame_widget_route_id, | |
65 SessionStorageNamespace* session_storage_namespace); | |
66 void CreateNewWidget(int opener_id, | 59 void CreateNewWidget(int opener_id, |
67 blink::WebPopupType popup_type, | 60 blink::WebPopupType popup_type, |
68 int* route_id); | 61 int* route_id); |
69 void CreateNewFullscreenWidget(int opener_id, int* route_id); | 62 void CreateNewFullscreenWidget(int opener_id, int* route_id); |
70 | 63 |
71 private: | 64 private: |
72 friend class base::RefCountedThreadSafe<RenderWidgetHelper>; | 65 friend class base::RefCountedThreadSafe<RenderWidgetHelper>; |
73 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; | 66 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; |
74 friend class base::DeleteHelper<RenderWidgetHelper>; | 67 friend class base::DeleteHelper<RenderWidgetHelper>; |
75 | 68 |
76 ~RenderWidgetHelper(); | 69 ~RenderWidgetHelper(); |
77 | 70 |
78 // Called on the UI thread to finish creating a window. | |
79 void OnCreateNewWindowOnUI( | |
80 mojom::CreateNewWindowParamsPtr params, | |
81 int32_t render_view_route_id, | |
82 int32_t main_frame_route_id, | |
83 int32_t main_frame_widget_route_id, | |
84 SessionStorageNamespace* session_storage_namespace); | |
85 | |
86 // Called on the UI thread to finish creating a widget. | 71 // Called on the UI thread to finish creating a widget. |
87 void OnCreateWidgetOnUI(int32_t opener_id, | 72 void OnCreateWidgetOnUI(int32_t opener_id, |
88 int32_t route_id, | 73 int32_t route_id, |
89 blink::WebPopupType popup_type); | 74 blink::WebPopupType popup_type); |
90 | 75 |
91 // Called on the UI thread to create a fullscreen widget. | 76 // Called on the UI thread to create a fullscreen widget. |
92 void OnCreateFullscreenWidgetOnUI(int32_t opener_id, int32_t route_id); | 77 void OnCreateFullscreenWidgetOnUI(int32_t opener_id, int32_t route_id); |
93 | 78 |
94 // Called on the IO thread to resume a paused navigation in the network | 79 // Called on the IO thread to resume a paused navigation in the network |
95 // stack without transferring it to a new renderer process. | 80 // stack without transferring it to a new renderer process. |
96 void OnResumeDeferredNavigation(const GlobalRequestID& request_id); | 81 void OnResumeDeferredNavigation(const GlobalRequestID& request_id); |
97 | 82 |
98 // Called on the IO thread to resume a navigation paused immediately after | 83 // Called on the IO thread to resume a navigation paused immediately after |
99 // receiving response headers. | 84 // receiving response headers. |
100 void OnResumeResponseDeferredAtStart(const GlobalRequestID& request_id); | 85 void OnResumeResponseDeferredAtStart(const GlobalRequestID& request_id); |
101 | 86 |
102 int render_process_id_; | 87 int render_process_id_; |
103 | 88 |
104 // The next routing id to use. | 89 // The next routing id to use. |
105 base::AtomicSequenceNumber next_routing_id_; | 90 base::AtomicSequenceNumber next_routing_id_; |
106 | 91 |
107 ResourceDispatcherHostImpl* resource_dispatcher_host_; | 92 ResourceDispatcherHostImpl* resource_dispatcher_host_; |
108 | 93 |
109 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHelper); | 94 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHelper); |
110 }; | 95 }; |
111 | 96 |
112 } // namespace content | 97 } // namespace content |
113 | 98 |
114 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HELPER_H_ | 99 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HELPER_H_ |
OLD | NEW |