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

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

Issue 2434013002: Implement a means of letting native VR Shell control the HTML UI. (Closed)
Patch Set: Remove use of cr.define() Created 4 years, 2 months 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
(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 #include "chrome/browser/android/vr_shell/ui_interface.h"
6
7 #include "chrome/browser/ui/webui/vr_shell/vr_shell_ui_message_handler.h"
8
9 namespace vr_shell {
10
11 UiInterface::UiInterface() {
12 SetMode(Mode::STANDARD);
13 }
14
15 UiInterface::~UiInterface() {}
16
17 void UiInterface::SetUiMessageHandler(VrShellUIMessageHandler* handler) {
18 handler_ = handler;
19 }
20
21 void UiInterface::SetMode(Mode mode) {
22 updates_.SetInteger("mode", static_cast<int>(mode));
23 FlushUpdates();
24 }
25
26 void UiInterface::SetSecureOrigin(bool secure) {
27 updates_.SetBoolean("secureOrigin", static_cast<int>(secure));
28 FlushUpdates();
29 }
30
31 void UiInterface::OnDomContentsLoaded() {
32 loaded_ = true;
33 FlushUpdates();
34 }
35
36 void UiInterface::FlushUpdates() {
37 if (loaded_ && handler_) {
38 handler_->SendCommandToUi(updates_);
39 updates_.Clear();
40 }
41 }
42
43 } // namespace vr_shell
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/ui_interface.h ('k') | chrome/browser/android/vr_shell/vr_shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698