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
3 // found in the LICENSE file.
5 #ifndef MOJO_SHELL_NETWORK_APPLICATION_LOADER_H_
6 #define MOJO_SHELL_NETWORK_APPLICATION_LOADER_H_
8 #include "base/containers/scoped_ptr_hash_map.h"
9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "mojo/application_manager/application_loader.h"
12 #include "mojo/public/cpp/application/application_delegate.h"
13 #include "mojo/public/cpp/application/interface_factory.h"
14 #include "mojo/services/network/network_context.h"
18 class ApplicationImpl
;
23 // ApplicationLoader responsible for creating connections to the NetworkService.
24 class NetworkApplicationLoader
: public ApplicationLoader
,
25 public ApplicationDelegate
,
26 public InterfaceFactory
<NetworkService
> {
28 NetworkApplicationLoader();
29 virtual ~NetworkApplicationLoader();
32 // ApplicationLoader overrides:
33 virtual void Load(ApplicationManager
* manager
,
35 scoped_refptr
<LoadCallbacks
> callbacks
) override
;
36 virtual void OnApplicationError(ApplicationManager
* manager
,
37 const GURL
& url
) override
;
39 // ApplicationDelegate overrides.
40 virtual void Initialize(ApplicationImpl
* app
) override
;
41 virtual bool ConfigureIncomingConnection(
42 ApplicationConnection
* connection
) override
;
44 // InterfaceFactory<NetworkService> overrides.
45 virtual void Create(ApplicationConnection
* connection
,
46 InterfaceRequest
<NetworkService
> request
) override
;
48 base::ScopedPtrHashMap
<uintptr_t, ApplicationImpl
> apps_
;
49 scoped_ptr
<NetworkContext
> context_
;
51 DISALLOW_COPY_AND_ASSIGN(NetworkApplicationLoader
);
57 #endif // MOJO_SHELL_NETWORK_APPLICATION_LOADER_H_