Index: chromecast/browser/cast_content_window.h |
diff --git a/chromecast/browser/cast_content_window.h b/chromecast/browser/cast_content_window.h |
index aeeeab94f021cb51ab83195e41442e277ebb16e0..929f2a7e29d7466df2387e0d103b5b5bf7fd9f91 100644 |
--- a/chromecast/browser/cast_content_window.h |
+++ b/chromecast/browser/cast_content_window.h |
@@ -8,12 +8,7 @@ |
#include <memory> |
#include "base/macros.h" |
-#include "chromecast/graphics/cast_vsync_settings.h" |
-#include "content/public/browser/web_contents_observer.h" |
- |
-namespace aura { |
-class WindowTreeHost; |
-} |
+#include "ui/events/event.h" |
namespace content { |
class BrowserContext; |
@@ -23,42 +18,40 @@ class WebContents; |
namespace chromecast { |
namespace shell { |
-class CastContentWindow : public content::WebContentsObserver, |
- public CastVSyncSettings::Observer { |
+// Class that represents the "window" a WebContents is displayed in cast_shell. |
+// For Linux, this represents an Aura window. For Android, this is a Activity. |
+// See CastContentWindowLinux and CastContentWindowAndroid. |
+class CastContentWindow { |
public: |
- CastContentWindow(); |
- |
- // Removes the window from the screen. |
- ~CastContentWindow() override; |
- |
- // Sets the window's background to be transparent (call before |
- // CreateWindowTree). |
- void SetTransparent() { transparent_ = true; } |
+ class Delegate { |
+ public: |
+ virtual void OnWindowDestroyed() = 0; |
+ virtual void OnKeyEvent(const ui::KeyEvent& key_event) = 0; |
- // Create a full-screen window for |web_contents|. |
- void CreateWindowTree(content::WebContents* web_contents); |
+ protected: |
+ virtual ~Delegate() {} |
+ }; |
- std::unique_ptr<content::WebContents> CreateWebContents( |
- content::BrowserContext* browser_context); |
+ // Creates the platform specific CastContentWindow. |delegate| should outlive |
+ // the created CastContentWindow. |
+ static std::unique_ptr<CastContentWindow> Create( |
+ CastContentWindow::Delegate* delegate); |
- // content::WebContentsObserver implementation: |
- void DidFirstVisuallyNonEmptyPaint() override; |
- void MediaStartedPlaying(const MediaPlayerInfo& media_info, |
- const MediaPlayerId& id) override; |
- void MediaStoppedPlaying(const MediaPlayerInfo& media_info, |
- const MediaPlayerId& id) override; |
- void RenderViewCreated(content::RenderViewHost* render_view_host) override; |
+ virtual ~CastContentWindow() {} |
- // CastVSyncSettings::Observer implementation: |
- void OnVSyncIntervalChanged(base::TimeDelta interval) override; |
+ // Sets the window's background to be transparent (call before |
+ // CreateWindowTree). |
+ virtual void SetTransparent() = 0; |
- private: |
-#if defined(USE_AURA) |
- std::unique_ptr<aura::WindowTreeHost> window_tree_host_; |
-#endif |
- bool transparent_; |
+ // Creates a full-screen window for |web_contents| and display it. |
+ // |web_contents| should outlive this CastContentWindow. |
+ virtual void ShowWebContents(content::WebContents* web_contents) = 0; |
- DISALLOW_COPY_AND_ASSIGN(CastContentWindow); |
+ // Creates a WebContents. |
+ // TODO(derekjchow): remove this function from this class, since it doesn't |
+ // have anything to do with displaying web_contents. |
+ virtual std::unique_ptr<content::WebContents> CreateWebContents( |
+ content::BrowserContext* browser_context) = 0; |
}; |
} // namespace shell |