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

Unified Diff: components/download/internal/entry.h

Issue 2870753003: Add a Model to the download component. (Closed)
Patch Set: Renamed test base class Created 3 years, 7 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
Index: components/download/internal/entry.h
diff --git a/components/download/internal/entry.h b/components/download/internal/entry.h
new file mode 100644
index 0000000000000000000000000000000000000000..9ba0c4275271e9675a4a48952a411adbcc76a9c0
--- /dev/null
+++ b/components/download/internal/entry.h
@@ -0,0 +1,68 @@
+// Copyright 2017 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 COMPONENTS_DOWNLOAD_INTERNAL_ENTRY_H_
+#define COMPONENTS_DOWNLOAD_INTERNAL_ENTRY_H_
+
+#include "components/download/public/client.h"
+#include "components/download/public/clients.h"
+#include "components/download/public/download_params.h"
+
+namespace download {
+
+// An entry in the Model that represents a scheduled download.
+struct Entry {
+ public:
+ enum class State {
+ // A newly added download. The Entry is not guaranteed to be persisted in
+ // the model yet.
+ NEW = 0,
+
+ // The download has been persisted and is available to start, pending
+ // scheduler criteria.
+ AVAILABLE = 1,
+
+ // The download is active. The DownloadDriver is aware of it and it is
+ // either being downloaded or suspended by the scheduler due to device
+ // characteristics or throttling.
+ ACTIVE = 2,
+
+ // The download has been paused by the owning Client. The download will not
+ // be run until it is resumed by the Client.
+ PAUSED = 3,
+
+ // The download is 'complete' by some definition of that term (could have
+ // failed, could have succeeded, etc.). It is ready to have UMA logs saved.
+ COMPLETE = 4,
+
+ // The download is finished. We are leaving this entry around to make sure
+ // the files on disk are cleaned up.
+ WATCHDOG = 5,
+ };
+
+ Entry();
+ Entry(const Entry& other);
+ ~Entry();
+
+ // The feature that is requesting this download.
+ DownloadClient client = DownloadClient::INVALID;
+
+ // A unique GUID that represents this download. See | base::GenerateGUID()|.
+ std::string guid;
+
+ // The parameters that determine under what device conditions this download
+ // will occur.
+ SchedulingParams scheduling_params;
+
+ // The parameters that define the actual download request to make.
+ RequestParams request_params;
+
+ // The state of the download to help the scheduler and loggers make the right
+ // decisions about the download object.
+ State state = State::NEW;
+};
+
+} // namespace download
+
+#endif // COMPONENTS_DOWNLOAD_INTERNAL_ENTRY_H_
« no previous file with comments | « components/download/internal/download_service_impl_unittest.cc ('k') | components/download/internal/entry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698