Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_UI_INTERFACE_H_ | |
| 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_UI_INTERFACE_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/memory/weak_ptr.h" | |
| 10 #include "base/values.h" | |
| 11 | |
| 12 class VrShellUIMessageHandler; | |
| 13 | |
| 14 namespace vr_shell { | |
| 15 | |
| 16 // This class manages the communication of browser state from VR shell to the | |
| 17 // HTML UI. State information is asynchronous and unidirectional. | |
| 18 class UiInterface { | |
| 19 public: | |
| 20 enum Mode { | |
| 21 STANDARD, | |
| 22 WEB_VR, | |
| 23 }; | |
| 24 | |
| 25 UiInterface(); | |
| 26 virtual ~UiInterface(); | |
| 27 | |
| 28 void SetMode(Mode mode); | |
| 29 void SetSecureOrigin(bool secure); | |
| 30 | |
| 31 // Called by WebUI when starting VR. | |
| 32 void OnDomContentsLoaded(); | |
| 33 void SetUiMessageHandler( | |
| 34 base::WeakPtr<VrShellUIMessageHandler> handler); | |
| 35 | |
| 36 private: | |
| 37 void FlushUpdates(); | |
| 38 | |
| 39 base::WeakPtr<VrShellUIMessageHandler> handler_; | |
|
bshe
2016/10/19 21:02:40
do you need a weakptr here? My guess is that this
cjgrant
2016/10/20 15:25:39
Done. Good call on use of the handler destructor.
| |
| 40 base::DictionaryValue updates_; | |
|
bshe
2016/10/19 21:02:40
nit: looks like this is the global states. Perhaps
cjgrant
2016/10/20 15:25:39
As discussed, the dictionary isn't maintaining sta
| |
| 41 bool loaded_ = false; | |
| 42 | |
| 43 DISALLOW_COPY_AND_ASSIGN(UiInterface); | |
| 44 }; | |
| 45 | |
| 46 } // namespace vr_shell | |
| 47 | |
| 48 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_INTERFACE_H_ | |
| OLD | NEW |