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 <memory> | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/macros.h" | |
| 12 #include "base/values.h" | |
| 13 | |
| 14 class GURL; | 8 class GURL; |
| 15 | 9 |
| 16 namespace vr_shell { | 10 namespace vr_shell { |
| 17 | 11 |
| 18 // This class manages the communication of browser state from VR shell to the | 12 // This class manages the communication of browser state from VR shell to the |
| 19 // HTML UI. State information is asynchronous and unidirectional. | 13 // HTML UI. State information is asynchronous and unidirectional. |
| 20 class UiInterface { | 14 class UiInterface { |
| 21 public: | 15 public: |
| 22 enum Mode { | |
| 23 STANDARD = 0, | |
| 24 WEB_VR, | |
| 25 }; | |
| 26 | |
| 27 enum Direction { | 16 enum Direction { |
| 28 NONE = 0, | 17 NONE = 0, |
| 29 LEFT, | 18 LEFT, |
| 30 RIGHT, | 19 RIGHT, |
| 31 UP, | 20 UP, |
| 32 DOWN, | 21 DOWN, |
| 33 }; | 22 }; |
| 34 | 23 |
| 35 explicit UiInterface(Mode initial_mode); | 24 virtual ~UiInterface() {} |
| 36 virtual ~UiInterface() = default; | |
| 37 | 25 |
| 38 // Set HTML UI state or pass events. | 26 virtual void SetWebVr(bool enabled) = 0; |
|
mthiesse
2017/05/08 16:04:55
nit: enabled is a strange name for this...
cjgrant
2017/05/08 19:17:22
Done. I renamed this to SetWebVrMode, to match el
| |
| 39 void SetMode(Mode mode); | 27 virtual void SetURL(const GURL& url); |
| 40 void SetFullscreen(bool enabled); | 28 virtual void SetFullscreen(bool enabled); |
| 41 void SetSecurityLevel(int level); | 29 virtual void SetSecurityLevel(int level); |
| 42 void SetWebVRSecureOrigin(bool secure); | 30 virtual void SetWebVRSecureOrigin(bool secure); |
| 43 void SetLoading(bool loading); | 31 virtual void SetLoading(bool loading); |
| 44 void SetLoadProgress(double progress); | 32 virtual void SetLoadProgress(double progress); |
| 45 void InitTabList(); | 33 virtual void SetHistoryButtonsEnabled(bool can_go_back, bool can_go_forward); |
| 46 void AppendToTabList(bool incognito, int id, const base::string16& title); | |
| 47 void FlushTabList(); | |
| 48 void UpdateTab(bool incognito, int id, const std::string& title); | |
| 49 void RemoveTab(bool incognito, int id); | |
| 50 void SetURL(const GURL& url); | |
| 51 void HandleAppButtonGesturePerformed(Direction direction); | |
| 52 void SetHistoryButtonsEnabled(bool can_go_back, bool can_go_forward); | |
| 53 | 34 |
| 54 private: | 35 // Tab handling. |
| 55 Mode mode_; | 36 virtual void InitTabList() {} |
| 56 bool fullscreen_ = false; | 37 virtual void AppendToTabList(bool incognito, |
| 57 | 38 int id, |
| 58 DISALLOW_COPY_AND_ASSIGN(UiInterface); | 39 const base::string16& title) {} |
| 40 virtual void FlushTabList() {} | |
| 41 virtual void UpdateTab(bool incognito, int id, const std::string& title) {} | |
| 42 virtual void RemoveTab(bool incognito, int id) {} | |
| 59 }; | 43 }; |
| 60 | 44 |
| 61 } // namespace vr_shell | 45 } // namespace vr_shell |
| 62 | 46 |
| 63 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_INTERFACE_H_ | 47 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_INTERFACE_H_ |
| OLD | NEW |