| OLD | NEW |
| 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 #ifndef CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_SHELF_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_SHELF_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_SHELF_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_SHELF_VIEW_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "chrome/browser/download/download_shelf.h" | 14 #include "chrome/browser/download/download_shelf.h" |
| 15 #include "ui/gfx/animation/animation_delegate.h" | 15 #include "ui/gfx/animation/animation_delegate.h" |
| 16 #include "ui/gfx/animation/slide_animation.h" | 16 #include "ui/gfx/animation/slide_animation.h" |
| 17 #include "ui/views/accessible_pane_view.h" | 17 #include "ui/views/accessible_pane_view.h" |
| 18 #include "ui/views/controls/button/button.h" | 18 #include "ui/views/controls/button/vector_icon_button_delegate.h" |
| 19 #include "ui/views/controls/link_listener.h" | 19 #include "ui/views/controls/link_listener.h" |
| 20 #include "ui/views/mouse_watcher.h" | 20 #include "ui/views/mouse_watcher.h" |
| 21 | 21 |
| 22 class Browser; | 22 class Browser; |
| 23 class BrowserView; | 23 class BrowserView; |
| 24 | 24 |
| 25 namespace content { | 25 namespace content { |
| 26 class DownloadItem; | 26 class DownloadItem; |
| 27 class PageNavigator; | 27 class PageNavigator; |
| 28 } | 28 } |
| 29 | 29 |
| 30 namespace views { | 30 namespace views { |
| 31 class ImageButton; | 31 class ImageButton; |
| 32 class ImageView; | 32 class ImageView; |
| 33 class MdTextButton; | 33 class MdTextButton; |
| 34 } | 34 } |
| 35 | 35 |
| 36 // DownloadShelfView is a view that contains individual views for each download, | 36 // DownloadShelfView is a view that contains individual views for each download, |
| 37 // as well as a close button and a link to show all downloads. | 37 // as well as a close button and a link to show all downloads. |
| 38 // | 38 // |
| 39 // DownloadShelfView does not hold an infinite number of download views, rather | 39 // DownloadShelfView does not hold an infinite number of download views, rather |
| 40 // it'll automatically remove views once a certain point is reached. | 40 // it'll automatically remove views once a certain point is reached. |
| 41 class DownloadShelfView : public views::AccessiblePaneView, | 41 class DownloadShelfView : public views::AccessiblePaneView, |
| 42 public gfx::AnimationDelegate, | 42 public gfx::AnimationDelegate, |
| 43 public DownloadShelf, | 43 public DownloadShelf, |
| 44 public views::ButtonListener, | 44 public views::VectorIconButtonDelegate, |
| 45 public views::LinkListener, | 45 public views::LinkListener, |
| 46 public views::MouseWatcherListener { | 46 public views::MouseWatcherListener { |
| 47 public: | 47 public: |
| 48 DownloadShelfView(Browser* browser, BrowserView* parent); | 48 DownloadShelfView(Browser* browser, BrowserView* parent); |
| 49 ~DownloadShelfView() override; | 49 ~DownloadShelfView() override; |
| 50 | 50 |
| 51 // Sent from the DownloadItemView when the user opens an item. | 51 // Sent from the DownloadItemView when the user opens an item. |
| 52 void OpenedDownload(); | 52 void OpenedDownload(); |
| 53 | 53 |
| 54 // Returns the relevant containing object that can load pages. | 54 // Returns the relevant containing object that can load pages. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 65 const ViewHierarchyChangedDetails& details) override; | 65 const ViewHierarchyChangedDetails& details) override; |
| 66 | 66 |
| 67 // Implementation of gfx::AnimationDelegate. | 67 // Implementation of gfx::AnimationDelegate. |
| 68 void AnimationProgressed(const gfx::Animation* animation) override; | 68 void AnimationProgressed(const gfx::Animation* animation) override; |
| 69 void AnimationEnded(const gfx::Animation* animation) override; | 69 void AnimationEnded(const gfx::Animation* animation) override; |
| 70 | 70 |
| 71 // Implementation of views::LinkListener. | 71 // Implementation of views::LinkListener. |
| 72 // Invoked when the user clicks the 'show all downloads' link button. | 72 // Invoked when the user clicks the 'show all downloads' link button. |
| 73 void LinkClicked(views::Link* source, int event_flags) override; | 73 void LinkClicked(views::Link* source, int event_flags) override; |
| 74 | 74 |
| 75 // Implementation of ButtonListener. | 75 // Implementation of VectorIconButtonDelegate. |
| 76 // Invoked when the user clicks the close button. Asks the browser to | 76 // Invoked when the user clicks the close button. Asks the browser to |
| 77 // hide the download shelf. | 77 // hide the download shelf. |
| 78 void ButtonPressed(views::Button* button, const ui::Event& event) override; | 78 void ButtonPressed(views::Button* button, const ui::Event& event) override; |
| 79 SkColor GetVectorIconBaseColor() const override; |
| 79 | 80 |
| 80 // Implementation of DownloadShelf. | 81 // Implementation of DownloadShelf. |
| 81 bool IsShowing() const override; | 82 bool IsShowing() const override; |
| 82 bool IsClosing() const override; | 83 bool IsClosing() const override; |
| 83 Browser* browser() const override; | 84 Browser* browser() const override; |
| 84 | 85 |
| 85 // Implementation of MouseWatcherListener override. | 86 // Implementation of MouseWatcherListener override. |
| 86 void MouseMovedOutOfHost() override; | 87 void MouseMovedOutOfHost() override; |
| 87 | 88 |
| 88 // Removes a specified download view. The supplied view is deleted after | 89 // Removes a specified download view. The supplied view is deleted after |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 | 160 |
| 160 // The window this shelf belongs to. | 161 // The window this shelf belongs to. |
| 161 BrowserView* parent_; | 162 BrowserView* parent_; |
| 162 | 163 |
| 163 views::MouseWatcher mouse_watcher_; | 164 views::MouseWatcher mouse_watcher_; |
| 164 | 165 |
| 165 DISALLOW_COPY_AND_ASSIGN(DownloadShelfView); | 166 DISALLOW_COPY_AND_ASSIGN(DownloadShelfView); |
| 166 }; | 167 }; |
| 167 | 168 |
| 168 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_SHELF_VIEW_H_ | 169 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_SHELF_VIEW_H_ |
| OLD | NEW |