Chromium Code Reviews| 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 MENU, | |
| 28 CINEMA, | 27 CINEMA, | 
| 28 STANDARD_MENU, | |
| 
 
bshe
2016/11/28 22:15:07
nit: can you add comments about the two new enum?
 
mthiesse
2016/11/28 23:28:34
Acknowledged.
 
 | |
| 29 WEB_VR_MENU, | |
| 29 }; | 30 }; | 
| 30 | 31 | 
| 31 UiInterface(); | 32 explicit UiInterface(Mode initial_mode); | 
| 32 virtual ~UiInterface(); | 33 virtual ~UiInterface(); | 
| 33 | 34 | 
| 34 void SetMode(Mode mode); | 35 void SetMode(Mode mode); | 
| 35 Mode GetMode() { return mode_; } | 36 Mode GetMode() { return mode_; } | 
| 36 void SetSecureOrigin(bool secure); | 37 void SetSecureOrigin(bool secure); | 
| 37 void SetLoading(bool loading); | 38 void SetLoading(bool loading); | 
| 38 void SetURL(const GURL& url); | 39 void SetURL(const GURL& url); | 
| 39 | 40 | 
| 40 // Called by WebUI when starting VR. | 41 // Called by WebUI when starting VR. | 
| 41 void OnDomContentsLoaded(); | 42 void OnDomContentsLoaded(); | 
| 42 void SetUiCommandHandler(UiCommandHandler* handler); | 43 void SetUiCommandHandler(UiCommandHandler* handler); | 
| 43 | 44 | 
| 44 private: | 45 private: | 
| 45 void FlushUpdates(); | 46 void FlushUpdates(); | 
| 46 | 47 | 
| 47 Mode mode_; | 48 Mode mode_; | 
| 48 UiCommandHandler* handler_; | 49 UiCommandHandler* handler_; | 
| 49 bool loaded_ = false; | 50 bool loaded_ = false; | 
| 50 base::DictionaryValue updates_; | 51 base::DictionaryValue updates_; | 
| 51 | 52 | 
| 52 DISALLOW_COPY_AND_ASSIGN(UiInterface); | 53 DISALLOW_COPY_AND_ASSIGN(UiInterface); | 
| 53 }; | 54 }; | 
| 54 | 55 | 
| 55 } // namespace vr_shell | 56 } // namespace vr_shell | 
| 56 | 57 | 
| 57 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_INTERFACE_H_ | 58 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_INTERFACE_H_ | 
| OLD | NEW |