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

Unified 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 side-by-side diff with in-line comments
Download patch
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..bce8b3e7cfcfe8b8168eff76ec19e258b2996a78 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/keycodes/keyboard_codes.h"
namespace content {
class BrowserContext;
@@ -23,42 +18,35 @@ 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();
+ class Delegate {
+ public:
+ virtual void OnWindowDestroyed() = 0;
+ 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.
+ };
- // Removes the window from the screen.
- ~CastContentWindow() override;
+ // Creates the platform specific CastContentWindow.
+ static std::unique_ptr<CastContentWindow> Create(
+ CastContentWindow::Delegate* delegate);
+
+ virtual ~CastContentWindow() {}
// Sets the window's background to be transparent (call before
// CreateWindowTree).
- void SetTransparent() { transparent_ = true; }
-
- // Create a full-screen window for |web_contents|.
- void CreateWindowTree(content::WebContents* web_contents);
-
- std::unique_ptr<content::WebContents> CreateWebContents(
- content::BrowserContext* browser_context);
-
- // 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;
-
- // CastVSyncSettings::Observer implementation:
- void OnVSyncIntervalChanged(base::TimeDelta interval) override;
+ 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.
+ 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

Powered by Google App Engine
This is Rietveld 408576698