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 has_render_process_host_impl) | |
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 bool has_active_audio = false; | |
200 if (has_render_process_host_impl) { | |
201 scoped_refptr<AudioRendererHost> arh = | |
202 static_cast<RenderProcessHostImpl*>(GetProcess()) | |
203 ->audio_renderer_host(); | |
204 if (arh.get()) | |
205 has_active_audio = arh->RenderViewHasActiveAudio(GetRoutingID()); | |
206 } | |
198 BrowserThread::PostTask( | 207 BrowserThread::PostTask( |
199 BrowserThread::IO, FROM_HERE, | 208 BrowserThread::IO, |
209 FROM_HERE, | |
200 base::Bind(&ResourceDispatcherHostImpl::OnRenderViewHostCreated, | 210 base::Bind(&ResourceDispatcherHostImpl::OnRenderViewHostCreated, |
201 base::Unretained(ResourceDispatcherHostImpl::Get()), | 211 base::Unretained(ResourceDispatcherHostImpl::Get()), |
202 GetProcess()->GetID(), GetRoutingID(), !is_hidden())); | 212 GetProcess()->GetID(), |
213 GetRoutingID(), | |
214 !is_hidden(), | |
215 has_active_audio)); | |
203 } | 216 } |
jam
2014/10/01 20:31:38
actually, now that I look at this some more. how a
| |
204 | |
205 #if defined(ENABLE_BROWSER_CDMS) | 217 #if defined(ENABLE_BROWSER_CDMS) |
206 media_web_contents_observer_.reset(new MediaWebContentsObserver(this)); | 218 media_web_contents_observer_.reset(new MediaWebContentsObserver(this)); |
207 #endif | 219 #endif |
208 } | 220 } |
209 | 221 |
210 RenderViewHostImpl::~RenderViewHostImpl() { | 222 RenderViewHostImpl::~RenderViewHostImpl() { |
211 if (ResourceDispatcherHostImpl::Get()) { | 223 if (ResourceDispatcherHostImpl::Get()) { |
212 BrowserThread::PostTask( | 224 BrowserThread::PostTask( |
213 BrowserThread::IO, FROM_HERE, | 225 BrowserThread::IO, FROM_HERE, |
214 base::Bind(&ResourceDispatcherHostImpl::OnRenderViewHostDeleted, | 226 base::Bind(&ResourceDispatcherHostImpl::OnRenderViewHostDeleted, |
(...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1392 FrameTree* frame_tree = delegate_->GetFrameTree(); | 1404 FrameTree* frame_tree = delegate_->GetFrameTree(); |
1393 | 1405 |
1394 frame_tree->ResetForMainFrameSwap(); | 1406 frame_tree->ResetForMainFrameSwap(); |
1395 } | 1407 } |
1396 | 1408 |
1397 void RenderViewHostImpl::SelectWordAroundCaret() { | 1409 void RenderViewHostImpl::SelectWordAroundCaret() { |
1398 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); | 1410 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); |
1399 } | 1411 } |
1400 | 1412 |
1401 } // namespace content | 1413 } // namespace content |
OLD | NEW |