Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(366)

Side by Side Diff: ios/chrome/browser/ui/webui/mojo_web_ui_ios_controller.h

Issue 2420253002: Rename shell namespace to service_manager (Closed)
Patch Set: . Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 IOS_CHROME_BROWSER_UI_WEBUI_MOJO_WEB_UI_IOS_CONTROLLER_H_ 5 #ifndef IOS_CHROME_BROWSER_UI_WEBUI_MOJO_WEB_UI_IOS_CONTROLLER_H_
6 #define IOS_CHROME_BROWSER_UI_WEBUI_MOJO_WEB_UI_IOS_CONTROLLER_H_ 6 #define IOS_CHROME_BROWSER_UI_WEBUI_MOJO_WEB_UI_IOS_CONTROLLER_H_
7 7
8 #import "ios/web/public/web_state/web_state.h" 8 #import "ios/web/public/web_state/web_state.h"
9 #include "ios/web/public/webui/web_ui_ios.h" 9 #include "ios/web/public/webui/web_ui_ios.h"
10 #include "ios/web/public/webui/web_ui_ios_controller.h" 10 #include "ios/web/public/webui/web_ui_ios_controller.h"
11 #include "services/service_manager/public/cpp/interface_factory.h" 11 #include "services/service_manager/public/cpp/interface_factory.h"
12 #include "services/service_manager/public/cpp/interface_registry.h" 12 #include "services/service_manager/public/cpp/interface_registry.h"
13 13
14 // This class is intended for web ui pages that use mojo. It is expected that 14 // This class is intended for web ui pages that use mojo. It is expected that
15 // subclasses will do two things: 15 // subclasses will do two things:
16 // . In the constructor invoke AddMojoResourcePath() to register the bindings 16 // . In the constructor invoke AddMojoResourcePath() to register the bindings
17 // files, eg: 17 // files, eg:
18 // AddMojoResourcePath("chrome/browser/ui/webui/version.mojom", 18 // AddMojoResourcePath("chrome/browser/ui/webui/version.mojom",
19 // IDR_IOS_VERSION_MOJO_JS); 19 // IDR_IOS_VERSION_MOJO_JS);
20 // . Override BindUIHandler() to create and bind the implementation of the 20 // . Override BindUIHandler() to create and bind the implementation of the
21 // bindings. 21 // bindings.
22 template <typename Interface> 22 template <typename Interface>
23 class MojoWebUIIOSController : public web::WebUIIOSController, 23 class MojoWebUIIOSController
24 public shell::InterfaceFactory<Interface> { 24 : public web::WebUIIOSController,
25 public service_manager::InterfaceFactory<Interface> {
25 public: 26 public:
26 explicit MojoWebUIIOSController(web::WebUIIOS* web_ui) 27 explicit MojoWebUIIOSController(web::WebUIIOS* web_ui)
27 : web::WebUIIOSController(web_ui) { 28 : web::WebUIIOSController(web_ui) {
28 web_ui->GetWebState()->GetMojoInterfaceRegistry()->AddInterface(this); 29 web_ui->GetWebState()->GetMojoInterfaceRegistry()->AddInterface(this);
29 } 30 }
30 31
31 protected: 32 protected:
32 // Invoked to create the specific bindings implementation. 33 // Invoked to create the specific bindings implementation.
33 virtual void BindUIHandler(mojo::InterfaceRequest<Interface> request) = 0; 34 virtual void BindUIHandler(mojo::InterfaceRequest<Interface> request) = 0;
34 35
35 private: 36 private:
36 // shell::InterfaceFactory overrides: 37 // service_manager::InterfaceFactory overrides:
37 void Create(const shell::Identity& remote_identity, 38 void Create(const service_manager::Identity& remote_identity,
38 mojo::InterfaceRequest<Interface> request) override { 39 mojo::InterfaceRequest<Interface> request) override {
39 BindUIHandler(std::move(request)); 40 BindUIHandler(std::move(request));
40 } 41 }
41 42
42 private: 43 private:
43 DISALLOW_COPY_AND_ASSIGN(MojoWebUIIOSController); 44 DISALLOW_COPY_AND_ASSIGN(MojoWebUIIOSController);
44 }; 45 };
45 46
46 #endif // IOS_CHROME_BROWSER_UI_WEBUI_MOJO_WEB_UI_IOS_CONTROLLER_H_ 47 #endif // IOS_CHROME_BROWSER_UI_WEBUI_MOJO_WEB_UI_IOS_CONTROLLER_H_
OLDNEW
« no previous file with comments | « headless/lib/browser/headless_web_contents_impl.cc ('k') | ios/web/public/test/test_web_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698