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

Side by Side Diff: chrome/browser/download/download_shelf.h

Issue 115740: Move download shelf from per-tab to per-window (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 6 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
« no previous file with comments | « chrome/browser/download/download_file.cc ('k') | chrome/browser/download/download_shelf.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SHELF_H_ 5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SHELF_H_
6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SHELF_H_ 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SHELF_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/logging.h"
10 #include "base/basictypes.h" 11 #include "base/basictypes.h"
11 12
12 class BaseDownloadItemModel; 13 class BaseDownloadItemModel;
14 class Browser;
13 class DownloadItem; 15 class DownloadItem;
14 class TabContents;
15 16
16 // DownloadShelf is an interface for platform-specific download shelves to 17 // DownloadShelf is an interface for platform-specific download shelves to
17 // implement. It also contains some shared logic. This class should not be 18 // implement. It also contains some shared logic. This class should not be
18 // instantiated directly, but rather created via a call to Create(). 19 // instantiated directly, but rather created via a call to Create().
20 // It is a view object.
19 class DownloadShelf { 21 class DownloadShelf {
20 public: 22 public:
21 explicit DownloadShelf(TabContents* tab_contents) 23 explicit DownloadShelf(Browser* browser)
22 : tab_contents_(tab_contents) { } 24 : browser_(browser) { DCHECK(browser_); }
23 25
24 virtual ~DownloadShelf() { } 26 virtual ~DownloadShelf() { }
25 27
26 // Creates a platform-specific DownloadShelf, passing ownership to the caller.
27 static DownloadShelf* Create(TabContents* tab_contents);
28
29 // A new download has started, so add it to our shelf. This object will 28 // A new download has started, so add it to our shelf. This object will
30 // take ownership of |download_model|. 29 // take ownership of |download_model|. Also make the shelf visible.
31 virtual void AddDownload(BaseDownloadItemModel* download_model) = 0; 30 virtual void AddDownload(BaseDownloadItemModel* download_model) = 0;
32 31
33 // Invoked when the user clicks the 'show all downloads' link button. 32 // Invoked when the user clicks the 'show all downloads' link button.
34 void ShowAllDownloads(); 33 void ShowAllDownloads();
35 34
36 // Invoked when the download shelf is migrated from one tab contents to a new
37 // one.
38 void ChangeTabContents(TabContents* old_contents, TabContents* new_contents);
39
40 // The browser view needs to know when we are going away to properly return 35 // The browser view needs to know when we are going away to properly return
41 // the resize corner size to WebKit so that we don't draw on top of it. 36 // the resize corner size to WebKit so that we don't draw on top of it.
42 // This returns the showing state of our animation which is set to false at 37 // This returns the showing state of our animation which is set to true at
43 // the beginning Show and true at the beginning of a Hide. 38 // the beginning Show and false at the beginning of a Hide.
44 virtual bool IsShowing() const = 0; 39 virtual bool IsShowing() const = 0;
45 40
46 // Returns whether the download shelf is showing the close animation. 41 // Returns whether the download shelf is showing the close animation.
47 virtual bool IsClosing() const = 0; 42 virtual bool IsClosing() const = 0;
48 43
44 // Opens the shelf.
45 virtual void Show() = 0;
46
47 // Closes the shelf.
48 virtual void Close() = 0;
49
49 protected: 50 protected:
50 TabContents* tab_contents_; 51 Browser* browser_;
51 52
52 private: 53 private:
53 DISALLOW_COPY_AND_ASSIGN(DownloadShelf); 54 DISALLOW_COPY_AND_ASSIGN(DownloadShelf);
54 }; 55 };
55 56
56 // Logic for the download shelf context menu. Platform specific subclasses are 57 // Logic for the download shelf context menu. Platform specific subclasses are
57 // responsible for creating and running the menu. 58 // responsible for creating and running the menu.
58 class DownloadShelfContextMenu { 59 class DownloadShelfContextMenu {
59 public: 60 public:
60 virtual ~DownloadShelfContextMenu(); 61 virtual ~DownloadShelfContextMenu();
(...skipping 20 matching lines...) Expand all
81 DownloadItem* download_; 82 DownloadItem* download_;
82 83
83 // A model to control the cancel behavior. 84 // A model to control the cancel behavior.
84 BaseDownloadItemModel* model_; 85 BaseDownloadItemModel* model_;
85 86
86 private: 87 private:
87 DISALLOW_COPY_AND_ASSIGN(DownloadShelfContextMenu); 88 DISALLOW_COPY_AND_ASSIGN(DownloadShelfContextMenu);
88 }; 89 };
89 90
90 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SHELF_H_ 91 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SHELF_H_
OLDNEW
« no previous file with comments | « chrome/browser/download/download_file.cc ('k') | chrome/browser/download/download_shelf.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698