OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 CHROMECAST_BROWSER_CAST_CONTENT_WINDOW_H_ | 5 #ifndef CHROMECAST_BROWSER_CAST_CONTENT_WINDOW_LINUX_H_ |
6 #define CHROMECAST_BROWSER_CAST_CONTENT_WINDOW_H_ | 6 #define CHROMECAST_BROWSER_CAST_CONTENT_WINDOW_LINUX_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "chromecast/browser/cast_content_window.h" |
11 #include "chromecast/graphics/cast_vsync_settings.h" | 12 #include "chromecast/graphics/cast_vsync_settings.h" |
12 #include "content/public/browser/web_contents_observer.h" | 13 #include "content/public/browser/web_contents_observer.h" |
| 14 #include "ui/events/keycodes/keyboard_codes.h" |
13 | 15 |
14 namespace aura { | 16 namespace aura { |
15 class WindowTreeHost; | 17 class WindowTreeHost; |
16 } | 18 } |
17 | 19 |
18 namespace content { | 20 namespace content { |
19 class BrowserContext; | 21 class BrowserContext; |
20 class WebContents; | 22 class WebContents; |
21 } | 23 } |
22 | 24 |
23 namespace chromecast { | 25 namespace chromecast { |
24 namespace shell { | 26 namespace shell { |
25 | 27 |
26 class CastContentWindow : public content::WebContentsObserver, | 28 class CastContentWindowLinux : public CastContentWindow, |
27 public CastVSyncSettings::Observer { | 29 public content::WebContentsObserver, |
| 30 public CastVSyncSettings::Observer { |
28 public: | 31 public: |
29 CastContentWindow(); | 32 // Removes the window from the screen. |
| 33 ~CastContentWindowLinux() override; |
30 | 34 |
31 // Removes the window from the screen. | 35 // CastContentWindow implementation. |
32 ~CastContentWindow() override; | 36 void SetTransparent() override; |
33 | 37 void ShowWebContents(content::WebContents* web_contents) override; |
34 // Sets the window's background to be transparent (call before | |
35 // CreateWindowTree). | |
36 void SetTransparent() { transparent_ = true; } | |
37 | |
38 // Create a full-screen window for |web_contents|. | |
39 void CreateWindowTree(content::WebContents* web_contents); | |
40 | |
41 std::unique_ptr<content::WebContents> CreateWebContents( | 38 std::unique_ptr<content::WebContents> CreateWebContents( |
42 content::BrowserContext* browser_context); | 39 content::BrowserContext* browser_context) override; |
43 | 40 |
44 // content::WebContentsObserver implementation: | 41 // content::WebContentsObserver implementation: |
45 void DidFirstVisuallyNonEmptyPaint() override; | 42 void DidFirstVisuallyNonEmptyPaint() override; |
46 void MediaStartedPlaying(const MediaPlayerInfo& media_info, | 43 void MediaStartedPlaying(const MediaPlayerInfo& media_info, |
47 const MediaPlayerId& id) override; | 44 const MediaPlayerId& id) override; |
48 void MediaStoppedPlaying(const MediaPlayerInfo& media_info, | 45 void MediaStoppedPlaying(const MediaPlayerInfo& media_info, |
49 const MediaPlayerId& id) override; | 46 const MediaPlayerId& id) override; |
50 void RenderViewCreated(content::RenderViewHost* render_view_host) override; | 47 void RenderViewCreated(content::RenderViewHost* render_view_host) override; |
51 | 48 |
52 // CastVSyncSettings::Observer implementation: | 49 // CastVSyncSettings::Observer implementation: |
53 void OnVSyncIntervalChanged(base::TimeDelta interval) override; | 50 void OnVSyncIntervalChanged(base::TimeDelta interval) override; |
54 | 51 |
55 private: | 52 private: |
| 53 friend class CastContentWindow; |
| 54 |
| 55 // This class should only be instantiated by CastContentWindow::Create. |
| 56 CastContentWindowLinux(); |
| 57 |
56 #if defined(USE_AURA) | 58 #if defined(USE_AURA) |
57 std::unique_ptr<aura::WindowTreeHost> window_tree_host_; | 59 std::unique_ptr<aura::WindowTreeHost> window_tree_host_; |
58 #endif | 60 #endif |
59 bool transparent_; | 61 bool transparent_; |
60 | 62 |
61 DISALLOW_COPY_AND_ASSIGN(CastContentWindow); | 63 DISALLOW_COPY_AND_ASSIGN(CastContentWindowLinux); |
62 }; | 64 }; |
63 | 65 |
64 } // namespace shell | 66 } // namespace shell |
65 } // namespace chromecast | 67 } // namespace chromecast |
66 | 68 |
67 #endif // CHROMECAST_BROWSER_CAST_CONTENT_WINDOW_H_ | 69 #endif // CHROMECAST_BROWSER_CAST_CONTENT_WINDOW_LINUX_H_ |
OLD | NEW |