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

Unified Diff: chromecast/browser/cast_content_window.h

Issue 2570623003: [Chromecast] Turn CastContentWindow into an abstract interface. (Closed)
Patch Set: Fix browser test Created 3 years, 11 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromecast/browser/android/jni_registrar.cc ('k') | chromecast/browser/cast_content_window.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « chromecast/browser/android/jni_registrar.cc ('k') | chromecast/browser/cast_content_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698