| 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 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "chrome/browser/android/vr_shell/vr_shell.h" | 13 #include "chrome/browser/android/vr_shell/vr_shell.h" |
| 14 #include "content/public/browser/web_ui.h" | 14 #include "content/public/browser/web_ui.h" |
| 15 | 15 |
| 16 VrShellUIMessageHandler::VrShellUIMessageHandler() {} | 16 VrShellUIMessageHandler::VrShellUIMessageHandler() {} |
| 17 | 17 |
| 18 VrShellUIMessageHandler::~VrShellUIMessageHandler() {} | 18 VrShellUIMessageHandler::~VrShellUIMessageHandler() {} |
| 19 | 19 |
| 20 void VrShellUIMessageHandler::RegisterMessages() { | 20 void VrShellUIMessageHandler::RegisterMessages() { |
| 21 vr_shell_ = vr_shell::VrShell::GetWeakPtr(); | 21 vr_shell_ = vr_shell::VrShell::GetWeakPtr(web_ui()->GetWebContents()); |
| 22 | 22 |
| 23 web_ui()->RegisterMessageCallback( | 23 web_ui()->RegisterMessageCallback( |
| 24 "domLoaded", base::Bind(&VrShellUIMessageHandler::HandleDomLoaded, | 24 "domLoaded", base::Bind(&VrShellUIMessageHandler::HandleDomLoaded, |
| 25 base::Unretained(this))); | 25 base::Unretained(this))); |
| 26 web_ui()->RegisterMessageCallback( | 26 web_ui()->RegisterMessageCallback( |
| 27 "updateScene", base::Bind(&VrShellUIMessageHandler::HandleUpdateScene, | 27 "updateScene", base::Bind(&VrShellUIMessageHandler::HandleUpdateScene, |
| 28 base::Unretained(this))); | 28 base::Unretained(this))); |
| 29 web_ui()->RegisterMessageCallback( | 29 web_ui()->RegisterMessageCallback( |
| 30 "doAction", base::Bind(&VrShellUIMessageHandler::HandleDoAction, | 30 "doAction", base::Bind(&VrShellUIMessageHandler::HandleDoAction, |
| 31 base::Unretained(this))); | 31 base::Unretained(this))); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 53 auto cb = base::Bind(&vr_shell::UiScene::HandleCommands, | 53 auto cb = base::Bind(&vr_shell::UiScene::HandleCommands, |
| 54 base::Unretained(vr_shell_->GetScene()), | 54 base::Unretained(vr_shell_->GetScene()), |
| 55 base::Owned(args->CreateDeepCopy().release()), | 55 base::Owned(args->CreateDeepCopy().release()), |
| 56 vr_shell::UiScene::TimeInMicroseconds()); | 56 vr_shell::UiScene::TimeInMicroseconds()); |
| 57 vr_shell_->QueueTask(cb); | 57 vr_shell_->QueueTask(cb); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void VrShellUIMessageHandler::HandleDoAction(const base::ListValue* args) { | 60 void VrShellUIMessageHandler::HandleDoAction(const base::ListValue* args) { |
| 61 NOTIMPLEMENTED(); | 61 NOTIMPLEMENTED(); |
| 62 } | 62 } |
| OLD | NEW |