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 #ifndef CHROME_BROWSER_UI_WEBUI_VR_SHELL_VR_SHELL_UI_MESSAGE_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_VR_SHELL_VR_SHELL_UI_MESSAGE_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_VR_SHELL_VR_SHELL_UI_MESSAGE_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_VR_SHELL_VR_SHELL_UI_MESSAGE_HANDLER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "content/public/browser/web_ui_message_handler.h" | 10 #include "content/public/browser/web_ui_message_handler.h" |
11 | 11 |
12 namespace base { | 12 namespace base { |
13 class ListValue; | 13 class ListValue; |
14 } | 14 } |
15 | 15 |
16 namespace vr_shell { | 16 namespace vr_shell { |
17 class VrShell; | 17 class VrShell; |
18 } | 18 } |
19 | 19 |
20 class VrShellUIMessageHandler : public content::WebUIMessageHandler { | 20 class VrShellUIMessageHandler : public content::WebUIMessageHandler { |
21 public: | 21 public: |
22 VrShellUIMessageHandler(); | 22 VrShellUIMessageHandler(); |
23 ~VrShellUIMessageHandler() override; | 23 ~VrShellUIMessageHandler() override; |
24 | 24 |
| 25 content::WebUI* GetWebUi() { return web_ui(); } |
| 26 |
25 private: | 27 private: |
26 // content::WebUIMessageHandler: | 28 // content::WebUIMessageHandler: |
27 void RegisterMessages() override; | 29 void RegisterMessages() override; |
28 | 30 |
29 void HandleDomLoaded(const base::ListValue* args); | 31 void HandleDomLoaded(const base::ListValue* args); |
30 void HandleUpdateScene(const base::ListValue* args); | 32 void HandleUpdateScene(const base::ListValue* args); |
31 void HandleDoAction(const base::ListValue* args); | 33 void HandleDoAction(const base::ListValue* args); |
32 | 34 |
33 base::WeakPtr<vr_shell::VrShell> vr_shell_; | 35 base::WeakPtr<vr_shell::VrShell> vr_shell_; |
34 | 36 |
| 37 base::WeakPtrFactory<VrShellUIMessageHandler> weak_ptr_factory_; |
| 38 |
35 DISALLOW_COPY_AND_ASSIGN(VrShellUIMessageHandler); | 39 DISALLOW_COPY_AND_ASSIGN(VrShellUIMessageHandler); |
36 }; | 40 }; |
37 | 41 |
38 #endif // CHROME_BROWSER_UI_WEBUI_VR_SHELL_VR_SHELL_UI_MESSAGE_HANDLER_H_ | 42 #endif // CHROME_BROWSER_UI_WEBUI_VR_SHELL_VR_SHELL_UI_MESSAGE_HANDLER_H_ |
OLD | NEW |