| 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 VrOmnibox; |
| 16 |
| 15 class UiCommandHandler { | 17 class UiCommandHandler { |
| 16 public: | 18 public: |
| 17 virtual void SendCommandToUi(const base::Value& value) = 0; | 19 virtual void SendCommandToUi(const base::Value& value) = 0; |
| 18 }; | 20 }; |
| 19 | 21 |
| 20 // This class manages the communication of browser state from VR shell to the | 22 // This class manages the communication of browser state from VR shell to the |
| 21 // HTML UI. State information is asynchronous and unidirectional. | 23 // HTML UI. State information is asynchronous and unidirectional. |
| 22 class UiInterface { | 24 class UiInterface { |
| 23 public: | 25 public: |
| 24 enum Mode { | 26 enum Mode { |
| 25 STANDARD, | 27 STANDARD, |
| 26 WEB_VR | 28 WEB_VR |
| 27 }; | 29 }; |
| 28 | 30 |
| 29 explicit UiInterface(Mode initial_mode, bool fullscreen); | 31 explicit UiInterface(Mode initial_mode, bool fullscreen); |
| 30 virtual ~UiInterface(); | 32 virtual ~UiInterface(); |
| 31 | 33 |
| 32 void SetMode(Mode mode); | 34 void SetMode(Mode mode); |
| 33 Mode GetMode() { return mode_; } | 35 Mode GetMode() { return mode_; } |
| 34 void SetMenuMode(bool enabled); | 36 void SetMenuMode(bool enabled); |
| 35 bool GetMenuMode() { return menu_mode_; } | 37 bool GetMenuMode() { return menu_mode_; } |
| 36 void SetFullscreen(bool enabled); | 38 void SetFullscreen(bool enabled); |
| 37 bool GetFullscreen() { return fullscreen_; } | 39 bool GetFullscreen() { return fullscreen_; } |
| 38 void SetSecurityLevel(int level); | 40 void SetSecurityLevel(int level); |
| 39 void SetWebVRSecureOrigin(bool secure); | 41 void SetWebVRSecureOrigin(bool secure); |
| 40 void SetLoading(bool loading); | 42 void SetLoading(bool loading); |
| 41 void SetLoadProgress(double progress); | 43 void SetLoadProgress(double progress); |
| 42 void SetURL(const GURL& url); | 44 void SetURL(const GURL& url); |
| 43 | 45 |
| 46 // Omnibox input and output handling. |
| 47 void HandleOmniboxInput(const base::DictionaryValue& input); |
| 48 void SetOmniboxSuggestions(std::unique_ptr<base::Value> suggestions); |
| 49 |
| 44 // Called by WebUI when starting VR. | 50 // Called by WebUI when starting VR. |
| 45 void OnDomContentsLoaded(); | 51 void OnDomContentsLoaded(); |
| 46 void SetUiCommandHandler(UiCommandHandler* handler); | 52 void SetUiCommandHandler(UiCommandHandler* handler); |
| 47 | 53 |
| 48 private: | 54 private: |
| 49 void FlushUpdates(); | 55 void FlushUpdates(); |
| 50 void FlushModeState(); | 56 void FlushModeState(); |
| 51 | 57 |
| 52 Mode mode_; | 58 Mode mode_; |
| 53 bool menu_mode_ = false; | 59 bool menu_mode_ = false; |
| 54 bool fullscreen_ = false; | 60 bool fullscreen_ = false; |
| 55 UiCommandHandler* handler_; | 61 UiCommandHandler* handler_; |
| 56 bool loaded_ = false; | 62 bool loaded_ = false; |
| 57 base::DictionaryValue updates_; | 63 base::DictionaryValue updates_; |
| 58 | 64 |
| 65 std::unique_ptr<VrOmnibox> omnibox_; |
| 66 |
| 59 DISALLOW_COPY_AND_ASSIGN(UiInterface); | 67 DISALLOW_COPY_AND_ASSIGN(UiInterface); |
| 60 }; | 68 }; |
| 61 | 69 |
| 62 } // namespace vr_shell | 70 } // namespace vr_shell |
| 63 | 71 |
| 64 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_INTERFACE_H_ | 72 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_INTERFACE_H_ |
| OLD | NEW |