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

Side by Side Diff: mojo/services/view_manager/main.cc

Issue 380413003: Mojo: Use InterfaceFactory<Interface> for service registration (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: some InterfaceProvider impls for common cases Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
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 #include "mojo/public/cpp/application/application_connection.h" 5 #include "mojo/public/cpp/application/application_connection.h"
6 #include "mojo/public/cpp/application/application_delegate.h" 6 #include "mojo/public/cpp/application/application_delegate.h"
7 #include "mojo/services/view_manager/view_manager_init_service_impl.h" 7 #include "mojo/services/view_manager/view_manager_init_service_impl.h"
8 8
9 namespace mojo { 9 namespace mojo {
10 namespace view_manager { 10 namespace view_manager {
11 namespace service { 11 namespace service {
12 12
13 class ViewManagerApp : public ApplicationDelegate { 13 class ViewManagerApp : public ApplicationDelegate,
14 public InterfaceProvider<ViewManagerInitService> {
14 public: 15 public:
15 ViewManagerApp() {} 16 ViewManagerApp() {}
16 virtual ~ViewManagerApp() {} 17 virtual ~ViewManagerApp() {}
17 18
18 virtual bool ConfigureIncomingConnection(ApplicationConnection* connection) 19 virtual bool ConfigureIncomingConnection(
19 MOJO_OVERRIDE { 20 ApplicationConnection* connection) OVERRIDE {
20 // TODO(sky): this needs some sort of authentication as well as making sure 21 // TODO(sky): this needs some sort of authentication as well as making sure
21 // we only ever have one active at a time. 22 // we only ever have one active at a time.
22 connection->AddService<ViewManagerInitServiceImpl>(); 23 connection->AddServiceProvider(this);
23 return true; 24 return true;
24 } 25 }
25 26
27 virtual void BindToRequest(
28 ApplicationConnection* connection,
29 InterfaceRequest<ViewManagerInitService> request) OVERRIDE {
30 mojo::BindToRequest(new ViewManagerInitServiceImpl(connection), &request);
31 }
32
26 private: 33 private:
27 DISALLOW_COPY_AND_ASSIGN(ViewManagerApp); 34 DISALLOW_COPY_AND_ASSIGN(ViewManagerApp);
28 }; 35 };
29 36
30 } // namespace service 37 } // namespace service
31 } // namespace view_manager 38 } // namespace view_manager
32 39
33 // static 40 // static
34 ApplicationDelegate* ApplicationDelegate::Create() { 41 ApplicationDelegate* ApplicationDelegate::Create() {
35 return new mojo::view_manager::service::ViewManagerApp(); 42 return new mojo::view_manager::service::ViewManagerApp();
36 } 43 }
37 44
38 } // namespace mojo 45 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698