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 <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "chrome/browser/ui/webui/mojo_web_ui_handler.h" | 13 #include "chrome/browser/ui/webui/mojo_web_ui_handler.h" |
14 #include "content/public/browser/render_frame_host.h" | 14 #include "content/public/browser/render_frame_host.h" |
15 #include "content/public/browser/render_view_host.h" | 15 #include "content/public/browser/render_view_host.h" |
16 #include "content/public/browser/web_ui_controller.h" | 16 #include "content/public/browser/web_ui_controller.h" |
17 #include "mojo/public/cpp/system/core.h" | 17 #include "mojo/public/cpp/system/core.h" |
| 18 #include "services/service_manager/public/cpp/bind_source_info.h" |
18 #include "services/service_manager/public/cpp/binder_registry.h" | 19 #include "services/service_manager/public/cpp/binder_registry.h" |
19 | 20 |
20 class MojoWebUIControllerBase : public content::WebUIController { | 21 class MojoWebUIControllerBase : public content::WebUIController { |
21 public: | 22 public: |
22 explicit MojoWebUIControllerBase(content::WebUI* contents); | 23 explicit MojoWebUIControllerBase(content::WebUI* contents); |
23 ~MojoWebUIControllerBase() override; | 24 ~MojoWebUIControllerBase() override; |
24 | 25 |
25 // WebUIController overrides: | 26 // WebUIController overrides: |
26 void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override; | 27 void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override; |
27 | 28 |
(...skipping 23 matching lines...) Expand all Loading... |
51 // Right now, this is expected to be called only for main frames. | 52 // Right now, this is expected to be called only for main frames. |
52 DCHECK(!render_frame_host->GetParent()); | 53 DCHECK(!render_frame_host->GetParent()); |
53 render_frame_host->GetInterfaceRegistry()-> | 54 render_frame_host->GetInterfaceRegistry()-> |
54 AddInterface<Interface>( | 55 AddInterface<Interface>( |
55 base::Bind(&MojoWebUIController::BindUIHandler, | 56 base::Bind(&MojoWebUIController::BindUIHandler, |
56 weak_factory_.GetWeakPtr())); | 57 weak_factory_.GetWeakPtr())); |
57 } | 58 } |
58 | 59 |
59 protected: | 60 protected: |
60 // Invoked to create the specific bindings implementation. | 61 // Invoked to create the specific bindings implementation. |
61 virtual void BindUIHandler(mojo::InterfaceRequest<Interface> request) = 0; | 62 virtual void BindUIHandler(const service_manager::BindSourceInfo& source_info, |
| 63 mojo::InterfaceRequest<Interface> request) = 0; |
62 | 64 |
63 private: | 65 private: |
64 base::WeakPtrFactory<MojoWebUIController> weak_factory_; | 66 base::WeakPtrFactory<MojoWebUIController> weak_factory_; |
65 | 67 |
66 DISALLOW_COPY_AND_ASSIGN(MojoWebUIController); | 68 DISALLOW_COPY_AND_ASSIGN(MojoWebUIController); |
67 }; | 69 }; |
68 | 70 |
69 #endif // CHROME_BROWSER_UI_WEBUI_MOJO_WEB_UI_CONTROLLER_H_ | 71 #endif // CHROME_BROWSER_UI_WEBUI_MOJO_WEB_UI_CONTROLLER_H_ |
OLD | NEW |