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

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

Issue 2428383006: Decouple VR Shell DPR and CSS size from Physical Displays. (Closed)
Patch Set: Address bshe comments + minor fix Created 4 years 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/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 17 matching lines...) Expand all
28 28
29 web_ui()->RegisterMessageCallback( 29 web_ui()->RegisterMessageCallback(
30 "domLoaded", base::Bind(&VrShellUIMessageHandler::HandleDomLoaded, 30 "domLoaded", base::Bind(&VrShellUIMessageHandler::HandleDomLoaded,
31 base::Unretained(this))); 31 base::Unretained(this)));
32 web_ui()->RegisterMessageCallback( 32 web_ui()->RegisterMessageCallback(
33 "updateScene", base::Bind(&VrShellUIMessageHandler::HandleUpdateScene, 33 "updateScene", base::Bind(&VrShellUIMessageHandler::HandleUpdateScene,
34 base::Unretained(this))); 34 base::Unretained(this)));
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 web_ui()->RegisterMessageCallback(
39 "setUiCssSize", base::Bind(&VrShellUIMessageHandler::HandleSetUiCssSize,
40 base::Unretained(this)));
38 } 41 }
39 42
40 void VrShellUIMessageHandler::HandleDomLoaded(const base::ListValue* args) { 43 void VrShellUIMessageHandler::HandleDomLoaded(const base::ListValue* args) {
41 AllowJavascript(); 44 AllowJavascript();
42 } 45 }
43 46
44 void VrShellUIMessageHandler::OnJavascriptAllowed() { 47 void VrShellUIMessageHandler::OnJavascriptAllowed() {
45 // If we don't have a VR Shell here, it means either the user manually loaded 48 // If we don't have a VR Shell here, it means either the user manually loaded
46 // this webui page and we want to silently fail to connect to native vr shell, 49 // this webui page and we want to silently fail to connect to native vr shell,
47 // or VR Shell was deleted, and this webui content is also about to be 50 // or VR Shell was deleted, and this webui content is also about to be
(...skipping 17 matching lines...) Expand all
65 } 68 }
66 69
67 void VrShellUIMessageHandler::HandleDoAction(const base::ListValue* args) { 70 void VrShellUIMessageHandler::HandleDoAction(const base::ListValue* args) {
68 int action; 71 int action;
69 CHECK(args->GetInteger(0, &action)); 72 CHECK(args->GetInteger(0, &action));
70 if (vr_shell_) { 73 if (vr_shell_) {
71 vr_shell_->DoUiAction((vr_shell::UiAction) action); 74 vr_shell_->DoUiAction((vr_shell::UiAction) action);
72 } 75 }
73 } 76 }
74 77
78 void VrShellUIMessageHandler::HandleSetUiCssSize(const base::ListValue* args) {
79 CHECK(args->GetSize() == 3);
80 double width, height, dpr;
81 CHECK(args->GetDouble(0, &width));
82 CHECK(args->GetDouble(1, &height));
83 CHECK(args->GetDouble(2, &dpr));
84 if (vr_shell_) {
85 vr_shell_->SetUiCssSize(width, height, dpr);
86 }
87 }
88
75 void VrShellUIMessageHandler::SendCommandToUi(const base::Value& value) { 89 void VrShellUIMessageHandler::SendCommandToUi(const base::Value& value) {
76 CallJavascriptFunction("vrShellUi.command", value); 90 CallJavascriptFunction("vrShellUi.command", value);
77 } 91 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698