| 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" | |
| 12 #include "content/public/browser/web_ui_controller.h" | 11 #include "content/public/browser/web_ui_controller.h" |
| 13 #include "mojo/public/cpp/system/core.h" | 12 #include "mojo/public/cpp/system/core.h" |
| 14 | 13 |
| 15 class MojoWebUIHandler; | 14 class MojoWebUIHandler; |
| 16 | 15 |
| 17 namespace content { | 16 namespace content { |
| 18 class WebUIDataSource; | 17 class WebUIDataSource; |
| 19 } | 18 } |
| 20 | 19 |
| 21 // MojoWebUIController is intended for web ui pages that use mojo. It is | 20 // MojoWebUIController is intended for web ui pages that use mojo. It is |
| (...skipping 14 matching lines...) Expand all Loading... |
| 36 | 35 |
| 37 protected: | 36 protected: |
| 38 // Invoke to register mapping between binding file and resource id (IDR_...). | 37 // Invoke to register mapping between binding file and resource id (IDR_...). |
| 39 void AddMojoResourcePath(const std::string& path, int resource_id); | 38 void AddMojoResourcePath(const std::string& path, int resource_id); |
| 40 | 39 |
| 41 // Invoked to create the specific bindings implementation. | 40 // Invoked to create the specific bindings implementation. |
| 42 virtual scoped_ptr<MojoWebUIHandler> CreateUIHandler( | 41 virtual scoped_ptr<MojoWebUIHandler> CreateUIHandler( |
| 43 mojo::ScopedMessagePipeHandle handle_to_page) = 0; | 42 mojo::ScopedMessagePipeHandle handle_to_page) = 0; |
| 44 | 43 |
| 45 private: | 44 private: |
| 46 // Invoked in response to a connection from the renderer. | |
| 47 void CreateAndStoreUIHandler(mojo::ScopedMessagePipeHandle handle); | |
| 48 | |
| 49 // Bindings files are registered here. | 45 // Bindings files are registered here. |
| 50 content::WebUIDataSource* mojo_data_source_; | 46 content::WebUIDataSource* mojo_data_source_; |
| 51 | 47 |
| 52 scoped_ptr<MojoWebUIHandler> ui_handler_; | 48 scoped_ptr<MojoWebUIHandler> ui_handler_; |
| 53 | 49 |
| 54 base::WeakPtrFactory<MojoWebUIController> weak_factory_; | |
| 55 | |
| 56 DISALLOW_COPY_AND_ASSIGN(MojoWebUIController); | 50 DISALLOW_COPY_AND_ASSIGN(MojoWebUIController); |
| 57 }; | 51 }; |
| 58 | 52 |
| 59 #endif // CHROME_BROWSER_UI_WEBUI_MOJO_WEB_UI_CONTROLLER_H_ | 53 #endif // CHROME_BROWSER_UI_WEBUI_MOJO_WEB_UI_CONTROLLER_H_ |
| OLD | NEW |