| 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 namespace vr_shell { | 11 namespace vr_shell { |
| 12 | 12 |
| 13 class UiCommandHandler { | 13 class UiCommandHandler { |
| 14 public: | 14 public: |
| 15 virtual void SendCommandToUi(const base::Value& value) = 0; | 15 virtual void SendCommandToUi(const base::Value& value) = 0; |
| 16 }; | 16 }; |
| 17 | 17 |
| 18 // This class manages the communication of browser state from VR shell to the | 18 // This class manages the communication of browser state from VR shell to the |
| 19 // HTML UI. State information is asynchronous and unidirectional. | 19 // HTML UI. State information is asynchronous and unidirectional. |
| 20 class UiInterface { | 20 class UiInterface { |
| 21 public: | 21 public: |
| 22 enum Mode { | 22 enum Mode { |
| 23 STANDARD, | 23 STANDARD, |
| 24 WEB_VR, | 24 WEB_VR, |
| 25 MENU, |
| 25 }; | 26 }; |
| 26 | 27 |
| 27 UiInterface(); | 28 UiInterface(); |
| 28 virtual ~UiInterface(); | 29 virtual ~UiInterface(); |
| 29 | 30 |
| 30 void SetMode(Mode mode); | 31 void SetMode(Mode mode); |
| 32 Mode GetMode() { return mode_; } |
| 31 void SetSecureOrigin(bool secure); | 33 void SetSecureOrigin(bool secure); |
| 32 | 34 |
| 33 // Called by WebUI when starting VR. | 35 // Called by WebUI when starting VR. |
| 34 void OnDomContentsLoaded(); | 36 void OnDomContentsLoaded(); |
| 35 void SetUiCommandHandler(UiCommandHandler* handler); | 37 void SetUiCommandHandler(UiCommandHandler* handler); |
| 36 | 38 |
| 37 private: | 39 private: |
| 38 void FlushUpdates(); | 40 void FlushUpdates(); |
| 39 | 41 |
| 42 Mode mode_; |
| 40 UiCommandHandler* handler_; | 43 UiCommandHandler* handler_; |
| 41 bool loaded_ = false; | 44 bool loaded_ = false; |
| 42 base::DictionaryValue updates_; | 45 base::DictionaryValue updates_; |
| 43 | 46 |
| 44 DISALLOW_COPY_AND_ASSIGN(UiInterface); | 47 DISALLOW_COPY_AND_ASSIGN(UiInterface); |
| 45 }; | 48 }; |
| 46 | 49 |
| 47 } // namespace vr_shell | 50 } // namespace vr_shell |
| 48 | 51 |
| 49 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_INTERFACE_H_ | 52 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_INTERFACE_H_ |
| OLD | NEW |