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 "chrome/renderer/prerender/prerender_webmediaplayer.h" | 5 #include "chrome/renderer/prerender/prerender_webmediaplayer.h" |
6 | 6 |
7 #include "chrome/common/render_messages.h" | 7 #include "chrome/common/prerender_messages.h" |
8 #include "content/public/renderer/render_view.h" | 8 #include "content/public/renderer/render_view.h" |
9 #include "media/base/filter_collection.h" | 9 #include "media/base/filter_collection.h" |
10 #include "media/base/media_log.h" | 10 #include "media/base/media_log.h" |
11 #include "media/base/pipeline.h" | 11 #include "media/base/pipeline.h" |
12 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" |
13 #include "webkit/media/webmediaplayer_delegate.h" | 13 #include "webkit/media/webmediaplayer_delegate.h" |
14 | 14 |
15 namespace prerender { | 15 namespace prerender { |
16 | 16 |
17 PrerenderWebMediaPlayer::PrerenderWebMediaPlayer( | 17 PrerenderWebMediaPlayer::PrerenderWebMediaPlayer( |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 void PrerenderWebMediaPlayer::cancelLoad() { | 52 void PrerenderWebMediaPlayer::cancelLoad() { |
53 if (is_prerendering_) { | 53 if (is_prerendering_) { |
54 url_to_load_.reset(NULL); | 54 url_to_load_.reset(NULL); |
55 return; | 55 return; |
56 } | 56 } |
57 WebMediaPlayerImpl::cancelLoad(); | 57 WebMediaPlayerImpl::cancelLoad(); |
58 } | 58 } |
59 | 59 |
60 bool PrerenderWebMediaPlayer::OnMessageReceived(const IPC::Message& message) { | 60 bool PrerenderWebMediaPlayer::OnMessageReceived(const IPC::Message& message) { |
61 IPC_BEGIN_MESSAGE_MAP(PrerenderWebMediaPlayer, message) | 61 IPC_BEGIN_MESSAGE_MAP(PrerenderWebMediaPlayer, message) |
62 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetIsPrerendering, OnSetIsPrerendering) | 62 IPC_MESSAGE_HANDLER(PrerenderMsg_SetIsPrerendering, OnSetIsPrerendering) |
63 IPC_END_MESSAGE_MAP() | 63 IPC_END_MESSAGE_MAP() |
64 | 64 |
65 return false; | 65 return false; |
66 } | 66 } |
67 | 67 |
68 void PrerenderWebMediaPlayer::OnSetIsPrerendering(bool is_prerendering) { | 68 void PrerenderWebMediaPlayer::OnSetIsPrerendering(bool is_prerendering) { |
69 // Prerendering can only be enabled prior to a RenderView's first | 69 // Prerendering can only be enabled prior to a RenderView's first |
70 // navigation, so no PrerenderWebMediaPlayer should see the notification | 70 // navigation, so no PrerenderWebMediaPlayer should see the notification |
71 // that enables prerendering. | 71 // that enables prerendering. |
72 DCHECK(!is_prerendering); | 72 DCHECK(!is_prerendering); |
73 if (is_prerendering_ && !is_prerendering) { | 73 if (is_prerendering_ && !is_prerendering) { |
74 is_prerendering_ = false; | 74 is_prerendering_ = false; |
75 if (url_to_load_.get()) | 75 if (url_to_load_.get()) |
76 load(*url_to_load_); | 76 load(*url_to_load_); |
77 } | 77 } |
78 } | 78 } |
79 | 79 |
80 } // namespace prerender | 80 } // namespace prerender |
OLD | NEW |