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" |
(...skipping 12 matching lines...) Expand all Loading... |
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 ~MojoWebUIControllerBase() override; | 28 ~MojoWebUIControllerBase() override; |
29 | 29 |
30 // WebUIController overrides: | 30 // WebUIController overrides: |
31 void RenderViewCreated(content::RenderViewHost* render_view_host) override; | 31 void RenderViewCreated(content::RenderViewHost* render_view_host) override; |
32 | 32 |
| 33 protected: |
| 34 // Invoke to register mapping between binding file and resource id (IDR_...). |
| 35 void AddMojoResourcePath(const std::string& path, int resource_id); |
| 36 |
33 private: | 37 private: |
34 // Bindings files are registered here. | 38 // Bindings files are registered here. |
35 content::WebUIDataSource* mojo_data_source_; | 39 content::WebUIDataSource* mojo_data_source_; |
36 | 40 |
37 DISALLOW_COPY_AND_ASSIGN(MojoWebUIControllerBase); | 41 DISALLOW_COPY_AND_ASSIGN(MojoWebUIControllerBase); |
38 }; | 42 }; |
39 | 43 |
40 // MojoWebUIController is intended for web ui pages that use mojo. It is | 44 // MojoWebUIController is intended for web ui pages that use mojo. It is |
41 // expected that subclasses will do two things: | 45 // expected that subclasses will do two things: |
42 // . In the constructor invoke AddMojoResourcePath() to register the bindings | 46 // . In the constructor invoke AddMojoResourcePath() to register the bindings |
(...skipping 20 matching lines...) Expand all Loading... |
63 // Invoked to create the specific bindings implementation. | 67 // Invoked to create the specific bindings implementation. |
64 virtual void BindUIHandler(mojo::InterfaceRequest<Interface> request) = 0; | 68 virtual void BindUIHandler(mojo::InterfaceRequest<Interface> request) = 0; |
65 | 69 |
66 private: | 70 private: |
67 base::WeakPtrFactory<MojoWebUIController> weak_factory_; | 71 base::WeakPtrFactory<MojoWebUIController> weak_factory_; |
68 | 72 |
69 DISALLOW_COPY_AND_ASSIGN(MojoWebUIController); | 73 DISALLOW_COPY_AND_ASSIGN(MojoWebUIController); |
70 }; | 74 }; |
71 | 75 |
72 #endif // CHROME_BROWSER_UI_WEBUI_MOJO_WEB_UI_CONTROLLER_H_ | 76 #endif // CHROME_BROWSER_UI_WEBUI_MOJO_WEB_UI_CONTROLLER_H_ |
OLD | NEW |