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

Unified Diff: chrome/browser/download/download_ui_controller.h

Issue 11640007: Make the UI an observer of downloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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: chrome/browser/download/download_ui_controller.h
diff --git a/chrome/browser/download/download_ui_controller.h b/chrome/browser/download/download_ui_controller.h
new file mode 100644
index 0000000000000000000000000000000000000000..6445dd4e70c91bf0c9139367304568bd2171b0a7
--- /dev/null
+++ b/chrome/browser/download/download_ui_controller.h
@@ -0,0 +1,54 @@
+// Copyright (c) 2012 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 CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UI_CONTROLLER_H_
+#define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UI_CONTROLLER_H_
+
+#include <set>
+
+#include "chrome/browser/download/all_download_item_notifier.h"
+
+class Profile;
+
+namespace content {
+class WebContents;
+}
+
+// This class handles the task of observing for download notifications and
+// notifying the UI when a new download should be displayed in the UI.
+//
+// On Android the target of the notification is DownloadControllerAndroid.
+//
+// On platforms that are not Android the target of this notification is a
+// Browser object. This class is responsible for determining which Browser to
+// notify.
+//
+// This class monitors each IN_PROGRESS download that is created (for which
+// OnDownloadCreated is called) until:
+// - it is assigned a target path or
+// - is interrupted.
+// Then the appropriate class is notified of the download.
+class DownloadUIController : public AllDownloadItemNotifier::Observer {
+ public:
+ DownloadUIController(Profile* profile,
+ content::DownloadManager* manager);
+
+ virtual ~DownloadUIController();
+
+ private:
+ virtual void OnDownloadCreated(content::DownloadManager* manager,
+ content::DownloadItem* item) OVERRIDE;
+ virtual void OnDownloadUpdated(content::DownloadManager* manager,
+ content::DownloadItem* item) OVERRIDE;
+
+ void NotifyDownloadStarting(content::DownloadItem* item);
+
+ AllDownloadItemNotifier notifier_;
+
+ Profile* profile_;
+
+ DISALLOW_COPY_AND_ASSIGN(DownloadUIController);
+};
+
+#endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_UI_CONTROLLER_H_

Powered by Google App Engine
This is Rietveld 408576698