Chromium Code Reviews| 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); |
| } |