Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: content/public/test/mock_render_thread.h

Issue 1303773002: Give the main frame a RenderWidget. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: plumb through surface ID *and* widget surface ID for window.open Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_PUBLIC_TEST_MOCK_RENDER_THREAD_H_ 5 #ifndef CONTENT_PUBLIC_TEST_MOCK_RENDER_THREAD_H_
6 #define CONTENT_PUBLIC_TEST_MOCK_RENDER_THREAD_H_ 6 #define CONTENT_PUBLIC_TEST_MOCK_RENDER_THREAD_H_
7 7
8 #include "base/memory/shared_memory.h" 8 #include "base/memory/shared_memory.h"
9 #include "base/observer_list.h" 9 #include "base/observer_list.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
11 #include "cc/test/test_shared_bitmap_manager.h" 11 #include "cc/test/test_shared_bitmap_manager.h"
12 #include "content/public/renderer/render_thread.h" 12 #include "content/public/renderer/render_thread.h"
13 #include "ipc/ipc_test_sink.h" 13 #include "ipc/ipc_test_sink.h"
14 #include "ipc/message_filter.h" 14 #include "ipc/message_filter.h"
15 #include "third_party/WebKit/public/web/WebPopupType.h" 15 #include "third_party/WebKit/public/web/WebPopupType.h"
16 16
17 struct ViewHostMsg_CreateWindow_Params; 17 struct ViewHostMsg_CreateWindow_Params;
18 struct ViewHostMsg_CreateWindow_Reply;
18 19
19 namespace IPC { 20 namespace IPC {
20 class MessageFilter; 21 class MessageFilter;
21 class MessageReplyDeserializer; 22 class MessageReplyDeserializer;
22 } 23 }
23 24
24 namespace blink { 25 namespace blink {
25 enum class WebSandboxFlags; 26 enum class WebSandboxFlags;
26 enum class WebTreeScopeType; 27 enum class WebTreeScopeType;
27 } 28 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 } 92 }
92 93
93 int32 opener_id() const { 94 int32 opener_id() const {
94 return opener_id_; 95 return opener_id_;
95 } 96 }
96 97
97 void set_new_window_routing_id(int32 id) { 98 void set_new_window_routing_id(int32 id) {
98 new_window_routing_id_ = id; 99 new_window_routing_id_ = id;
99 } 100 }
100 101
102 void set_new_window_main_frame_widget_routing_id(int32 id) {
103 new_window_main_frame_widget_routing_id_ = id;
104 }
105
101 void set_new_frame_routing_id(int32 id) { 106 void set_new_frame_routing_id(int32 id) {
102 new_frame_routing_id_ = id; 107 new_frame_routing_id_ = id;
103 } 108 }
104 109
105 // Simulates the Widget receiving a close message. This should result 110 // Simulates the Widget receiving a close message. This should result
106 // on releasing the internal reference counts and destroying the internal 111 // on releasing the internal reference counts and destroying the internal
107 // state. 112 // state.
108 void SendCloseMessage(); 113 void SendCloseMessage();
109 114
110 // Dispatches control messages to observers. 115 // Dispatches control messages to observers.
111 bool OnControlMessageReceived(const IPC::Message& msg); 116 bool OnControlMessageReceived(const IPC::Message& msg);
112 117
113 base::ObserverList<RenderProcessObserver>& observers() { return observers_; } 118 base::ObserverList<RenderProcessObserver>& observers() { return observers_; }
114 119
115 protected: 120 protected:
116 // This function operates as a regular IPC listener. Subclasses 121 // This function operates as a regular IPC listener. Subclasses
117 // overriding this should first delegate to this implementation. 122 // overriding this should first delegate to this implementation.
118 virtual bool OnMessageReceived(const IPC::Message& msg); 123 virtual bool OnMessageReceived(const IPC::Message& msg);
119 124
120 // The Widget expects to be returned valid route_id. 125 // The Widget expects to be returned valid route_id.
121 void OnCreateWidget(int opener_id, 126 void OnCreateWidget(int opener_id,
122 blink::WebPopupType popup_type, 127 blink::WebPopupType popup_type,
123 int* route_id, 128 int* route_id,
124 int* surface_id); 129 int* surface_id);
125 130
126 // The View expects to be returned a valid route_id different from its own. 131 // The View expects to be returned a valid |reply.route_id| different from its
127 // We do not keep track of the newly created widget in MockRenderThread, 132 // own. We do not keep track of the newly created widget in MockRenderThread,
128 // so it must be cleaned up on its own. 133 // so it must be cleaned up on its own.
129 void OnCreateWindow( 134 void OnCreateWindow(const ViewHostMsg_CreateWindow_Params& params,
130 const ViewHostMsg_CreateWindow_Params& params, 135 ViewHostMsg_CreateWindow_Reply* reply);
131 int* route_id,
132 int* main_frame_route_id,
133 int* surface_id,
134 int64* cloned_session_storage_namespace_id);
135 136
136 // The Frame expects to be returned a valid route_id different from its own. 137 // The Frame expects to be returned a valid route_id different from its own.
137 void OnCreateChildFrame(int new_frame_routing_id, 138 void OnCreateChildFrame(int new_frame_routing_id,
138 blink::WebTreeScopeType scope, 139 blink::WebTreeScopeType scope,
139 const std::string& frame_name, 140 const std::string& frame_name,
140 blink::WebSandboxFlags sandbox_flags, 141 blink::WebSandboxFlags sandbox_flags,
141 int* new_render_frame_id); 142 int* new_render_frame_id);
142 143
143 #if defined(OS_WIN) 144 #if defined(OS_WIN)
144 void OnDuplicateSection(base::SharedMemoryHandle renderer_handle, 145 void OnDuplicateSection(base::SharedMemoryHandle renderer_handle,
145 base::SharedMemoryHandle* browser_handle); 146 base::SharedMemoryHandle* browser_handle);
146 #endif 147 #endif
147 148
148 IPC::TestSink sink_; 149 IPC::TestSink sink_;
149 150
150 // Routing id what will be assigned to the Widget. 151 // Routing id what will be assigned to the Widget.
151 int32 routing_id_; 152 int32 routing_id_;
152 153
153 // Surface id what will be assigned to the Widget. 154 // Surface id what will be assigned to the Widget.
154 int32 surface_id_; 155 int32 surface_id_;
155 156
156 // Opener id reported by the Widget. 157 // Opener id reported by the Widget.
157 int32 opener_id_; 158 int32 opener_id_;
158 159
159 // Routing id that will be assigned to a CreateWindow Widget. 160 // Routing id that will be assigned to a CreateWindow Widget.
160 int32 new_window_routing_id_; 161 int32 new_window_routing_id_;
161 int32 new_window_main_frame_routing_id_; 162 int32 new_window_main_frame_routing_id_;
163 int32 new_window_main_frame_widget_routing_id_;
162 int32 new_frame_routing_id_; 164 int32 new_frame_routing_id_;
163 165
164 // The last known good deserializer for sync messages. 166 // The last known good deserializer for sync messages.
165 scoped_ptr<IPC::MessageReplyDeserializer> reply_deserializer_; 167 scoped_ptr<IPC::MessageReplyDeserializer> reply_deserializer_;
166 168
167 // A list of message filters added to this thread. 169 // A list of message filters added to this thread.
168 std::vector<scoped_refptr<IPC::MessageFilter> > filters_; 170 std::vector<scoped_refptr<IPC::MessageFilter> > filters_;
169 171
170 // Observers to notify. 172 // Observers to notify.
171 base::ObserverList<RenderProcessObserver> observers_; 173 base::ObserverList<RenderProcessObserver> observers_;
172 174
173 cc::TestSharedBitmapManager shared_bitmap_manager_; 175 cc::TestSharedBitmapManager shared_bitmap_manager_;
174 }; 176 };
175 177
176 } // namespace content 178 } // namespace content
177 179
178 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_THREAD_H_ 180 #endif // CONTENT_PUBLIC_TEST_MOCK_RENDER_THREAD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698