| 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 "ui/events/event.h" | 11 #include "ui/events/event.h" |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 class BrowserContext; | 14 class BrowserContext; |
| 15 class WebContents; | 15 class WebContents; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace chromecast { | 18 namespace chromecast { |
| 19 class CastWindowManager; |
| 20 |
| 19 namespace shell { | 21 namespace shell { |
| 20 | 22 |
| 21 // Class that represents the "window" a WebContents is displayed in cast_shell. | 23 // Class that represents the "window" a WebContents is displayed in cast_shell. |
| 22 // For Linux, this represents an Aura window. For Android, this is a Activity. | 24 // For Linux, this represents an Aura window. For Android, this is a Activity. |
| 23 // See CastContentWindowLinux and CastContentWindowAndroid. | 25 // See CastContentWindowLinux and CastContentWindowAndroid. |
| 24 class CastContentWindow { | 26 class CastContentWindow { |
| 25 public: | 27 public: |
| 26 class Delegate { | 28 class Delegate { |
| 27 public: | 29 public: |
| 28 virtual void OnWindowDestroyed() = 0; | 30 virtual void OnWindowDestroyed() = 0; |
| 29 virtual void OnKeyEvent(const ui::KeyEvent& key_event) = 0; | 31 virtual void OnKeyEvent(const ui::KeyEvent& key_event) = 0; |
| 30 | 32 |
| 31 protected: | 33 protected: |
| 32 virtual ~Delegate() {} | 34 virtual ~Delegate() {} |
| 33 }; | 35 }; |
| 34 | 36 |
| 35 // Creates the platform specific CastContentWindow. |delegate| should outlive | 37 // Creates the platform specific CastContentWindow. |delegate| should outlive |
| 36 // the created CastContentWindow. | 38 // the created CastContentWindow. |
| 37 static std::unique_ptr<CastContentWindow> Create( | 39 static std::unique_ptr<CastContentWindow> Create( |
| 38 CastContentWindow::Delegate* delegate); | 40 CastContentWindow::Delegate* delegate); |
| 39 | 41 |
| 40 virtual ~CastContentWindow() {} | 42 virtual ~CastContentWindow() {} |
| 41 | 43 |
| 42 // Sets the window's background to be transparent (call before | 44 // Sets the window's background to be transparent (call before |
| 43 // CreateWindowTree). | 45 // CreateWindowTree). |
| 44 virtual void SetTransparent() = 0; | 46 virtual void SetTransparent() = 0; |
| 45 | 47 |
| 46 // Creates a full-screen window for |web_contents| and display it. | 48 // Creates a full-screen window for |web_contents| and display it. |
| 47 // |web_contents| should outlive this CastContentWindow. | 49 // |web_contents| should outlive this CastContentWindow. |
| 48 virtual void ShowWebContents(content::WebContents* web_contents) = 0; | 50 virtual void ShowWebContents(content::WebContents* web_contents, |
| 51 CastWindowManager* window_manager) = 0; |
| 49 | 52 |
| 50 // Creates a WebContents. | 53 // Creates a WebContents. |
| 51 // TODO(derekjchow): remove this function from this class, since it doesn't | 54 // TODO(derekjchow): remove this function from this class, since it doesn't |
| 52 // have anything to do with displaying web_contents. | 55 // have anything to do with displaying web_contents. |
| 53 virtual std::unique_ptr<content::WebContents> CreateWebContents( | 56 virtual std::unique_ptr<content::WebContents> CreateWebContents( |
| 54 content::BrowserContext* browser_context) = 0; | 57 content::BrowserContext* browser_context) = 0; |
| 55 }; | 58 }; |
| 56 | 59 |
| 57 } // namespace shell | 60 } // namespace shell |
| 58 } // namespace chromecast | 61 } // namespace chromecast |
| 59 | 62 |
| 60 #endif // CHROMECAST_BROWSER_CAST_CONTENT_WINDOW_H_ | 63 #endif // CHROMECAST_BROWSER_CAST_CONTENT_WINDOW_H_ |
| OLD | NEW |