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