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

Side by Side Diff: content/public/browser/download_manager.h

Issue 10735089: DownloadManager::Observer::OnDownloadCreated (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 browser context in Chrome. 8 // active browser context in Chrome.
9 // 9 //
10 // Download observers: 10 // Download observers:
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 // Shutdown the download manager. Content calls this when BrowserContext is 72 // Shutdown the download manager. Content calls this when BrowserContext is
73 // being destructed. If the embedder needs this to be called earlier, it can 73 // being destructed. If the embedder needs this to be called earlier, it can
74 // call it. In that case, the delegate's Shutdown() method will only be called 74 // call it. In that case, the delegate's Shutdown() method will only be called
75 // once. 75 // once.
76 virtual void Shutdown() = 0; 76 virtual void Shutdown() = 0;
77 77
78 // Interface to implement for observers that wish to be informed of changes 78 // Interface to implement for observers that wish to be informed of changes
79 // to the DownloadManager's collection of downloads. 79 // to the DownloadManager's collection of downloads.
80 class CONTENT_EXPORT Observer { 80 class CONTENT_EXPORT Observer {
81 public: 81 public:
82 // A DownloadItem was created. Unlike ModelChanged, this item may be
83 // visible before the filename is determined; in this case the return value
84 // of GetTargetFileName() will be null. This method may be called an
85 // arbitrary number of times, e.g. when loading history on startup. As a
86 // result, consumers should avoid doing large amounts of work in
87 // OnDownloadCreated(). TODO(<whoever>): When we've fully specified the
88 // possible states of the DownloadItem in download_item.h and removed
89 // ModelChanged, we should remove the caveat above.
90 virtual void OnDownloadCreated(
91 DownloadManager* manager, DownloadItem* item) {}
92
82 // New or deleted download, observers should query us for the current set 93 // New or deleted download, observers should query us for the current set
83 // of downloads. 94 // of downloads.
84 virtual void ModelChanged(DownloadManager* manager) = 0; 95 virtual void ModelChanged(DownloadManager* manager) {}
85 96
86 // Called when the DownloadManager is being destroyed to prevent Observers 97 // Called when the DownloadManager is being destroyed to prevent Observers
87 // from calling back to a stale pointer. 98 // from calling back to a stale pointer.
88 virtual void ManagerGoingDown(DownloadManager* manager) {} 99 virtual void ManagerGoingDown(DownloadManager* manager) {}
89 100
90 // Called immediately after the DownloadManager puts up a select file 101 // Called immediately after the DownloadManager puts up a select file
91 // dialog. 102 // dialog.
92 // |id| indicates which download opened the dialog. 103 // |id| indicates which download opened the dialog.
93 virtual void SelectFileDialogDisplayed( 104 virtual void SelectFileDialogDisplayed(
94 DownloadManager* manager, int32 id) {} 105 DownloadManager* manager, int32 id) {}
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 protected: 242 protected:
232 virtual ~DownloadManager() {} 243 virtual ~DownloadManager() {}
233 244
234 private: 245 private:
235 friend class base::RefCountedThreadSafe<DownloadManager>; 246 friend class base::RefCountedThreadSafe<DownloadManager>;
236 }; 247 };
237 248
238 } // namespace content 249 } // namespace content
239 250
240 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_ 251 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698