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

Side by Side Diff: mojo/tools/package_manager/package_fetcher.h

Issue 596913002: Add mojo package manager skeleton. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 6 years, 3 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
« no previous file with comments | « mojo/tools/package_manager/DEPS ('k') | mojo/tools/package_manager/package_fetcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #ifndef MOJO_TOOLS_PACKAGE_MANAGER_FETCHER_H_
6 #define MOJO_TOOLS_PACKAGE_MANAGER_FETCHER_H_
7
8 #include "base/files/file.h"
9 #include "base/files/file_path.h"
10 #include "mojo/common/handle_watcher.h"
11 #include "mojo/public/cpp/system/macros.h"
12 #include "mojo/services/public/interfaces/network/network_service.mojom.h"
13 #include "mojo/services/public/interfaces/network/url_loader.mojom.h"
14 #include "url/gurl.h"
15
16 namespace base {
17 class FilePath;
18 } // namespace base
19
20 namespace mojo {
21
22 class PackageFetcherDelegate;
23
24 class PackageFetcher {
25 public:
26 PackageFetcher(NetworkService* network_service,
27 PackageFetcherDelegate* delegate,
28 const GURL& url);
29 virtual ~PackageFetcher();
30
31 private:
32 void OnReceivedResponse(URLResponsePtr response);
33
34 void ReadData(MojoResult);
35 void WaitToReadMore();
36
37 PackageFetcherDelegate* delegate_;
38
39 // URL of the package.
40 GURL url_;
41
42 URLLoaderPtr loader_;
43
44 // Valid once file has started streaming.
45 ScopedDataPipeConsumerHandle body_;
46 common::HandleWatcher handle_watcher_;
47
48 base::FilePath output_file_name_;
49 base::File output_file_;
50
51 MOJO_DISALLOW_COPY_AND_ASSIGN(PackageFetcher);
52 };
53
54 class PackageFetcherDelegate {
55 public:
56 virtual void FetchSucceeded(const GURL& url, const base::FilePath& name) = 0;
57
58 virtual void FetchFailed(const GURL& url) = 0;
59 };
60
61 } // namespace mojo
62
63 #endif // MOJO_TOOLS_PACKAGE_MANAGER_FETCHER_H_
OLDNEW
« no previous file with comments | « mojo/tools/package_manager/DEPS ('k') | mojo/tools/package_manager/package_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698