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

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: Impelement a means of letting native VR Shell control the HTML UI. 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 "base/macros.h"
8 #include "base/memory/weak_ptr.h"
bshe 2016/10/19 21:02:40 nit: remove the above two header as you included i
cjgrant 2016/10/20 15:25:39 Done.
9 #include "chrome/browser/ui/webui/vr_shell/vr_shell_ui_message_handler.h"
10
11 namespace vr_shell {
12
13 UiInterface::UiInterface() {
14 SetMode(Mode::STANDARD);
15 }
16
17 UiInterface::~UiInterface() {}
18
19 void UiInterface::SetUiMessageHandler(
20 base::WeakPtr<VrShellUIMessageHandler> handler) {
21 handler_ = handler;
22 }
23
24 void UiInterface::SetMode(Mode mode) {
25 updates_.SetInteger("mode", static_cast<int>(mode));
mthiesse 2016/10/19 18:04:10 Maybe store the mode we're in locally, and only up
cjgrant 2016/10/20 15:25:38 Possibly, but at this point we shouldn't get a mod
26 FlushUpdates();
27 }
28
29 void UiInterface::SetSecureOrigin(bool secure) {
30 updates_.SetBoolean("secureOrigin", static_cast<int>(secure));
mthiesse 2016/10/19 18:04:10 Same comment here, you can store whether we're in
cjgrant 2016/10/20 15:25:39 See above.
31 FlushUpdates();
32 }
33
34 void UiInterface::OnDomContentsLoaded() {
35 loaded_ = true;
36 FlushUpdates();
37 }
38
39 void UiInterface::FlushUpdates() {
40 if (loaded_ && handler_) {
41 handler_->GetWebUi()->CallJavascriptFunctionUnsafe(
bshe 2016/10/19 21:02:40 Calling "CallJavascriptFunctionUnsafe" directly is
cjgrant 2016/10/20 14:32:40 As of now, VrShell gets calls to set the mode to W
cjgrant 2016/10/20 15:25:38 Done.
42 "chrome.vrShellUi.command", updates_);
43 }
44 }
45
46 } // namespace vr_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698