OLD | NEW |
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_PACKAGE_MANAGER_PACKAGE_MANAGER_APPLICATION_H_ | 5 #ifndef MOJO_PACKAGE_MANAGER_PACKAGE_MANAGER_APPLICATION_H_ |
6 #define MOJO_PACKAGE_MANAGER_PACKAGE_MANAGER_APPLICATION_H_ | 6 #define MOJO_PACKAGE_MANAGER_PACKAGE_MANAGER_APPLICATION_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
| 9 #include <set> |
9 | 10 |
10 #include "mojo/public/cpp/application/application_delegate.h" | 11 #include "mojo/public/cpp/application/application_delegate.h" |
11 #include "mojo/public/cpp/application/interface_factory.h" | 12 #include "mojo/public/cpp/application/interface_factory.h" |
12 #include "mojo/public/cpp/system/macros.h" | 13 #include "mojo/public/cpp/system/macros.h" |
13 #include "mojo/services/public/interfaces/network/network_service.mojom.h" | 14 #include "mojo/services/public/interfaces/network/network_service.mojom.h" |
14 #include "mojo/tools/package_manager/package_fetcher.h" | 15 #include "mojo/tools/package_manager/package_fetcher.h" |
15 #include "mojo/tools/package_manager/unpacker.h" | |
16 | 16 |
17 namespace mojo { | 17 namespace mojo { |
18 | 18 |
| 19 class Manifest; |
| 20 |
19 class PackageManagerApplication | 21 class PackageManagerApplication |
20 : public ApplicationDelegate, | 22 : public ApplicationDelegate, |
21 public PackageFetcherDelegate { | 23 public PackageFetcherDelegate { |
22 public: | 24 public: |
23 PackageManagerApplication(); | 25 PackageManagerApplication(); |
24 virtual ~PackageManagerApplication(); | 26 virtual ~PackageManagerApplication(); |
25 | 27 |
26 private: | 28 private: |
27 struct PendingLoad { | 29 struct PendingLoad { |
28 PendingLoad(); | 30 PendingLoad(); |
29 ~PendingLoad(); | 31 ~PendingLoad(); |
30 | 32 |
31 scoped_ptr<PackageFetcher> fetcher; | 33 scoped_ptr<PackageFetcher> fetcher; |
32 Unpacker unpacker; | |
33 }; | 34 }; |
34 typedef std::map<GURL, PendingLoad*> PendingLoadMap; | 35 typedef std::map<GURL, PendingLoad*> PendingLoadMap; |
35 | 36 |
| 37 void StartLoad(const GURL& url); |
| 38 |
| 39 void LoadDeps(const Manifest& manifest); |
| 40 |
36 // Deletes the pending load entry for the given URL and possibly exits the | 41 // Deletes the pending load entry for the given URL and possibly exits the |
37 // message loop if all loads are done. | 42 // message loop if all loads are done. |
38 void PendingLoadComplete(const GURL& url); | 43 void PendingLoadComplete(const GURL& url); |
39 | 44 |
40 // ApplicationDelegate implementation. | 45 // ApplicationDelegate implementation. |
41 virtual void Initialize(ApplicationImpl* app) MOJO_OVERRIDE; | 46 virtual void Initialize(ApplicationImpl* app) MOJO_OVERRIDE; |
42 | 47 |
43 // PackageFetcher. | 48 // PackageFetcher. |
44 virtual void FetchSucceeded(const GURL& url, | 49 virtual void FetchSucceeded(const GURL& url, |
45 const base::FilePath& name) override; | 50 const base::FilePath& name) override; |
46 virtual void FetchFailed(const GURL& url) override; | 51 virtual void FetchFailed(const GURL& url) override; |
47 | 52 |
48 mojo::NetworkServicePtr network_service_; | 53 mojo::NetworkServicePtr network_service_; |
49 | 54 |
50 PendingLoadMap pending_; // Owning pointers. | 55 PendingLoadMap pending_; // Owning pointers. |
| 56 std::set<GURL> completed_; |
51 | 57 |
52 MOJO_DISALLOW_COPY_AND_ASSIGN(PackageManagerApplication); | 58 MOJO_DISALLOW_COPY_AND_ASSIGN(PackageManagerApplication); |
53 }; | 59 }; |
54 | 60 |
55 } // namespace mojo | 61 } // namespace mojo |
56 | 62 |
57 #endif // MOJO_PACKAGE_MANAGER_PACKAGE_MANAGER_APPLICATION_H | 63 #endif // MOJO_PACKAGE_MANAGER_PACKAGE_MANAGER_APPLICATION_H |
OLD | NEW |