blob: 0eab765acdae713f8478b485b86a44b9c78568a5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MOJO_SHELL_NETWORK_SERVICE_LOADER_H_
#define MOJO_SHELL_NETWORK_SERVICE_LOADER_H_
#include <map>
#include "base/containers/scoped_ptr_hash_map.h"
#include "base/memory/scoped_ptr.h"
#include "mojo/public/cpp/application/application_delegate.h"
#include "mojo/public/cpp/application/interface_factory.h"
#include "mojo/service_manager/service_loader.h"
#include "mojo/services/network/network_context.h"
namespace mojo {
class ApplicationImpl;
class NetworkService;
namespace shell {
// ServiceLoader responsible for creating connections to the NetworkService.
class NetworkServiceLoader : public ServiceLoader,
public ApplicationDelegate,
public InterfaceFactory<NetworkService> {
public:
NetworkServiceLoader();
virtual ~NetworkServiceLoader();
private:
// ServiceLoader overrides:
virtual void Load(ServiceManager* manager,
const GURL& url,
scoped_refptr<LoadCallbacks> callbacks) OVERRIDE;
virtual void OnServiceError(ServiceManager* manager,
const GURL& url) OVERRIDE;
// ApplicationDelegate overrides.
virtual void Initialize(ApplicationImpl* app) OVERRIDE;
virtual bool ConfigureIncomingConnection(ApplicationConnection* connection)
OVERRIDE;
// InterfaceFactory<NetworkService> overrides.
virtual void Create(ApplicationConnection* connection,
InterfaceRequest<NetworkService> request) OVERRIDE;
base::ScopedPtrHashMap<uintptr_t, ApplicationImpl> apps_;
scoped_ptr<NetworkContext> context_;
DISALLOW_COPY_AND_ASSIGN(NetworkServiceLoader);
};
} // namespace shell
} // namespace mojo
#endif // MOJO_SHELL_NETWORK_SERVICE_LOADER_H_
|