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

Unified 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: Rebase 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/vr_shell/vr_shell_ui_message_handler.cc
diff --git a/chrome/browser/ui/webui/vr_shell/vr_shell_ui_message_handler.cc b/chrome/browser/ui/webui/vr_shell/vr_shell_ui_message_handler.cc
index 7eb33f110f6836998ec784e8f325605d9862e22a..100dbab45acf05d2ccade950cd1a9a13890b9e5d 100644
--- a/chrome/browser/ui/webui/vr_shell/vr_shell_ui_message_handler.cc
+++ b/chrome/browser/ui/webui/vr_shell/vr_shell_ui_message_handler.cc
@@ -35,6 +35,9 @@ void VrShellUIMessageHandler::RegisterMessages() {
web_ui()->RegisterMessageCallback(
"doAction", base::Bind(&VrShellUIMessageHandler::HandleDoAction,
base::Unretained(this)));
+ web_ui()->RegisterMessageCallback(
+ "setCssSize", base::Bind(&VrShellUIMessageHandler::HandleSetCssSize,
+ base::Unretained(this)));
}
void VrShellUIMessageHandler::HandleDomLoaded(const base::ListValue* args) {
@@ -72,6 +75,17 @@ void VrShellUIMessageHandler::HandleDoAction(const base::ListValue* args) {
}
}
+void VrShellUIMessageHandler::HandleSetCssSize(const base::ListValue* args) {
+ CHECK(args->GetSize() == 3);
+ double width, height, dpr;
+ CHECK(args->GetDouble(0, &width));
cjgrant 2016/11/29 20:28:06 Might be clearer to pass a dictionary of 'width',
mthiesse 2016/11/29 21:07:21 Length check is equivalent to checking a dictionar
+ CHECK(args->GetDouble(1, &height));
+ CHECK(args->GetDouble(2, &dpr));
+ if (vr_shell_) {
+ vr_shell_->SetUiCssSize(width, height, dpr);
cjgrant 2016/11/29 20:28:06 Does this not need to be synchronized on the rende
mthiesse 2016/11/29 21:07:21 Yes and No. This part does not, it has to be calle
+ }
+}
+
void VrShellUIMessageHandler::SendCommandToUi(const base::Value& value) {
CallJavascriptFunction("vrShellUi.command", value);
}

Powered by Google App Engine
This is Rietveld 408576698