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 VrShellUIMessageHandler; | 11 namespace vr_shell { |
12 | 12 |
13 namespace vr_shell { | 13 class UiCommandHandler { |
bshe
2016/10/20 22:26:03
nit: perhaps add delegate to name since this is es
cjgrant
2016/10/21 13:44:39
Hmmm, I see this as an interface rather than deleg
| |
14 public: | |
15 virtual void SendCommandToUi(const base::Value& value) = 0; | |
16 }; | |
14 | 17 |
15 // 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 |
16 // HTML UI. State information is asynchronous and unidirectional. | 19 // HTML UI. State information is asynchronous and unidirectional. |
17 class UiInterface { | 20 class UiInterface { |
18 public: | 21 public: |
19 enum Mode { | 22 enum Mode { |
20 STANDARD, | 23 STANDARD, |
21 WEB_VR, | 24 WEB_VR, |
22 }; | 25 }; |
23 | 26 |
24 UiInterface(); | 27 UiInterface(); |
25 virtual ~UiInterface(); | 28 virtual ~UiInterface(); |
26 | 29 |
27 void SetMode(Mode mode); | 30 void SetMode(Mode mode); |
28 void SetSecureOrigin(bool secure); | 31 void SetSecureOrigin(bool secure); |
29 | 32 |
30 // Called by WebUI when starting VR. | 33 // Called by WebUI when starting VR. |
31 void OnDomContentsLoaded(); | 34 void OnDomContentsLoaded(); |
32 void SetUiMessageHandler(VrShellUIMessageHandler* handler); | 35 void SetUiCommandHandler(UiCommandHandler* handler); |
33 | 36 |
34 private: | 37 private: |
35 void FlushUpdates(); | 38 void FlushUpdates(); |
36 | 39 |
37 VrShellUIMessageHandler* handler_; | 40 UiCommandHandler* handler_; |
38 bool loaded_ = false; | 41 bool loaded_ = false; |
39 base::DictionaryValue updates_; | 42 base::DictionaryValue updates_; |
40 | 43 |
41 DISALLOW_COPY_AND_ASSIGN(UiInterface); | 44 DISALLOW_COPY_AND_ASSIGN(UiInterface); |
42 }; | 45 }; |
43 | 46 |
44 } // namespace vr_shell | 47 } // namespace vr_shell |
45 | 48 |
46 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_INTERFACE_H_ | 49 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_INTERFACE_H_ |
OLD | NEW |