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/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 2963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2974 RenderWidgetCompositor* rwc = compositor(); | 2974 RenderWidgetCompositor* rwc = compositor(); |
2975 if (!rwc || !webview() || !webview()->devToolsAgent()) | 2975 if (!rwc || !webview() || !webview()->devToolsAgent()) |
2976 return; | 2976 return; |
2977 webview()->devToolsAgent()->setLayerTreeId(rwc->GetLayerTreeId()); | 2977 webview()->devToolsAgent()->setLayerTreeId(rwc->GetLayerTreeId()); |
2978 } | 2978 } |
2979 | 2979 |
2980 // blink::WebFrameClient ----------------------------------------------------- | 2980 // blink::WebFrameClient ----------------------------------------------------- |
2981 | 2981 |
2982 WebMediaPlayer* RenderViewImpl::createMediaPlayer( | 2982 WebMediaPlayer* RenderViewImpl::createMediaPlayer( |
2983 WebFrame* frame, const blink::WebURL& url, WebMediaPlayerClient* client) { | 2983 WebFrame* frame, const blink::WebURL& url, WebMediaPlayerClient* client) { |
| 2984 NOTREACHED(); |
| 2985 return NULL; |
| 2986 } |
| 2987 |
| 2988 blink::WebMediaPlayer* RenderViewImpl::CreateMediaPlayer( |
| 2989 RenderFrame* render_frame, |
| 2990 blink::WebFrame* frame, |
| 2991 const blink::WebURL& url, |
| 2992 blink::WebMediaPlayerClient* client) { |
2984 FOR_EACH_OBSERVER( | 2993 FOR_EACH_OBSERVER( |
2985 RenderViewObserver, observers_, WillCreateMediaPlayer(frame, client)); | 2994 RenderViewObserver, observers_, WillCreateMediaPlayer(frame, client)); |
2986 | 2995 |
2987 WebMediaPlayer* player = CreateWebMediaPlayerForMediaStream(frame, url, | 2996 WebMediaPlayer* player = CreateWebMediaPlayerForMediaStream(frame, url, |
2988 client); | 2997 client); |
2989 if (player) | 2998 if (player) |
2990 return player; | 2999 return player; |
2991 | 3000 |
2992 #if defined(OS_ANDROID) | 3001 #if defined(OS_ANDROID) |
2993 return CreateAndroidWebMediaPlayer(frame, url, client); | 3002 return CreateAndroidWebMediaPlayer(frame, url, client); |
2994 #else | 3003 #else |
2995 scoped_refptr<media::AudioRendererSink> sink; | 3004 scoped_refptr<media::AudioRendererSink> sink; |
2996 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableAudio)) { | 3005 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableAudio)) { |
2997 sink = RenderThreadImpl::current()->GetAudioRendererMixerManager()-> | 3006 sink = RenderThreadImpl::current()->GetAudioRendererMixerManager()-> |
2998 CreateInput(routing_id_); | 3007 CreateInput(routing_id_); |
2999 DVLOG(1) << "Using AudioRendererMixerManager-provided sink: " << sink.get(); | 3008 DVLOG(1) << "Using AudioRendererMixerManager-provided sink: " << sink.get(); |
3000 } | 3009 } |
3001 | 3010 |
3002 WebMediaPlayerParams params( | 3011 WebMediaPlayerParams params( |
3003 RenderThreadImpl::current()->GetMediaThreadMessageLoopProxy(), | 3012 RenderThreadImpl::current()->GetMediaThreadMessageLoopProxy(), |
3004 base::Bind(&ContentRendererClient::DeferMediaLoad, | 3013 base::Bind(&ContentRendererClient::DeferMediaLoad, |
3005 base::Unretained(GetContentClient()->renderer()), | 3014 base::Unretained(GetContentClient()->renderer()), |
3006 static_cast<RenderView*>(this)), | 3015 static_cast<RenderFrame*>(render_frame)), |
3007 sink, | 3016 sink, |
3008 RenderThreadImpl::current()->GetGpuFactories(), | 3017 RenderThreadImpl::current()->GetGpuFactories(), |
3009 new RenderMediaLog()); | 3018 new RenderMediaLog()); |
3010 return new WebMediaPlayerImpl(frame, client, AsWeakPtr(), params); | 3019 return new WebMediaPlayerImpl(frame, client, AsWeakPtr(), params); |
3011 #endif // defined(OS_ANDROID) | 3020 #endif // defined(OS_ANDROID) |
3012 } | 3021 } |
3013 | 3022 |
3014 WebCookieJar* RenderViewImpl::cookieJar(WebFrame* frame) { | 3023 WebCookieJar* RenderViewImpl::cookieJar(WebFrame* frame) { |
3015 return &cookie_jar_; | 3024 return &cookie_jar_; |
3016 } | 3025 } |
(...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4225 data.data(), | 4234 data.data(), |
4226 static_cast<int32>(status))); | 4235 static_cast<int32>(status))); |
4227 } | 4236 } |
4228 | 4237 |
4229 // RenderView implementation --------------------------------------------------- | 4238 // RenderView implementation --------------------------------------------------- |
4230 | 4239 |
4231 bool RenderViewImpl::Send(IPC::Message* message) { | 4240 bool RenderViewImpl::Send(IPC::Message* message) { |
4232 return RenderWidget::Send(message); | 4241 return RenderWidget::Send(message); |
4233 } | 4242 } |
4234 | 4243 |
| 4244 RenderFrame* RenderViewImpl::GetMainRenderFrame() { |
| 4245 return main_render_frame_.get(); |
| 4246 } |
| 4247 |
4235 int RenderViewImpl::GetRoutingID() const { | 4248 int RenderViewImpl::GetRoutingID() const { |
4236 return routing_id_; | 4249 return routing_id_; |
4237 } | 4250 } |
4238 | 4251 |
4239 int RenderViewImpl::GetPageId() const { | 4252 int RenderViewImpl::GetPageId() const { |
4240 return page_id_; | 4253 return page_id_; |
4241 } | 4254 } |
4242 | 4255 |
4243 gfx::Size RenderViewImpl::GetSize() const { | 4256 gfx::Size RenderViewImpl::GetSize() const { |
4244 return size(); | 4257 return size(); |
(...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6013 absolute_url, | 6026 absolute_url, |
6014 title, | 6027 title, |
6015 user_gesture)); | 6028 user_gesture)); |
6016 } | 6029 } |
6017 | 6030 |
6018 blink::WebPageVisibilityState RenderViewImpl::visibilityState() const { | 6031 blink::WebPageVisibilityState RenderViewImpl::visibilityState() const { |
6019 blink::WebPageVisibilityState current_state = is_hidden() ? | 6032 blink::WebPageVisibilityState current_state = is_hidden() ? |
6020 blink::WebPageVisibilityStateHidden : | 6033 blink::WebPageVisibilityStateHidden : |
6021 blink::WebPageVisibilityStateVisible; | 6034 blink::WebPageVisibilityStateVisible; |
6022 blink::WebPageVisibilityState override_state = current_state; | 6035 blink::WebPageVisibilityState override_state = current_state; |
| 6036 // TODO(jam): move this method to WebFrameClient. |
6023 if (GetContentClient()->renderer()-> | 6037 if (GetContentClient()->renderer()-> |
6024 ShouldOverridePageVisibilityState(this, | 6038 ShouldOverridePageVisibilityState(main_render_frame_.get(), |
6025 &override_state)) | 6039 &override_state)) |
6026 return override_state; | 6040 return override_state; |
6027 return current_state; | 6041 return current_state; |
6028 } | 6042 } |
6029 | 6043 |
6030 blink::WebUserMediaClient* RenderViewImpl::userMediaClient() { | 6044 blink::WebUserMediaClient* RenderViewImpl::userMediaClient() { |
6031 // This can happen in tests, in which case it's OK to return NULL. | 6045 // This can happen in tests, in which case it's OK to return NULL. |
6032 if (!InitializeMediaStreamClient()) | 6046 if (!InitializeMediaStreamClient()) |
6033 return NULL; | 6047 return NULL; |
6034 | 6048 |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6429 for (size_t i = 0; i < icon_urls.size(); i++) { | 6443 for (size_t i = 0; i < icon_urls.size(); i++) { |
6430 WebURL url = icon_urls[i].iconURL(); | 6444 WebURL url = icon_urls[i].iconURL(); |
6431 if (!url.isEmpty()) | 6445 if (!url.isEmpty()) |
6432 urls.push_back(FaviconURL(url, | 6446 urls.push_back(FaviconURL(url, |
6433 ToFaviconType(icon_urls[i].iconType()))); | 6447 ToFaviconType(icon_urls[i].iconType()))); |
6434 } | 6448 } |
6435 SendUpdateFaviconURL(urls); | 6449 SendUpdateFaviconURL(urls); |
6436 } | 6450 } |
6437 | 6451 |
6438 } // namespace content | 6452 } // namespace content |
OLD | NEW |