| 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 #include "chrome/browser/ui/views/download/download_shelf_view.h" | 5 #include "chrome/browser/ui/views/download/download_shelf_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "chrome/grit/theme_resources.h" | 23 #include "chrome/grit/theme_resources.h" |
| 24 #include "components/strings/grit/components_strings.h" | 24 #include "components/strings/grit/components_strings.h" |
| 25 #include "content/public/browser/download_item.h" | 25 #include "content/public/browser/download_item.h" |
| 26 #include "content/public/browser/download_manager.h" | 26 #include "content/public/browser/download_manager.h" |
| 27 #include "content/public/browser/page_navigator.h" | 27 #include "content/public/browser/page_navigator.h" |
| 28 #include "ui/base/l10n/l10n_util.h" | 28 #include "ui/base/l10n/l10n_util.h" |
| 29 #include "ui/base/resource/resource_bundle.h" | 29 #include "ui/base/resource/resource_bundle.h" |
| 30 #include "ui/base/theme_provider.h" | 30 #include "ui/base/theme_provider.h" |
| 31 #include "ui/gfx/animation/slide_animation.h" | 31 #include "ui/gfx/animation/slide_animation.h" |
| 32 #include "ui/gfx/canvas.h" | 32 #include "ui/gfx/canvas.h" |
| 33 #include "ui/gfx/vector_icons_public.h" | |
| 34 #include "ui/resources/grit/ui_resources.h" | 33 #include "ui/resources/grit/ui_resources.h" |
| 34 #include "ui/vector_icons/vector_icons.h" |
| 35 #include "ui/views/background.h" | 35 #include "ui/views/background.h" |
| 36 #include "ui/views/border.h" | 36 #include "ui/views/border.h" |
| 37 #include "ui/views/controls/button/md_text_button.h" | 37 #include "ui/views/controls/button/md_text_button.h" |
| 38 #include "ui/views/controls/button/vector_icon_button.h" | 38 #include "ui/views/controls/button/vector_icon_button.h" |
| 39 #include "ui/views/controls/link.h" | 39 #include "ui/views/controls/link.h" |
| 40 #include "ui/views/mouse_watcher_view_host.h" | 40 #include "ui/views/mouse_watcher_view_host.h" |
| 41 | 41 |
| 42 using content::DownloadItem; | 42 using content::DownloadItem; |
| 43 | 43 |
| 44 namespace { | 44 namespace { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 mouse_watcher_.set_notify_on_exit_time( | 106 mouse_watcher_.set_notify_on_exit_time( |
| 107 base::TimeDelta::FromMilliseconds(kNotifyOnExitTimeMS)); | 107 base::TimeDelta::FromMilliseconds(kNotifyOnExitTimeMS)); |
| 108 set_id(VIEW_ID_DOWNLOAD_SHELF); | 108 set_id(VIEW_ID_DOWNLOAD_SHELF); |
| 109 parent->AddChildView(this); | 109 parent->AddChildView(this); |
| 110 | 110 |
| 111 show_all_view_ = views::MdTextButton::Create( | 111 show_all_view_ = views::MdTextButton::Create( |
| 112 this, l10n_util::GetStringUTF16(IDS_SHOW_ALL_DOWNLOADS)); | 112 this, l10n_util::GetStringUTF16(IDS_SHOW_ALL_DOWNLOADS)); |
| 113 AddChildView(show_all_view_); | 113 AddChildView(show_all_view_); |
| 114 | 114 |
| 115 views::VectorIconButton* close_button = new views::VectorIconButton(this); | 115 views::VectorIconButton* close_button = new views::VectorIconButton(this); |
| 116 close_button->SetIcon(gfx::VectorIconId::BAR_CLOSE); | 116 close_button->SetIcon(ui::kCloseIcon); |
| 117 close_button_ = close_button; | 117 close_button_ = close_button; |
| 118 close_button_->SetAccessibleName( | 118 close_button_->SetAccessibleName( |
| 119 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); | 119 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); |
| 120 AddChildView(close_button_); | 120 AddChildView(close_button_); |
| 121 | 121 |
| 122 new_item_animation_.SetSlideDuration(kNewItemAnimationDurationMs); | 122 new_item_animation_.SetSlideDuration(kNewItemAnimationDurationMs); |
| 123 shelf_animation_.SetSlideDuration(kShelfAnimationDurationMs); | 123 shelf_animation_.SetSlideDuration(kShelfAnimationDurationMs); |
| 124 } | 124 } |
| 125 | 125 |
| 126 DownloadShelfView::~DownloadShelfView() { | 126 DownloadShelfView::~DownloadShelfView() { |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 SetVisible(false); | 413 SetVisible(false); |
| 414 } | 414 } |
| 415 | 415 |
| 416 bool DownloadShelfView::CanAutoClose() { | 416 bool DownloadShelfView::CanAutoClose() { |
| 417 for (size_t i = 0; i < download_views_.size(); ++i) { | 417 for (size_t i = 0; i < download_views_.size(); ++i) { |
| 418 if (!download_views_[i]->download()->GetOpened()) | 418 if (!download_views_[i]->download()->GetOpened()) |
| 419 return false; | 419 return false; |
| 420 } | 420 } |
| 421 return true; | 421 return true; |
| 422 } | 422 } |
| OLD | NEW |