| 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, |  | 
|  29   }; |  27   }; | 
|  30  |  28  | 
|  31   UiInterface(); |  29   explicit UiInterface(Mode initial_mode); | 
|  32   virtual ~UiInterface(); |  30   virtual ~UiInterface(); | 
|  33  |  31  | 
|  34   void SetMode(Mode mode); |  32   void SetMode(Mode mode); | 
|  35   Mode GetMode() { return mode_; } |  33   Mode GetMode() { return mode_; } | 
 |  34   void SetMenuMode(bool enabled); | 
 |  35   bool GetMenuMode() { return menu_mode_; } | 
 |  36   void SetCinemaMode(bool enabled); | 
 |  37   bool GetCinemaMode() { return cinema_mode_; } | 
 |  38  | 
|  36   void SetSecureOrigin(bool secure); |  39   void SetSecureOrigin(bool secure); | 
|  37   void SetLoading(bool loading); |  40   void SetLoading(bool loading); | 
|  38   void SetURL(const GURL& url); |  41   void SetURL(const GURL& url); | 
|  39  |  42  | 
|  40   // Called by WebUI when starting VR. |  43   // Called by WebUI when starting VR. | 
|  41   void OnDomContentsLoaded(); |  44   void OnDomContentsLoaded(); | 
|  42   void SetUiCommandHandler(UiCommandHandler* handler); |  45   void SetUiCommandHandler(UiCommandHandler* handler); | 
|  43  |  46  | 
|  44  private: |  47  private: | 
|  45   void FlushUpdates(); |  48   void FlushUpdates(); | 
 |  49   void FlushModeState(); | 
|  46  |  50  | 
|  47   Mode mode_; |  51   Mode mode_; | 
 |  52   bool menu_mode_ = false; | 
 |  53   bool cinema_mode_ = false; | 
|  48   UiCommandHandler* handler_; |  54   UiCommandHandler* handler_; | 
|  49   bool loaded_ = false; |  55   bool loaded_ = false; | 
|  50   base::DictionaryValue updates_; |  56   base::DictionaryValue updates_; | 
|  51  |  57  | 
|  52   DISALLOW_COPY_AND_ASSIGN(UiInterface); |  58   DISALLOW_COPY_AND_ASSIGN(UiInterface); | 
|  53 }; |  59 }; | 
|  54  |  60  | 
|  55 }  // namespace vr_shell |  61 }  // namespace vr_shell | 
|  56  |  62  | 
|  57 #endif  // CHROME_BROWSER_ANDROID_VR_SHELL_UI_INTERFACE_H_ |  63 #endif  // CHROME_BROWSER_ANDROID_VR_SHELL_UI_INTERFACE_H_ | 
| OLD | NEW |