Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(947)

Side by Side Diff: chromecast/browser/cast_content_window.h

Issue 2570623003: [Chromecast] Turn CastContentWindow into an abstract interface. (Closed)
Patch Set: Set user data outside of contructor Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_H_
6 #define CHROMECAST_BROWSER_CAST_CONTENT_WINDOW_H_ 6 #define CHROMECAST_BROWSER_CAST_CONTENT_WINDOW_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "chromecast/graphics/cast_vsync_settings.h" 11 #include "ui/events/keycodes/keyboard_codes.h"
12 #include "content/public/browser/web_contents_observer.h"
13
14 namespace aura {
15 class WindowTreeHost;
16 }
17 12
18 namespace content { 13 namespace content {
19 class BrowserContext; 14 class BrowserContext;
20 class WebContents; 15 class WebContents;
21 } 16 }
22 17
23 namespace chromecast { 18 namespace chromecast {
24 namespace shell { 19 namespace shell {
25 20
26 class CastContentWindow : public content::WebContentsObserver, 21 // Class that represents the "window" a WebContents is displayed in cast_shell.
27 public CastVSyncSettings::Observer { 22 // For Linux, this represents an Aura window. For Android, this is a Activity.
23 // See CastContentWindowLinux and CastContentWindowAndroid.
24 class CastContentWindow {
28 public: 25 public:
29 CastContentWindow(); 26 class Delegate {
27 public:
28 virtual void OnWindowDestroyed() = 0;
29 virtual void OnKeyDown(ui::KeyboardCode keycode) = 0;
byungchul 2016/12/16 22:52:22 Need a protected dtor.
derekjchow1 2016/12/17 00:13:07 Done.
30 };
30 31
31 // Removes the window from the screen. 32 // Creates the platform specific CastContentWindow.
32 ~CastContentWindow() override; 33 static std::unique_ptr<CastContentWindow> Create(
34 CastContentWindow::Delegate* delegate);
35
36 virtual ~CastContentWindow() {}
33 37
34 // Sets the window's background to be transparent (call before 38 // Sets the window's background to be transparent (call before
35 // CreateWindowTree). 39 // CreateWindowTree).
36 void SetTransparent() { transparent_ = true; } 40 virtual void SetTransparent() = 0;
37 41
38 // Create a full-screen window for |web_contents|. 42 // Creates a full-screen window for |web_contents| and display it.
39 void CreateWindowTree(content::WebContents* web_contents); 43 virtual void ShowWebContents(content::WebContents* web_contents) = 0;
40 44
41 std::unique_ptr<content::WebContents> CreateWebContents( 45 // Creates a WebContents.
42 content::BrowserContext* browser_context); 46 // TODO(derekjchow): remove this function from this class, since it doesn't
43 47 // have anything to do with displaying web_contents.
44 // content::WebContentsObserver implementation: 48 virtual std::unique_ptr<content::WebContents> CreateWebContents(
45 void DidFirstVisuallyNonEmptyPaint() override; 49 content::BrowserContext* browser_context) = 0;
46 void MediaStartedPlaying(const MediaPlayerInfo& media_info,
47 const MediaPlayerId& id) override;
48 void MediaStoppedPlaying(const MediaPlayerInfo& media_info,
49 const MediaPlayerId& id) override;
50 void RenderViewCreated(content::RenderViewHost* render_view_host) override;
51
52 // CastVSyncSettings::Observer implementation:
53 void OnVSyncIntervalChanged(base::TimeDelta interval) override;
54
55 private:
56 #if defined(USE_AURA)
57 std::unique_ptr<aura::WindowTreeHost> window_tree_host_;
58 #endif
59 bool transparent_;
60
61 DISALLOW_COPY_AND_ASSIGN(CastContentWindow);
62 }; 50 };
63 51
64 } // namespace shell 52 } // namespace shell
65 } // namespace chromecast 53 } // namespace chromecast
66 54
67 #endif // CHROMECAST_BROWSER_CAST_CONTENT_WINDOW_H_ 55 #endif // CHROMECAST_BROWSER_CAST_CONTENT_WINDOW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698