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 #include "content/browser/renderer_host/render_view_host_impl.h" | 5 #include "content/browser/renderer_host/render_view_host_impl.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
159 return static_cast<RenderViewHostImpl*>(RenderWidgetHostImpl::From(widget)); | 159 return static_cast<RenderViewHostImpl*>(RenderWidgetHostImpl::From(widget)); |
160 } | 160 } |
161 | 161 |
162 RenderViewHostImpl::RenderViewHostImpl( | 162 RenderViewHostImpl::RenderViewHostImpl( |
163 SiteInstance* instance, | 163 SiteInstance* instance, |
164 RenderViewHostDelegate* delegate, | 164 RenderViewHostDelegate* delegate, |
165 RenderWidgetHostDelegate* widget_delegate, | 165 RenderWidgetHostDelegate* widget_delegate, |
166 int routing_id, | 166 int routing_id, |
167 int main_frame_routing_id, | 167 int main_frame_routing_id, |
168 bool swapped_out, | 168 bool swapped_out, |
169 bool hidden) | 169 bool hidden, |
170 bool setup_for_testing) | |
170 : RenderWidgetHostImpl(widget_delegate, | 171 : RenderWidgetHostImpl(widget_delegate, |
171 instance->GetProcess(), | 172 instance->GetProcess(), |
172 routing_id, | 173 routing_id, |
173 hidden), | 174 hidden), |
174 frames_ref_count_(0), | 175 frames_ref_count_(0), |
175 delegate_(delegate), | 176 delegate_(delegate), |
176 instance_(static_cast<SiteInstanceImpl*>(instance)), | 177 instance_(static_cast<SiteInstanceImpl*>(instance)), |
177 waiting_for_drag_context_response_(false), | 178 waiting_for_drag_context_response_(false), |
178 enabled_bindings_(0), | 179 enabled_bindings_(0), |
179 page_id_(-1), | 180 page_id_(-1), |
180 is_active_(!swapped_out), | 181 is_active_(!swapped_out), |
181 is_swapped_out_(swapped_out), | 182 is_swapped_out_(swapped_out), |
182 main_frame_routing_id_(main_frame_routing_id), | 183 main_frame_routing_id_(main_frame_routing_id), |
183 run_modal_reply_msg_(NULL), | 184 run_modal_reply_msg_(NULL), |
184 run_modal_opener_id_(MSG_ROUTING_NONE), | 185 run_modal_opener_id_(MSG_ROUTING_NONE), |
185 is_waiting_for_close_ack_(false), | 186 is_waiting_for_close_ack_(false), |
186 sudden_termination_allowed_(false), | 187 sudden_termination_allowed_(false), |
187 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING), | 188 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING), |
188 virtual_keyboard_requested_(false), | 189 virtual_keyboard_requested_(false), |
189 is_focused_element_editable_(false), | 190 is_focused_element_editable_(false), |
190 updating_web_preferences_(false), | 191 updating_web_preferences_(false), |
191 weak_factory_(this) { | 192 weak_factory_(this) { |
192 DCHECK(instance_.get()); | 193 DCHECK(instance_.get()); |
193 CHECK(delegate_); // http://crbug.com/82827 | 194 CHECK(delegate_); // http://crbug.com/82827 |
194 | 195 |
195 GetProcess()->EnableSendQueue(); | 196 GetProcess()->EnableSendQueue(); |
196 | 197 |
197 if (ResourceDispatcherHostImpl::Get()) { | 198 if (ResourceDispatcherHostImpl::Get()) { |
199 scoped_refptr<AudioRendererHost> audio_host = | |
DaleCurtis
2014/09/30 17:15:15
It's a bit convoluted to create an empty refptr si
| |
200 setup_for_testing ? scoped_refptr<AudioRendererHost>(NULL) | |
201 : static_cast<RenderProcessHostImpl*>(GetProcess()) | |
202 ->audio_renderer_host(); | |
198 BrowserThread::PostTask( | 203 BrowserThread::PostTask( |
199 BrowserThread::IO, FROM_HERE, | 204 BrowserThread::IO, |
205 FROM_HERE, | |
200 base::Bind(&ResourceDispatcherHostImpl::OnRenderViewHostCreated, | 206 base::Bind(&ResourceDispatcherHostImpl::OnRenderViewHostCreated, |
201 base::Unretained(ResourceDispatcherHostImpl::Get()), | 207 base::Unretained(ResourceDispatcherHostImpl::Get()), |
202 GetProcess()->GetID(), GetRoutingID(), !is_hidden())); | 208 GetProcess()->GetID(), |
209 GetRoutingID(), | |
210 !is_hidden(), | |
211 audio_host.get() | |
212 ? audio_host->RenderViewHasActiveAudio(GetRoutingID()) | |
213 : false)); | |
203 } | 214 } |
204 | |
205 #if defined(ENABLE_BROWSER_CDMS) | 215 #if defined(ENABLE_BROWSER_CDMS) |
206 media_web_contents_observer_.reset(new MediaWebContentsObserver(this)); | 216 media_web_contents_observer_.reset(new MediaWebContentsObserver(this)); |
207 #endif | 217 #endif |
208 } | 218 } |
209 | 219 |
210 RenderViewHostImpl::~RenderViewHostImpl() { | 220 RenderViewHostImpl::~RenderViewHostImpl() { |
211 if (ResourceDispatcherHostImpl::Get()) { | 221 if (ResourceDispatcherHostImpl::Get()) { |
212 BrowserThread::PostTask( | 222 BrowserThread::PostTask( |
213 BrowserThread::IO, FROM_HERE, | 223 BrowserThread::IO, FROM_HERE, |
214 base::Bind(&ResourceDispatcherHostImpl::OnRenderViewHostDeleted, | 224 base::Bind(&ResourceDispatcherHostImpl::OnRenderViewHostDeleted, |
(...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1392 FrameTree* frame_tree = delegate_->GetFrameTree(); | 1402 FrameTree* frame_tree = delegate_->GetFrameTree(); |
1393 | 1403 |
1394 frame_tree->ResetForMainFrameSwap(); | 1404 frame_tree->ResetForMainFrameSwap(); |
1395 } | 1405 } |
1396 | 1406 |
1397 void RenderViewHostImpl::SelectWordAroundCaret() { | 1407 void RenderViewHostImpl::SelectWordAroundCaret() { |
1398 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); | 1408 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); |
1399 } | 1409 } |
1400 | 1410 |
1401 } // namespace content | 1411 } // namespace content |
OLD | NEW |