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

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. Useful methods on the item that are
83 // guaranteed to work as advertised include GetId(), AddObserver(),
84 // SetExternalData(), GetURL(). The item is guaranteed to be accessible via
85 // DownloadManager::GetDownload(). No other guarantees are made about its
86 // state: it may have just been loaded from history, it may be an active
87 // download, or it may be a SavePage download, it may or may not already be
88 // persisted. If a consumer needs a DownloadItem's filename, it should wait
89 // for an OnDownloadUpdated() when the filename is not empty(). When the
90 // history is loaded on startup, this method may be called many (thousands)
91 // of times at once.
Randy Smith (Not in Mondays) 2012/07/23 18:40:50 Can you shorten this a bit? I think we're ok just
benjhayden 2012/07/23 18:54:22 Please just give me a string to copy-paste into he
Randy Smith (Not in Mondays) 2012/07/23 19:00:06 Sure, though please confirm with Asanka that what
benjhayden 2012/07/25 16:24:38 Done.
92 virtual void OnDownloadCreated(
93 DownloadManager* manager, DownloadItem* item) {}
94
82 // New or deleted download, observers should query us for the current set 95 // New or deleted download, observers should query us for the current set
83 // of downloads. 96 // of downloads.
84 virtual void ModelChanged(DownloadManager* manager) = 0; 97 virtual void ModelChanged(DownloadManager* manager) {}
85 98
86 // Called when the DownloadManager is being destroyed to prevent Observers 99 // Called when the DownloadManager is being destroyed to prevent Observers
87 // from calling back to a stale pointer. 100 // from calling back to a stale pointer.
88 virtual void ManagerGoingDown(DownloadManager* manager) {} 101 virtual void ManagerGoingDown(DownloadManager* manager) {}
89 102
90 // Called immediately after the DownloadManager puts up a select file 103 // Called immediately after the DownloadManager puts up a select file
91 // dialog. 104 // dialog.
92 // |id| indicates which download opened the dialog. 105 // |id| indicates which download opened the dialog.
93 virtual void SelectFileDialogDisplayed( 106 virtual void SelectFileDialogDisplayed(
94 DownloadManager* manager, int32 id) {} 107 DownloadManager* manager, int32 id) {}
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 protected: 244 protected:
232 virtual ~DownloadManager() {} 245 virtual ~DownloadManager() {}
233 246
234 private: 247 private:
235 friend class base::RefCountedThreadSafe<DownloadManager>; 248 friend class base::RefCountedThreadSafe<DownloadManager>;
236 }; 249 };
237 250
238 } // namespace content 251 } // namespace content
239 252
240 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_ 253 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698