| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 CHROME_BROWSER_ANDROID_VR_SHELL_UI_INTERFACE_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_UI_INTERFACE_H_ |
| 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_UI_INTERFACE_H_ | 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_UI_INTERFACE_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 | 10 |
| 11 class GURL; | 11 class GURL; |
| 12 | 12 |
| 13 namespace vr_shell { | 13 namespace vr_shell { |
| 14 | 14 |
| 15 class UiCommandHandler { | 15 class UiCommandHandler { |
| 16 public: | 16 public: |
| 17 virtual void SendCommandToUi(const base::Value& value) = 0; | 17 virtual void SendCommandToUi(const base::Value& value) = 0; |
| 18 }; | 18 }; |
| 19 | 19 |
| 20 // This class manages the communication of browser state from VR shell to the | 20 // This class manages the communication of browser state from VR shell to the |
| 21 // HTML UI. State information is asynchronous and unidirectional. | 21 // HTML UI. State information is asynchronous and unidirectional. |
| 22 class UiInterface { | 22 class UiInterface { |
| 23 public: | 23 public: |
| 24 enum Mode { | 24 enum Mode { |
| 25 STANDARD, | 25 STANDARD, |
| 26 WEB_VR | 26 WEB_VR |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 explicit UiInterface(Mode initial_mode); | 29 explicit UiInterface(Mode initial_mode, bool fullscreen); |
| 30 virtual ~UiInterface(); | 30 virtual ~UiInterface(); |
| 31 | 31 |
| 32 void SetMode(Mode mode); | 32 void SetMode(Mode mode); |
| 33 Mode GetMode() { return mode_; } | 33 Mode GetMode() { return mode_; } |
| 34 void SetMenuMode(bool enabled); | 34 void SetMenuMode(bool enabled); |
| 35 bool GetMenuMode() { return menu_mode_; } | 35 bool GetMenuMode() { return menu_mode_; } |
| 36 void SetCinemaMode(bool enabled); | 36 void SetFullscreen(bool enabled); |
| 37 bool GetCinemaMode() { return cinema_mode_; } | 37 bool GetFullscreen() { return fullscreen_; } |
| 38 | 38 void SetSecurityLevel(int level); |
| 39 void SetSecureOrigin(bool secure); | 39 void SetWebVRSecureOrigin(bool secure); |
| 40 void SetLoading(bool loading); | 40 void SetLoading(bool loading); |
| 41 void SetURL(const GURL& url); | 41 void SetURL(const GURL& url); |
| 42 | 42 |
| 43 // Called by WebUI when starting VR. | 43 // Called by WebUI when starting VR. |
| 44 void OnDomContentsLoaded(); | 44 void OnDomContentsLoaded(); |
| 45 void SetUiCommandHandler(UiCommandHandler* handler); | 45 void SetUiCommandHandler(UiCommandHandler* handler); |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 void FlushUpdates(); | 48 void FlushUpdates(); |
| 49 void FlushModeState(); | 49 void FlushModeState(); |
| 50 | 50 |
| 51 Mode mode_; | 51 Mode mode_; |
| 52 bool menu_mode_ = false; | 52 bool menu_mode_ = false; |
| 53 bool cinema_mode_ = false; | 53 bool fullscreen_ = false; |
| 54 UiCommandHandler* handler_; | 54 UiCommandHandler* handler_; |
| 55 bool loaded_ = false; | 55 bool loaded_ = false; |
| 56 base::DictionaryValue updates_; | 56 base::DictionaryValue updates_; |
| 57 | 57 |
| 58 DISALLOW_COPY_AND_ASSIGN(UiInterface); | 58 DISALLOW_COPY_AND_ASSIGN(UiInterface); |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 } // namespace vr_shell | 61 } // namespace vr_shell |
| 62 | 62 |
| 63 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_INTERFACE_H_ | 63 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_INTERFACE_H_ |
| OLD | NEW |