| OLD | NEW |
| 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 <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "chrome/browser/android/vr_shell/vr_shell.h" | 14 #include "chrome/browser/android/vr_shell/vr_shell.h" |
| 15 #include "content/public/browser/web_ui.h" | 15 #include "content/public/browser/web_ui.h" |
| 16 | 16 |
| 17 VrShellUIMessageHandler::VrShellUIMessageHandler() {} | 17 VrShellUIMessageHandler::VrShellUIMessageHandler() = default; |
| 18 | 18 |
| 19 VrShellUIMessageHandler::~VrShellUIMessageHandler() {} | 19 VrShellUIMessageHandler::~VrShellUIMessageHandler() = default; |
| 20 | 20 |
| 21 void VrShellUIMessageHandler::RegisterMessages() { | 21 void VrShellUIMessageHandler::RegisterMessages() { |
| 22 vr_shell_ = vr_shell::VrShell::GetWeakPtr(web_ui()->GetWebContents()); | 22 vr_shell_ = vr_shell::VrShell::GetWeakPtr(web_ui()->GetWebContents()); |
| 23 | 23 |
| 24 web_ui()->RegisterMessageCallback( | 24 web_ui()->RegisterMessageCallback( |
| 25 "domLoaded", base::Bind(&VrShellUIMessageHandler::HandleDomLoaded, | 25 "domLoaded", base::Bind(&VrShellUIMessageHandler::HandleDomLoaded, |
| 26 base::Unretained(this))); | 26 base::Unretained(this))); |
| 27 web_ui()->RegisterMessageCallback( | 27 web_ui()->RegisterMessageCallback( |
| 28 "updateScene", base::Bind(&VrShellUIMessageHandler::HandleUpdateScene, | 28 "updateScene", base::Bind(&VrShellUIMessageHandler::HandleUpdateScene, |
| 29 base::Unretained(this))); | 29 base::Unretained(this))); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 51 vr_shell_->QueueTask(cb); | 51 vr_shell_->QueueTask(cb); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void VrShellUIMessageHandler::HandleDoAction(const base::ListValue* args) { | 54 void VrShellUIMessageHandler::HandleDoAction(const base::ListValue* args) { |
| 55 int action; | 55 int action; |
| 56 CHECK(args->GetInteger(0, &action)); | 56 CHECK(args->GetInteger(0, &action)); |
| 57 if (vr_shell_) { | 57 if (vr_shell_) { |
| 58 vr_shell_->DoUiAction((vr_shell::UiAction) action); | 58 vr_shell_->DoUiAction((vr_shell::UiAction) action); |
| 59 } | 59 } |
| 60 } | 60 } |
| OLD | NEW |