OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // The DownloadManager object manages the process of downloading, including | 5 // The DownloadManager object manages the process of downloading, including |
6 // updates to the history system and providing the information for displaying | 6 // updates to the history system and providing the information for displaying |
7 // the downloads view in the Destinations tab. There is one DownloadManager per | 7 // the downloads view in the Destinations tab. There is one DownloadManager per |
8 // active profile in Chrome. | 8 // active profile in Chrome. |
9 // | 9 // |
10 // Each download is represented by a DownloadItem, and all DownloadItems | 10 // Each download is represented by a DownloadItem, and all DownloadItems |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 }; | 91 }; |
92 | 92 |
93 // Interface that observers of a particular download must implement in order | 93 // Interface that observers of a particular download must implement in order |
94 // to receive updates to the download's status. | 94 // to receive updates to the download's status. |
95 class Observer { | 95 class Observer { |
96 public: | 96 public: |
97 virtual void OnDownloadUpdated(DownloadItem* download) = 0; | 97 virtual void OnDownloadUpdated(DownloadItem* download) = 0; |
98 | 98 |
99 // Called when a downloaded file has been opened. | 99 // Called when a downloaded file has been opened. |
100 virtual void OnDownloadOpened(DownloadItem* download) = 0; | 100 virtual void OnDownloadOpened(DownloadItem* download) = 0; |
101 | |
102 protected: | |
103 ~Observer() {} | |
104 }; | 101 }; |
105 | 102 |
106 // Constructing from persistent store: | 103 // Constructing from persistent store: |
107 DownloadItem(const DownloadCreateInfo& info); | 104 DownloadItem(const DownloadCreateInfo& info); |
108 | 105 |
109 // Constructing from user action: | 106 // Constructing from user action: |
110 DownloadItem(int32 download_id, | 107 DownloadItem(int32 download_id, |
111 const FilePath& path, | 108 const FilePath& path, |
112 int path_uniquifier, | 109 int path_uniquifier, |
113 const GURL& url, | 110 const GURL& url, |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 class Observer { | 316 class Observer { |
320 public: | 317 public: |
321 // New or deleted download, observers should query us for the current set | 318 // New or deleted download, observers should query us for the current set |
322 // of downloads. | 319 // of downloads. |
323 virtual void ModelChanged() = 0; | 320 virtual void ModelChanged() = 0; |
324 | 321 |
325 // A callback once the DownloadManager has retrieved the requested set of | 322 // A callback once the DownloadManager has retrieved the requested set of |
326 // downloads. The DownloadManagerObserver must copy the vector, but does not | 323 // downloads. The DownloadManagerObserver must copy the vector, but does not |
327 // own the individual DownloadItems, when this call is made. | 324 // own the individual DownloadItems, when this call is made. |
328 virtual void SetDownloads(std::vector<DownloadItem*>& downloads) = 0; | 325 virtual void SetDownloads(std::vector<DownloadItem*>& downloads) = 0; |
329 | |
330 protected: | |
331 ~Observer() {} | |
332 }; | 326 }; |
333 | 327 |
334 // Public API | 328 // Public API |
335 | 329 |
336 // Begin a search for all downloads matching 'search_text'. If 'search_text' | 330 // Begin a search for all downloads matching 'search_text'. If 'search_text' |
337 // is empty, return all known downloads. The results are returned in the | 331 // is empty, return all known downloads. The results are returned in the |
338 // 'SetDownloads' observer callback. | 332 // 'SetDownloads' observer callback. |
339 void GetDownloads(Observer* observer, | 333 void GetDownloads(Observer* observer, |
340 const std::wstring& search_text); | 334 const std::wstring& search_text); |
341 | 335 |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 PendingFinishedMap pending_finished_downloads_; | 614 PendingFinishedMap pending_finished_downloads_; |
621 | 615 |
622 // The "Save As" dialog box used to ask the user where a file should be | 616 // The "Save As" dialog box used to ask the user where a file should be |
623 // saved. | 617 // saved. |
624 scoped_refptr<SelectFileDialog> select_file_dialog_; | 618 scoped_refptr<SelectFileDialog> select_file_dialog_; |
625 | 619 |
626 DISALLOW_COPY_AND_ASSIGN(DownloadManager); | 620 DISALLOW_COPY_AND_ASSIGN(DownloadManager); |
627 }; | 621 }; |
628 | 622 |
629 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ | 623 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ |
OLD | NEW |