| 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 #ifndef CHROME_RENDERER_PRERENDER_PRERENDER_WEBMEDIAPLAYER_H_ | 5 #ifndef CHROME_RENDERER_PRERENDER_PRERENDER_MEDIA_LOAD_DEFERRER_H_ |
| 6 #define CHROME_RENDERER_PRERENDER_PRERENDER_WEBMEDIAPLAYER_H_ | 6 #define CHROME_RENDERER_PRERENDER_PRERENDER_MEDIA_LOAD_DEFERRER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "content/public/renderer/render_view_observer.h" | 9 #include "content/public/renderer/render_view_observer.h" |
| 10 | 10 |
| 11 namespace prerender { | 11 namespace prerender { |
| 12 | 12 |
| 13 // Defers media player loading in prerendered pages until the prerendered page | 13 // Defers media player loading in prerendered pages until the prerendered page |
| 14 // is swapped in. | 14 // is swapped in. |
| 15 // | 15 class PrerenderMediaLoadDeferrer : public content::RenderViewObserver { |
| 16 // TODO(scherkus): Rename as this class no longer inherits WebMediaPlayer. | |
| 17 class PrerenderWebMediaPlayer : public content::RenderViewObserver { | |
| 18 public: | 16 public: |
| 19 // Will run |closure| to continue loading the media resource once the page is | 17 // Will run |closure| to continue loading the media resource once the page is |
| 20 // swapped in. | 18 // swapped in. |
| 21 PrerenderWebMediaPlayer(content::RenderView* render_view, | 19 PrerenderMediaLoadDeferrer(content::RenderView* render_view, |
| 22 const base::Closure& closure); | 20 const base::Closure& closure); |
| 23 virtual ~PrerenderWebMediaPlayer(); | 21 virtual ~PrerenderMediaLoadDeferrer(); |
| 24 | 22 |
| 25 private: | 23 private: |
| 26 // RenderViewObserver method: | 24 // RenderViewObserver method: |
| 27 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 25 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 28 | 26 |
| 29 void OnSetIsPrerendering(bool is_prerendering); | 27 void OnSetIsPrerendering(bool is_prerendering); |
| 30 | 28 |
| 31 bool is_prerendering_; | 29 bool is_prerendering_; |
| 32 base::Closure continue_loading_cb_; | 30 base::Closure continue_loading_cb_; |
| 33 | 31 |
| 34 DISALLOW_COPY_AND_ASSIGN(PrerenderWebMediaPlayer); | 32 DISALLOW_COPY_AND_ASSIGN(PrerenderMediaLoadDeferrer); |
| 35 }; | 33 }; |
| 36 | 34 |
| 37 } // namespace prerender | 35 } // namespace prerender |
| 38 | 36 |
| 39 #endif // CHROME_RENDERER_PRERENDER_PRERENDER_WEBMEDIAPLAYER_H_ | 37 #endif // CHROME_RENDERER_PRERENDER_PRERENDER_MEDIA_LOAD_DEFERRER_H_ |
| OLD | NEW |