| 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 | |
| 37 private: | 33 private: |
| 38 // Bindings files are registered here. | 34 // Bindings files are registered here. |
| 39 content::WebUIDataSource* mojo_data_source_; | 35 content::WebUIDataSource* mojo_data_source_; |
| 40 | 36 |
| 41 DISALLOW_COPY_AND_ASSIGN(MojoWebUIControllerBase); | 37 DISALLOW_COPY_AND_ASSIGN(MojoWebUIControllerBase); |
| 42 }; | 38 }; |
| 43 | 39 |
| 44 // MojoWebUIController is intended for web ui pages that use mojo. It is | 40 // MojoWebUIController is intended for web ui pages that use mojo. It is |
| 45 // expected that subclasses will do two things: | 41 // expected that subclasses will do two things: |
| 46 // . In the constructor invoke AddMojoResourcePath() to register the bindings | 42 // . In the constructor invoke AddMojoResourcePath() to register the bindings |
| (...skipping 20 matching lines...) Expand all Loading... |
| 67 // Invoked to create the specific bindings implementation. | 63 // Invoked to create the specific bindings implementation. |
| 68 virtual void BindUIHandler(mojo::InterfaceRequest<Interface> request) = 0; | 64 virtual void BindUIHandler(mojo::InterfaceRequest<Interface> request) = 0; |
| 69 | 65 |
| 70 private: | 66 private: |
| 71 base::WeakPtrFactory<MojoWebUIController> weak_factory_; | 67 base::WeakPtrFactory<MojoWebUIController> weak_factory_; |
| 72 | 68 |
| 73 DISALLOW_COPY_AND_ASSIGN(MojoWebUIController); | 69 DISALLOW_COPY_AND_ASSIGN(MojoWebUIController); |
| 74 }; | 70 }; |
| 75 | 71 |
| 76 #endif // CHROME_BROWSER_UI_WEBUI_MOJO_WEB_UI_CONTROLLER_H_ | 72 #endif // CHROME_BROWSER_UI_WEBUI_MOJO_WEB_UI_CONTROLLER_H_ |
| OLD | NEW |