Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(849)

Side by Side Diff: chrome/browser/android/vr_shell/ui_interface.cc

Issue 2471433002: Implement WebVR presentation pausing for VR Shell Menu Mode (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "chrome/browser/android/vr_shell/ui_interface.h" 5 #include "chrome/browser/android/vr_shell/ui_interface.h"
6 6
7 #include "chrome/browser/ui/webui/vr_shell/vr_shell_ui_message_handler.h" 7 #include "chrome/browser/ui/webui/vr_shell/vr_shell_ui_message_handler.h"
8 8
9 namespace vr_shell { 9 namespace vr_shell {
10 10
11 UiInterface::UiInterface() { 11 UiInterface::UiInterface() {
12 SetMode(Mode::STANDARD); 12 SetMode(Mode::STANDARD);
13 } 13 }
14 14
15 UiInterface::~UiInterface() {} 15 UiInterface::~UiInterface() {}
16 16
17 void UiInterface::SetUiCommandHandler(UiCommandHandler* handler) { 17 void UiInterface::SetUiCommandHandler(UiCommandHandler* handler) {
18 handler_ = handler; 18 handler_ = handler;
19 } 19 }
20 20
21 void UiInterface::SetMode(Mode mode) { 21 void UiInterface::SetMode(Mode mode) {
22 mode_ = mode;
22 updates_.SetInteger("mode", static_cast<int>(mode)); 23 updates_.SetInteger("mode", static_cast<int>(mode));
23 FlushUpdates(); 24 FlushUpdates();
24 } 25 }
25 26
26 void UiInterface::SetSecureOrigin(bool secure) { 27 void UiInterface::SetSecureOrigin(bool secure) {
27 updates_.SetBoolean("secureOrigin", secure); 28 updates_.SetBoolean("secureOrigin", secure);
28 FlushUpdates(); 29 FlushUpdates();
29 } 30 }
30 31
31 void UiInterface::OnDomContentsLoaded() { 32 void UiInterface::OnDomContentsLoaded() {
32 loaded_ = true; 33 loaded_ = true;
33 #if defined(ENABLE_VR_SHELL_UI_DEV) 34 #if defined(ENABLE_VR_SHELL_UI_DEV)
34 updates_.SetBoolean("enableReloadUi", true); 35 updates_.SetBoolean("enableReloadUi", true);
35 #endif 36 #endif
36 FlushUpdates(); 37 FlushUpdates();
37 } 38 }
38 39
39 void UiInterface::FlushUpdates() { 40 void UiInterface::FlushUpdates() {
40 if (loaded_ && handler_) { 41 if (loaded_ && handler_) {
41 handler_->SendCommandToUi(updates_); 42 handler_->SendCommandToUi(updates_);
42 updates_.Clear(); 43 updates_.Clear();
43 } 44 }
44 } 45 }
45 46
46 } // namespace vr_shell 47 } // namespace vr_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698