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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/tools/package_manager/package_fetcher.h
diff --git a/mojo/tools/package_manager/package_fetcher.h b/mojo/tools/package_manager/package_fetcher.h
new file mode 100644
index 0000000000000000000000000000000000000000..3cbd7a798e33fe3dd1f2b968ea7009cd4a6aa860
--- /dev/null
+++ b/mojo/tools/package_manager/package_fetcher.h
@@ -0,0 +1,63 @@
+// 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_TOOLS_PACKAGE_MANAGER_FETCHER_H_
+#define MOJO_TOOLS_PACKAGE_MANAGER_FETCHER_H_
+
+#include "base/files/file.h"
+#include "base/files/file_path.h"
+#include "mojo/common/handle_watcher.h"
+#include "mojo/public/cpp/system/macros.h"
+#include "mojo/services/public/interfaces/network/network_service.mojom.h"
+#include "mojo/services/public/interfaces/network/url_loader.mojom.h"
+#include "url/gurl.h"
+
+namespace base {
+class FilePath;
+} // namespace base
+
+namespace mojo {
+
+class PackageFetcherDelegate;
+
+class PackageFetcher {
+ public:
+ PackageFetcher(NetworkService* network_service,
+ PackageFetcherDelegate* delegate,
+ const GURL& url);
+ virtual ~PackageFetcher();
+
+ private:
+ void OnReceivedResponse(URLResponsePtr response);
+
+ void ReadData(MojoResult);
+ void WaitToReadMore();
+
+ PackageFetcherDelegate* delegate_;
+
+ // URL of the package.
+ GURL url_;
+
+ URLLoaderPtr loader_;
+
+ // Valid once file has started streaming.
+ ScopedDataPipeConsumerHandle body_;
+ common::HandleWatcher handle_watcher_;
+
+ base::FilePath output_file_name_;
+ base::File output_file_;
+
+ MOJO_DISALLOW_COPY_AND_ASSIGN(PackageFetcher);
+};
+
+class PackageFetcherDelegate {
+ public:
+ virtual void FetchSucceeded(const GURL& url, const base::FilePath& name) = 0;
+
+ virtual void FetchFailed(const GURL& url) = 0;
+};
+
+} // namespace mojo
+
+#endif // MOJO_TOOLS_PACKAGE_MANAGER_FETCHER_H_
« 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