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

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

Issue 209613002: Download shelf autohides on showing in shell, just same as regular open Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Implement a separate callbacks flow for 'shown in shell' event to not mix with 'opened' Created 6 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 unified diff | Download patch
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 // Each download is represented by a DownloadItem, and all DownloadItems 5 // Each download is represented by a DownloadItem, and all DownloadItems
6 // are owned by the DownloadManager which maintains a global list of all 6 // are owned by the DownloadManager which maintains a global list of all
7 // downloads. DownloadItems are created when a user initiates a download, 7 // downloads. DownloadItems are created when a user initiates a download,
8 // and exist for the duration of the browser life time. 8 // and exist for the duration of the browser life time.
9 // 9 //
10 // Download observers: 10 // Download observers:
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 82
83 static const char kEmptyFileHash[]; 83 static const char kEmptyFileHash[];
84 84
85 // Interface that observers of a particular download must implement in order 85 // Interface that observers of a particular download must implement in order
86 // to receive updates to the download's status. 86 // to receive updates to the download's status.
87 class CONTENT_EXPORT Observer { 87 class CONTENT_EXPORT Observer {
88 public: 88 public:
89 virtual void OnDownloadUpdated(DownloadItem* download) {} 89 virtual void OnDownloadUpdated(DownloadItem* download) {}
90 virtual void OnDownloadOpened(DownloadItem* download) {} 90 virtual void OnDownloadOpened(DownloadItem* download) {}
91 virtual void OnDownloadRemoved(DownloadItem* download) {} 91 virtual void OnDownloadRemoved(DownloadItem* download) {}
92 virtual void OnDownloadShown(DownloadItem* download) {}
92 93
93 // Called when the download is being destroyed. This happens after 94 // Called when the download is being destroyed. This happens after
94 // every OnDownloadRemoved() as well as when the DownloadManager is going 95 // every OnDownloadRemoved() as well as when the DownloadManager is going
95 // down. 96 // down.
96 virtual void OnDownloadDestroyed(DownloadItem* download) {} 97 virtual void OnDownloadDestroyed(DownloadItem* download) {}
97 98
98 protected: 99 protected:
99 virtual ~Observer() {} 100 virtual ~Observer() {}
100 }; 101 };
101 102
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 294
294 // Returns true if the download will be auto-opened when complete. 295 // Returns true if the download will be auto-opened when complete.
295 virtual bool GetOpenWhenComplete() const = 0; 296 virtual bool GetOpenWhenComplete() const = 0;
296 297
297 // Returns true if the download has been auto-opened by the system. 298 // Returns true if the download has been auto-opened by the system.
298 virtual bool GetAutoOpened() = 0; 299 virtual bool GetAutoOpened() = 0;
299 300
300 // Returns true if the download has been opened. 301 // Returns true if the download has been opened.
301 virtual bool GetOpened() const = 0; 302 virtual bool GetOpened() const = 0;
302 303
304 // Returns true if the download has been shown after it has been completed.
305 virtual bool GetShownWhenComplete() const = 0;
306
303 // Misc State accessors --------------------------------------------------- 307 // Misc State accessors ---------------------------------------------------
304 308
305 virtual BrowserContext* GetBrowserContext() const = 0; 309 virtual BrowserContext* GetBrowserContext() const = 0;
306 virtual WebContents* GetWebContents() const = 0; 310 virtual WebContents* GetWebContents() const = 0;
307 311
308 // External state transitions/setters ---------------------------------------- 312 // External state transitions/setters ----------------------------------------
309 // TODO(rdsmith): These should all be removed; the download item should 313 // TODO(rdsmith): These should all be removed; the download item should
310 // control its own state transitions. 314 // control its own state transitions.
311 315
312 // Called if a check of the download contents was performed and the results of 316 // Called if a check of the download contents was performed and the results of
313 // the test are available. This should only be called after AllDataSaved() is 317 // the test are available. This should only be called after AllDataSaved() is
314 // true. 318 // true.
315 virtual void OnContentCheckCompleted(DownloadDangerType danger_type) = 0; 319 virtual void OnContentCheckCompleted(DownloadDangerType danger_type) = 0;
316 320
317 // Mark the download to be auto-opened when completed. 321 // Mark the download to be auto-opened when completed.
318 virtual void SetOpenWhenComplete(bool open) = 0; 322 virtual void SetOpenWhenComplete(bool open) = 0;
319 323
320 // Mark the download as temporary (not visible in persisted store or 324 // Mark the download as temporary (not visible in persisted store or
321 // SearchDownloads(), removed from main UI upon completion). 325 // SearchDownloads(), removed from main UI upon completion).
322 virtual void SetIsTemporary(bool temporary) = 0; 326 virtual void SetIsTemporary(bool temporary) = 0;
323 327
324 // Mark the download as having been opened (without actually opening it). 328 // Mark the download as having been opened (without actually opening it).
325 virtual void SetOpened(bool opened) = 0; 329 virtual void SetOpened(bool opened) = 0;
326 330
331 // Mark the download as having been shown (without actually showing it).
332 virtual void SetShownWhenComplete(bool shown) = 0;
asanka 2014/05/14 18:40:59 I'd like to get rid of both SetOpened() and SetSho
DukeXar 2014/06/06 15:07:14 Done.
333
327 // Set a display name for the download that will be independent of the target 334 // Set a display name for the download that will be independent of the target
328 // filename. If |name| is not empty, then GetFileNameToReportUser() will 335 // filename. If |name| is not empty, then GetFileNameToReportUser() will
329 // return |name|. Has no effect on the final target filename. 336 // return |name|. Has no effect on the final target filename.
330 virtual void SetDisplayName(const base::FilePath& name) = 0; 337 virtual void SetDisplayName(const base::FilePath& name) = 0;
331 338
332 // Debug/testing ------------------------------------------------------------- 339 // Debug/testing -------------------------------------------------------------
333 virtual std::string DebugString(bool verbose) const = 0; 340 virtual std::string DebugString(bool verbose) const = 0;
334 }; 341 };
335 342
336 } // namespace content 343 } // namespace content
337 344
338 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_ 345 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_ITEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698