Commit 0eab382a authored by Ahmed Mehfooz's avatar Ahmed Mehfooz Committed by Commit Bot

Add recent downloads to the holding space bubble

Bug: 1124161
Change-Id: I436e37dd4c40ef60558bdbdf01cd72977ecd99db
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2389640
Commit-Queue: Ahmed Mehfooz <amehfooz@chromium.org>
Reviewed-by: default avatarDavid Black <dmblack@google.com>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#804599}
parent 0d0e5bba
...@@ -35,6 +35,9 @@ PinnedFilesContainer::PinnedFilesContainer() { ...@@ -35,6 +35,9 @@ PinnedFilesContainer::PinnedFilesContainer() {
item_chips_container_ = item_chips_container_ =
AddChildView(std::make_unique<HoldingSpaceItemChipsContainer>()); AddChildView(std::make_unique<HoldingSpaceItemChipsContainer>());
// TODO(crbug.com/1125254): Populate containers if and when holding space
// model is attached, below is a temporary solution.
for (const auto& item : HoldingSpaceController::Get()->model()->items()) { for (const auto& item : HoldingSpaceController::Get()->model()->items()) {
if (item->type() == HoldingSpaceItem::Type::kPinnedFile) if (item->type() == HoldingSpaceItem::Type::kPinnedFile)
item_chips_container_->AddItemChip(item.get()); item_chips_container_->AddItemChip(item.get());
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "ash/public/cpp/holding_space/holding_space_item.h" #include "ash/public/cpp/holding_space/holding_space_item.h"
#include "ash/public/cpp/holding_space/holding_space_model.h" #include "ash/public/cpp/holding_space/holding_space_model.h"
#include "ash/strings/grit/ash_strings.h" #include "ash/strings/grit/ash_strings.h"
#include "ash/system/holding_space/holding_space_item_chips_container.h"
#include "ash/system/holding_space/holding_space_screenshot_view.h" #include "ash/system/holding_space/holding_space_screenshot_view.h"
#include "ash/system/tray/tray_constants.h" #include "ash/system/tray/tray_constants.h"
#include "ash/system/tray/tray_popup_item_style.h" #include "ash/system/tray/tray_popup_item_style.h"
...@@ -39,8 +40,8 @@ RecentFilesContainer::RecentFilesContainer() { ...@@ -39,8 +40,8 @@ RecentFilesContainer::RecentFilesContainer() {
views::BoxLayout::Orientation::kHorizontal, gfx::Insets(16, 0, 24, 0), views::BoxLayout::Orientation::kHorizontal, gfx::Insets(16, 0, 24, 0),
8)); 8));
// TODO(amehfooz): Populate containers if and when holding space model is // TODO(crbug.com/1125254): Populate containers if and when holding space
// attached, below is a temporary solution. // model is attached, below is a temporary solution.
for (const auto& item : HoldingSpaceController::Get()->model()->items()) { for (const auto& item : HoldingSpaceController::Get()->model()->items()) {
if (item->type() == HoldingSpaceItem::Type::kScreenshot) { if (item->type() == HoldingSpaceItem::Type::kScreenshot) {
screenshots_container_->AddChildView( screenshots_container_->AddChildView(
...@@ -53,9 +54,14 @@ RecentFilesContainer::RecentFilesContainer() { ...@@ -53,9 +54,14 @@ RecentFilesContainer::RecentFilesContainer() {
setup_layered_child(recent_downloads_label); setup_layered_child(recent_downloads_label);
style.SetupLabel(recent_downloads_label); style.SetupLabel(recent_downloads_label);
auto* recent_downloads_separator = recent_downloads_container_ =
AddChildView(std::make_unique<views::Separator>()); AddChildView(std::make_unique<HoldingSpaceItemChipsContainer>());
recent_downloads_separator->SetBorder(views::CreateEmptyBorder(48, 0, 0, 0)); // TODO(crbug.com/1125254): Populate containers if and when holding space
// model is attached, below is a temporary solution.
for (const auto& item : HoldingSpaceController::Get()->model()->items()) {
if (item->type() == HoldingSpaceItem::Type::kDownload)
recent_downloads_container_->AddItemChip(item.get());
}
} }
RecentFilesContainer::~RecentFilesContainer() = default; RecentFilesContainer::~RecentFilesContainer() = default;
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
namespace ash { namespace ash {
class HoldingSpaceItemChipsContainer;
// Container for the recent files (Screenshots, downloads etc). // Container for the recent files (Screenshots, downloads etc).
class RecentFilesContainer : public views::View { class RecentFilesContainer : public views::View {
public: public:
...@@ -22,6 +24,7 @@ class RecentFilesContainer : public views::View { ...@@ -22,6 +24,7 @@ class RecentFilesContainer : public views::View {
private: private:
views::View* screenshots_container_ = nullptr; views::View* screenshots_container_ = nullptr;
HoldingSpaceItemChipsContainer* recent_downloads_container_ = nullptr;
}; };
} // namespace ash } // namespace ash
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment