Chromium Code Reviews| OLD | NEW |
|---|---|
| 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; | |
|
Wez
2017/01/11 20:47:54
KeyboardCode is deprecated (though it seems we sti
derekjchow1
2017/01/11 21:54:33
SGTM. Done.
Unfortunately, this changes our new d
| |
| 30 | 30 |
| 31 // Removes the window from the screen. | 31 protected: |
| 32 ~CastContentWindow() override; | 32 virtual ~Delegate() {} |
| 33 }; | |
| 34 | |
| 35 // Creates the platform specific CastContentWindow. | |
| 36 static std::unique_ptr<CastContentWindow> Create( | |
| 37 CastContentWindow::Delegate* delegate); | |
|
Wez
2017/01/11 20:47:54
nit: Please be specific about the lifetime require
derekjchow1
2017/01/11 21:54:34
Added comment about |delegate| outliving CastConte
Wez
2017/01/12 21:04:28
Acknowledged.
| |
| 38 | |
| 39 virtual ~CastContentWindow() {} | |
| 33 | 40 |
| 34 // Sets the window's background to be transparent (call before | 41 // Sets the window's background to be transparent (call before |
| 35 // CreateWindowTree). | 42 // CreateWindowTree). |
| 36 void SetTransparent() { transparent_ = true; } | 43 virtual void SetTransparent() = 0; |
| 37 | 44 |
| 38 // Create a full-screen window for |web_contents|. | 45 // Creates a full-screen window for |web_contents| and display it. |
| 39 void CreateWindowTree(content::WebContents* web_contents); | 46 virtual void ShowWebContents(content::WebContents* web_contents) = 0; |
|
Wez
2017/01/11 20:47:54
Similarly, please clarify the lifetime guarantee o
derekjchow1
2017/01/11 21:54:34
Done.
| |
| 40 | 47 |
| 41 std::unique_ptr<content::WebContents> CreateWebContents( | 48 // Creates a WebContents. |
| 42 content::BrowserContext* browser_context); | 49 // TODO(derekjchow): remove this function from this class, since it doesn't |
| 43 | 50 // have anything to do with displaying web_contents. |
| 44 // content::WebContentsObserver implementation: | 51 virtual std::unique_ptr<content::WebContents> CreateWebContents( |
| 45 void DidFirstVisuallyNonEmptyPaint() override; | 52 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 }; | 53 }; |
| 63 | 54 |
| 64 } // namespace shell | 55 } // namespace shell |
| 65 } // namespace chromecast | 56 } // namespace chromecast |
| 66 | 57 |
| 67 #endif // CHROMECAST_BROWSER_CAST_CONTENT_WINDOW_H_ | 58 #endif // CHROMECAST_BROWSER_CAST_CONTENT_WINDOW_H_ |
| OLD | NEW |