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

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

Issue 2895953004: Add initial Controller to DownloadService (Closed)
Patch Set: Rebased 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
« no previous file with comments | « components/download/internal/config.cc ('k') | components/download/internal/controller_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/download/internal/controller.h
diff --git a/components/download/internal/controller.h b/components/download/internal/controller.h
new file mode 100644
index 0000000000000000000000000000000000000000..3e8888aaebff564f0a7a9f1f3e355e684a597ad7
--- /dev/null
+++ b/components/download/internal/controller.h
@@ -0,0 +1,63 @@
+// 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_CONTROLLER_H_
+#define COMPONENTS_DOWNLOAD_INTERNAL_CONTROLLER_H_
+
+#include <string>
+
+#include "base/macros.h"
+#include "components/download/public/clients.h"
+
+namespace download {
+
+struct DownloadParams;
+struct SchedulingParams;
+struct StartupStatus;
+
+// The core Controller responsible for gluing various DownloadService components
+// together to manage the active downloads.
+class Controller {
+ public:
+ Controller() = default;
+ virtual ~Controller() = default;
+
+ // Initializes the controller. Initialization may be asynchronous.
+ virtual void Initialize() = 0;
+
+ // Returns the status of Controller.
+ virtual const StartupStatus& GetStartupStatus() = 0;
+
+ // Starts a download with |params|. See DownloadParams::StartCallback and
+ // DownloadParams::StartResponse for information on how a caller can determine
+ // whether or not the download was successfully accepted and queued.
+ virtual void StartDownload(const DownloadParams& params) = 0;
+
+ // Pauses a download request associated with |guid| if one exists.
+ virtual void PauseDownload(const std::string& guid) = 0;
+
+ // Resumes a download request associated with |guid| if one exists. The
+ // download request may or may not start downloading at this time, but it will
+ // no longer be blocked by any prior PauseDownload() actions.
+ virtual void ResumeDownload(const std::string& guid) = 0;
+
+ // Cancels a download request associated with |guid| if one exists.
+ virtual void CancelDownload(const std::string& guid) = 0;
+
+ // Changes the SchedulingParams of a download request associated with |guid|
+ // to |params|.
+ virtual void ChangeDownloadCriteria(const std::string& guid,
+ const SchedulingParams& params) = 0;
+
+ // Exposes the owner of the download request for |guid| if one exists.
+ // Otherwise returns DownloadClient::INVALID for an unowned entry.
+ virtual DownloadClient GetOwnerOfDownload(const std::string& guid) = 0;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Controller);
+};
+
+} // namespace download
+
+#endif // COMPONENTS_DOWNLOAD_INTERNAL_CONTROLLER_H_
« no previous file with comments | « components/download/internal/config.cc ('k') | components/download/internal/controller_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698