OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_MOJO_WEB_UI_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_MOJO_WEB_UI_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_MOJO_WEB_UI_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_MOJO_WEB_UI_CONTROLLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "chrome/browser/ui/webui/mojo_web_ui_handler.h" | 12 #include "chrome/browser/ui/webui/mojo_web_ui_handler.h" |
13 #include "content/public/browser/render_frame_host.h" | 13 #include "content/public/browser/render_frame_host.h" |
14 #include "content/public/browser/render_view_host.h" | 14 #include "content/public/browser/render_view_host.h" |
15 #include "content/public/browser/web_ui_controller.h" | 15 #include "content/public/browser/web_ui_controller.h" |
16 #include "content/public/common/service_registry.h" | 16 #include "content/public/common/service_registry.h" |
17 #include "mojo/public/cpp/system/core.h" | 17 #include "mojo/public/cpp/system/core.h" |
18 | 18 |
19 class MojoWebUIHandler; | 19 class MojoWebUIHandler; |
20 | 20 |
21 namespace content { | 21 namespace content { |
22 class WebUIDataSource; | 22 class WebUIDataSource; |
23 } | 23 } |
24 | 24 |
25 class MojoWebUIControllerBase : public content::WebUIController { | 25 class MojoWebUIControllerBase : public content::WebUIController { |
26 public: | 26 public: |
27 explicit MojoWebUIControllerBase(content::WebUI* contents); | 27 explicit MojoWebUIControllerBase(content::WebUI* contents); |
28 virtual ~MojoWebUIControllerBase(); | 28 ~MojoWebUIControllerBase() override; |
29 | 29 |
30 // WebUIController overrides: | 30 // WebUIController overrides: |
31 virtual void RenderViewCreated( | 31 void RenderViewCreated(content::RenderViewHost* render_view_host) override; |
32 content::RenderViewHost* render_view_host) override; | |
33 | 32 |
34 protected: | 33 protected: |
35 // Invoke to register mapping between binding file and resource id (IDR_...). | 34 // Invoke to register mapping between binding file and resource id (IDR_...). |
36 void AddMojoResourcePath(const std::string& path, int resource_id); | 35 void AddMojoResourcePath(const std::string& path, int resource_id); |
37 | 36 |
38 private: | 37 private: |
39 // Bindings files are registered here. | 38 // Bindings files are registered here. |
40 content::WebUIDataSource* mojo_data_source_; | 39 content::WebUIDataSource* mojo_data_source_; |
41 | 40 |
42 DISALLOW_COPY_AND_ASSIGN(MojoWebUIControllerBase); | 41 DISALLOW_COPY_AND_ASSIGN(MojoWebUIControllerBase); |
(...skipping 26 matching lines...) Expand all Loading... |
69 // Invoked to create the specific bindings implementation. | 68 // Invoked to create the specific bindings implementation. |
70 virtual void BindUIHandler(mojo::InterfaceRequest<Interface> request) = 0; | 69 virtual void BindUIHandler(mojo::InterfaceRequest<Interface> request) = 0; |
71 | 70 |
72 private: | 71 private: |
73 base::WeakPtrFactory<MojoWebUIController> weak_factory_; | 72 base::WeakPtrFactory<MojoWebUIController> weak_factory_; |
74 | 73 |
75 DISALLOW_COPY_AND_ASSIGN(MojoWebUIController); | 74 DISALLOW_COPY_AND_ASSIGN(MojoWebUIController); |
76 }; | 75 }; |
77 | 76 |
78 #endif // CHROME_BROWSER_UI_WEBUI_MOJO_WEB_UI_CONTROLLER_H_ | 77 #endif // CHROME_BROWSER_UI_WEBUI_MOJO_WEB_UI_CONTROLLER_H_ |
OLD | NEW |