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

Side by Side Diff: chrome/browser/ui/webui/vr_shell/vr_shell_ui_message_handler.cc

Issue 2453943002: Exit VR Shell on pause (And fix a bunch of minor bugs). (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
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell_delegate.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/ui/webui/vr_shell/vr_shell_ui_message_handler.h" 5 #include "chrome/browser/ui/webui/vr_shell/vr_shell_ui_message_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 24 matching lines...) Expand all
35 web_ui()->RegisterMessageCallback( 35 web_ui()->RegisterMessageCallback(
36 "doAction", base::Bind(&VrShellUIMessageHandler::HandleDoAction, 36 "doAction", base::Bind(&VrShellUIMessageHandler::HandleDoAction,
37 base::Unretained(this))); 37 base::Unretained(this)));
38 } 38 }
39 39
40 void VrShellUIMessageHandler::HandleDomLoaded(const base::ListValue* args) { 40 void VrShellUIMessageHandler::HandleDomLoaded(const base::ListValue* args) {
41 AllowJavascript(); 41 AllowJavascript();
42 } 42 }
43 43
44 void VrShellUIMessageHandler::OnJavascriptAllowed() { 44 void VrShellUIMessageHandler::OnJavascriptAllowed() {
45 CHECK(vr_shell_); 45 if (!vr_shell_)
cjgrant 2016/10/27 14:33:17 Why proceed here with no UI?
mthiesse 2016/10/27 14:37:03 This can only happen if vr shell either died, or d
bshe 2016/10/27 14:37:11 I have logged a bug about this here: https://bugs.
mthiesse 2016/10/27 14:45:55 Added comment and added bug# to CL.
46 return;
46 vr_shell_->GetUiInterface()->SetUiCommandHandler(this); 47 vr_shell_->GetUiInterface()->SetUiCommandHandler(this);
47 vr_shell_->OnDomContentsLoaded(); 48 vr_shell_->OnDomContentsLoaded();
48 } 49 }
49 50
50 void VrShellUIMessageHandler::HandleUpdateScene(const base::ListValue* args) { 51 void VrShellUIMessageHandler::HandleUpdateScene(const base::ListValue* args) {
51 if (!vr_shell_) 52 if (!vr_shell_)
52 return; 53 return;
53 54
54 // Copy the update instructions and handle them on the render thread. 55 // Copy the update instructions and handle them on the render thread.
55 auto cb = base::Bind(&vr_shell::UiScene::HandleCommands, 56 auto cb = base::Bind(&vr_shell::UiScene::HandleCommands,
56 base::Unretained(vr_shell_->GetScene()), 57 base::Unretained(vr_shell_->GetScene()),
57 base::Owned(args->CreateDeepCopy().release()), 58 base::Owned(args->CreateDeepCopy().release()),
58 vr_shell::UiScene::TimeInMicroseconds()); 59 vr_shell::UiScene::TimeInMicroseconds());
59 vr_shell_->QueueTask(cb); 60 vr_shell_->QueueTask(cb);
60 } 61 }
61 62
62 void VrShellUIMessageHandler::HandleDoAction(const base::ListValue* args) { 63 void VrShellUIMessageHandler::HandleDoAction(const base::ListValue* args) {
63 int action; 64 int action;
64 CHECK(args->GetInteger(0, &action)); 65 CHECK(args->GetInteger(0, &action));
65 if (vr_shell_) { 66 if (vr_shell_) {
66 vr_shell_->DoUiAction((vr_shell::UiAction) action); 67 vr_shell_->DoUiAction((vr_shell::UiAction) action);
67 } 68 }
68 } 69 }
69 70
70 void VrShellUIMessageHandler::SendCommandToUi(const base::Value& value) { 71 void VrShellUIMessageHandler::SendCommandToUi(const base::Value& value) {
71 CallJavascriptFunction("vrShellUi.command", value); 72 CallJavascriptFunction("vrShellUi.command", value);
72 } 73 }
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell_delegate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698