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

Side by Side Diff: mojo/shell/network_service_loader.h

Issue 380413003: Mojo: Use InterfaceFactory<Interface> for service registration (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix network_service_loader 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 #ifndef MOJO_SHELL_NETWORK_SERVICE_LOADER_H_ 5 #ifndef MOJO_SHELL_NETWORK_SERVICE_LOADER_H_
6 #define MOJO_SHELL_NETWORK_SERVICE_LOADER_H_ 6 #define MOJO_SHELL_NETWORK_SERVICE_LOADER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/containers/scoped_ptr_hash_map.h" 10 #include "base/containers/scoped_ptr_hash_map.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "mojo/public/cpp/application/application_delegate.h" 12 #include "mojo/public/cpp/application/application_delegate.h"
13 #include "mojo/public/cpp/application/interface_factory.h"
13 #include "mojo/service_manager/service_loader.h" 14 #include "mojo/service_manager/service_loader.h"
14 #include "mojo/services/network/network_context.h" 15 #include "mojo/services/network/network_context.h"
15 16
16 namespace mojo { 17 namespace mojo {
17 18
18 class ApplicationImpl; 19 class ApplicationImpl;
20 class NetworkService;
19 21
20 namespace shell { 22 namespace shell {
21 23
22 // ServiceLoader responsible for creating connections to the NetworkService. 24 // ServiceLoader responsible for creating connections to the NetworkService.
23 class NetworkServiceLoader : public ServiceLoader, public ApplicationDelegate { 25 class NetworkServiceLoader : public ServiceLoader,
26 public ApplicationDelegate,
27 public InterfaceFactory<NetworkService> {
24 public: 28 public:
25 NetworkServiceLoader(); 29 NetworkServiceLoader();
26 virtual ~NetworkServiceLoader(); 30 virtual ~NetworkServiceLoader();
27 31
28 private: 32 private:
29 // ServiceLoader overrides: 33 // ServiceLoader overrides:
30 virtual void LoadService( 34 virtual void LoadService(
31 ServiceManager* manager, 35 ServiceManager* manager,
32 const GURL& url, 36 const GURL& url,
33 ScopedMessagePipeHandle shell_handle) OVERRIDE; 37 ScopedMessagePipeHandle shell_handle) OVERRIDE;
34 virtual void OnServiceError(ServiceManager* manager, 38 virtual void OnServiceError(ServiceManager* manager,
35 const GURL& url) OVERRIDE; 39 const GURL& url) OVERRIDE;
36 40
37 // ApplicationDelegate overrides. 41 // ApplicationDelegate overrides.
38 virtual void Initialize(ApplicationImpl* app) MOJO_OVERRIDE; 42 virtual void Initialize(ApplicationImpl* app) OVERRIDE;
39 virtual bool ConfigureIncomingConnection(ApplicationConnection* connection) 43 virtual bool ConfigureIncomingConnection(ApplicationConnection* connection)
40 MOJO_OVERRIDE; 44 OVERRIDE;
45
46 // InterfaceFactory<NetworkService> overrides.
47 virtual void Create(ApplicationConnection* connection,
48 InterfaceRequest<NetworkService> request) OVERRIDE;
41 49
42 base::ScopedPtrHashMap<uintptr_t, ApplicationImpl> apps_; 50 base::ScopedPtrHashMap<uintptr_t, ApplicationImpl> apps_;
43 scoped_ptr<NetworkContext> context_; 51 scoped_ptr<NetworkContext> context_;
44 52
45 DISALLOW_COPY_AND_ASSIGN(NetworkServiceLoader); 53 DISALLOW_COPY_AND_ASSIGN(NetworkServiceLoader);
46 }; 54 };
47 55
48 } // namespace shell 56 } // namespace shell
49 } // namespace mojo 57 } // namespace mojo
50 58
51 #endif // MOJO_SHELL_NETWORK_SERVICE_LOADER_H_ 59 #endif // MOJO_SHELL_NETWORK_SERVICE_LOADER_H_
OLDNEW
« no previous file with comments | « mojo/services/window_manager/window_manager_service_impl.cc ('k') | mojo/shell/network_service_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698