Commit 79a2bd46 authored by David Black's avatar David Black Committed by Chromium LUCI CQ

Finish holding space view hierarchy refactor.

Finishes the holding space view hierarchy refactor by renaming:
- HoldingSpaceItemViewsContainer --> HoldingSpaceItemViewsSection
- PinnedFilesContainer --> PinnedFilesBubble
- RecentFilesContainer --> RecentFilesBubble

Bug: 1154998
Change-Id: I621a8c76daf142ced35503fe78801dbfd09d4570
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2587611
Commit-Queue: David Black <dmblack@google.com>
Reviewed-by: default avatarToni Baržić <tbarzic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836301}
parent f0e96fb4
......@@ -995,8 +995,8 @@ component("ash") {
"system/holding_space/holding_space_item_view.h",
"system/holding_space/holding_space_item_view_delegate.cc",
"system/holding_space/holding_space_item_view_delegate.h",
"system/holding_space/holding_space_item_views_container.cc",
"system/holding_space/holding_space_item_views_container.h",
"system/holding_space/holding_space_item_views_section.cc",
"system/holding_space/holding_space_item_views_section.h",
"system/holding_space/holding_space_tray.cc",
"system/holding_space/holding_space_tray.h",
"system/holding_space/holding_space_tray_bubble.cc",
......@@ -1007,12 +1007,12 @@ component("ash") {
"system/holding_space/holding_space_tray_icon.h",
"system/holding_space/holding_space_tray_icon_preview.cc",
"system/holding_space/holding_space_tray_icon_preview.h",
"system/holding_space/pinned_files_container.cc",
"system/holding_space/pinned_files_container.h",
"system/holding_space/pinned_files_bubble.cc",
"system/holding_space/pinned_files_bubble.h",
"system/holding_space/pinned_files_section.cc",
"system/holding_space/pinned_files_section.h",
"system/holding_space/recent_files_container.cc",
"system/holding_space/recent_files_container.h",
"system/holding_space/recent_files_bubble.cc",
"system/holding_space/recent_files_bubble.h",
"system/holding_space/screen_captures_section.cc",
"system/holding_space/screen_captures_section.h",
"system/ime/ime_feature_pod_controller.cc",
......
......@@ -12,10 +12,10 @@
namespace ash {
// Appearance.
constexpr int kHoldingSpaceBubbleContainerChildSpacing = 8;
constexpr int kHoldingSpaceBubbleWidth = 360;
constexpr gfx::Insets kHoldingSpaceContainerPadding(16);
constexpr int kHoldingSpaceContainerChildSpacing = 16;
constexpr int kHoldingSpaceContainerSpacing = 8;
constexpr gfx::Insets kHoldingSpaceChildBubblePadding(16);
constexpr int kHoldingSpaceChildBubbleChildSpacing = 16;
constexpr gfx::Insets kHoldingSpaceChipPadding(8);
constexpr int kHoldingSpaceChipChildSpacing = 8;
constexpr int kHoldingSpaceChipHeight = 40;
......@@ -37,6 +37,7 @@ constexpr gfx::Size kHoldingSpaceScreenCapturePlayIconSize(32, 32);
constexpr int kHoldingSpaceScreenCaptureSpacing = 8;
constexpr gfx::Size kHoldingSpaceScreenCaptureSize(104, 80);
constexpr gfx::Insets kHoldingSpaceScreenCapturesContainerPadding(8, 0);
constexpr int kHoldingSpaceSectionChildSpacing = 16;
constexpr float kHoldingSpaceSelectedOverlayOpacity = 0.24f;
constexpr int kHoldingSpaceTrayIconMaxVisiblePreviews = 3;
constexpr int kHoldingSpaceTrayIconSize = 20;
......@@ -53,8 +54,8 @@ enum HoldingSpaceCommandId {
};
// View IDs.
constexpr int kHoldingSpacePinnedFilesContainerId = 1;
constexpr int kHoldingSpaceRecentFilesContainerId = 2;
constexpr int kHoldingSpacePinnedFilesBubbleId = 1;
constexpr int kHoldingSpaceRecentFilesBubbleId = 2;
constexpr int kHoldingSpaceScreenCapturePlayIconId = 3;
constexpr int kHoldingSpaceTrayDefaultIconId = 4;
constexpr int kHoldingSpaceTrayPreviewsIconId = 5;
......
......@@ -69,11 +69,11 @@ class ASH_EXPORT HoldingSpaceTestApi {
// which displays previews of most recent items added to holding space.
views::View* GetPreviewsTrayIcon();
// Returns whether the pinned files container is shown.
bool PinnedFilesContainerShown() const;
// Returns whether the pinned files bubble is shown.
bool PinnedFilesBubbleShown() const;
// Returns whether the recent files container is shown.
bool RecentFilesContainerShown() const;
// Returns whether the recent files bubble is shown.
bool RecentFilesBubbleShown() const;
private:
HoldingSpaceTray* holding_space_tray_ = nullptr;
......
......@@ -76,11 +76,11 @@ class Header : public views::Button {
// DownloadsSection ------------------------------------------------------------
DownloadsSection::DownloadsSection(HoldingSpaceItemViewDelegate* delegate)
: HoldingSpaceItemViewsContainer(delegate,
/*supported_types=*/
{HoldingSpaceItem::Type::kDownload,
HoldingSpaceItem::Type::kNearbyShare},
/*max_count=*/kMaxDownloads) {}
: HoldingSpaceItemViewsSection(delegate,
/*supported_types=*/
{HoldingSpaceItem::Type::kDownload,
HoldingSpaceItem::Type::kNearbyShare},
/*max_count=*/kMaxDownloads) {}
DownloadsSection::~DownloadsSection() = default;
......
......@@ -7,19 +7,19 @@
#include <memory>
#include "ash/system/holding_space/holding_space_item_views_container.h"
#include "ash/system/holding_space/holding_space_item_views_section.h"
namespace ash {
// Section for downloads in the `RecentFilesContainer`.
class DownloadsSection : public HoldingSpaceItemViewsContainer {
// Section for downloads in the `RecentFilesBubble`.
class DownloadsSection : public HoldingSpaceItemViewsSection {
public:
explicit DownloadsSection(HoldingSpaceItemViewDelegate* delegate);
DownloadsSection(const DownloadsSection& other) = delete;
DownloadsSection& operator=(const DownloadsSection& other) = delete;
~DownloadsSection() override;
// HoldingSpaceItemViewsContainer:
// HoldingSpaceItemViewsSection:
const char* GetClassName() const override;
std::unique_ptr<views::View> CreateHeader() override;
std::unique_ptr<views::View> CreateContainer() override;
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/system/holding_space/holding_space_item_views_container.h"
#include "ash/system/holding_space/holding_space_item_views_section.h"
#include "ash/public/cpp/holding_space/holding_space_constants.h"
#include "ash/system/holding_space/holding_space_item_view.h"
......@@ -53,9 +53,9 @@ class HoldingSpaceScrollView : public views::ScrollView,
} // namespace
// HoldingSpaceItemViewsContainer ----------------------------------------------
// HoldingSpaceItemViewsSection ------------------------------------------------
HoldingSpaceItemViewsContainer::HoldingSpaceItemViewsContainer(
HoldingSpaceItemViewsSection::HoldingSpaceItemViewsSection(
HoldingSpaceItemViewDelegate* delegate,
std::vector<HoldingSpaceItem::Type> supported_types,
const base::Optional<size_t>& max_count)
......@@ -65,14 +65,14 @@ HoldingSpaceItemViewsContainer::HoldingSpaceItemViewsContainer(
controller_observer_.Observe(HoldingSpaceController::Get());
}
HoldingSpaceItemViewsContainer::~HoldingSpaceItemViewsContainer() = default;
HoldingSpaceItemViewsSection::~HoldingSpaceItemViewsSection() = default;
void HoldingSpaceItemViewsContainer::Init() {
void HoldingSpaceItemViewsSection::Init() {
SetVisible(false);
SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kVertical, gfx::Insets(),
kHoldingSpaceContainerChildSpacing));
kHoldingSpaceSectionChildSpacing));
// Header.
header_ = AddChildView(CreateHeader());
......@@ -111,18 +111,17 @@ void HoldingSpaceItemViewsContainer::Init() {
OnHoldingSpaceModelAttached(model);
}
void HoldingSpaceItemViewsContainer::Reset() {
void HoldingSpaceItemViewsSection::Reset() {
model_observer_.Reset();
controller_observer_.Reset();
}
void HoldingSpaceItemViewsContainer::ChildPreferredSizeChanged(
void HoldingSpaceItemViewsSection::ChildPreferredSizeChanged(
views::View* child) {
PreferredSizeChanged();
}
void HoldingSpaceItemViewsContainer::ChildVisibilityChanged(
views::View* child) {
void HoldingSpaceItemViewsSection::ChildVisibilityChanged(views::View* child) {
// This section should be visible iff it has visible children.
bool visible = false;
for (const views::View* c : children()) {
......@@ -138,7 +137,7 @@ void HoldingSpaceItemViewsContainer::ChildVisibilityChanged(
PreferredSizeChanged();
}
void HoldingSpaceItemViewsContainer::ViewHierarchyChanged(
void HoldingSpaceItemViewsSection::ViewHierarchyChanged(
const views::ViewHierarchyChangedDetails& details) {
if (details.parent != container_)
return;
......@@ -157,21 +156,21 @@ void HoldingSpaceItemViewsContainer::ViewHierarchyChanged(
placeholder_->SetVisible(!details.is_add);
}
void HoldingSpaceItemViewsContainer::OnHoldingSpaceModelAttached(
void HoldingSpaceItemViewsSection::OnHoldingSpaceModelAttached(
HoldingSpaceModel* model) {
model_observer_.Observe(model);
for (const auto& item : model->items())
OnHoldingSpaceItemAdded(item.get());
}
void HoldingSpaceItemViewsContainer::OnHoldingSpaceModelDetached(
void HoldingSpaceItemViewsSection::OnHoldingSpaceModelDetached(
HoldingSpaceModel* model) {
model_observer_.Reset();
if (!container_->children().empty())
MaybeAnimateOut();
}
void HoldingSpaceItemViewsContainer::OnHoldingSpaceItemAdded(
void HoldingSpaceItemViewsSection::OnHoldingSpaceItemAdded(
const HoldingSpaceItem* item) {
if (!item->IsFinalized())
return;
......@@ -179,24 +178,23 @@ void HoldingSpaceItemViewsContainer::OnHoldingSpaceItemAdded(
MaybeAnimateOut();
}
void HoldingSpaceItemViewsContainer::OnHoldingSpaceItemRemoved(
void HoldingSpaceItemViewsSection::OnHoldingSpaceItemRemoved(
const HoldingSpaceItem* item) {
if (base::Contains(views_by_item_id_, item->id()))
MaybeAnimateOut();
}
void HoldingSpaceItemViewsContainer::OnHoldingSpaceItemFinalized(
void HoldingSpaceItemViewsSection::OnHoldingSpaceItemFinalized(
const HoldingSpaceItem* item) {
if (base::Contains(supported_types_, item->type()))
MaybeAnimateOut();
}
std::unique_ptr<views::View>
HoldingSpaceItemViewsContainer::CreatePlaceholder() {
std::unique_ptr<views::View> HoldingSpaceItemViewsSection::CreatePlaceholder() {
return nullptr;
}
void HoldingSpaceItemViewsContainer::DestroyPlaceholder() {
void HoldingSpaceItemViewsSection::DestroyPlaceholder() {
if (!placeholder_)
return;
......@@ -209,7 +207,7 @@ void HoldingSpaceItemViewsContainer::DestroyPlaceholder() {
header_->SetVisible(false);
}
void HoldingSpaceItemViewsContainer::MaybeAnimateIn() {
void HoldingSpaceItemViewsSection::MaybeAnimateIn() {
if (animation_state_ & AnimationState::kAnimatingIn)
return;
......@@ -218,14 +216,14 @@ void HoldingSpaceItemViewsContainer::MaybeAnimateIn() {
// NOTE: `animate_in_observer` is deleted after `OnAnimateInCompleted()`.
ui::CallbackLayerAnimationObserver* animate_in_observer =
new ui::CallbackLayerAnimationObserver(base::BindRepeating(
&HoldingSpaceItemViewsContainer::OnAnimateInCompleted,
&HoldingSpaceItemViewsSection::OnAnimateInCompleted,
base::Unretained(this)));
AnimateIn(animate_in_observer);
animate_in_observer->SetActive();
}
void HoldingSpaceItemViewsContainer::MaybeAnimateOut() {
void HoldingSpaceItemViewsSection::MaybeAnimateOut() {
if (animation_state_ & AnimationState::kAnimatingOut)
return;
......@@ -239,7 +237,7 @@ void HoldingSpaceItemViewsContainer::MaybeAnimateOut() {
// NOTE: `animate_out_observer` is deleted after `OnAnimateOutCompleted()`.
ui::CallbackLayerAnimationObserver* animate_out_observer =
new ui::CallbackLayerAnimationObserver(base::BindRepeating(
&HoldingSpaceItemViewsContainer::OnAnimateOutCompleted,
&HoldingSpaceItemViewsSection::OnAnimateOutCompleted,
base::Unretained(this)));
AnimateOut(animate_out_observer);
......@@ -248,7 +246,7 @@ void HoldingSpaceItemViewsContainer::MaybeAnimateOut() {
// TODO(dmblack): Handle animate in of `placeholder_`.
// TODO(dmblack): Handle grow/shrink of container.
void HoldingSpaceItemViewsContainer::AnimateIn(
void HoldingSpaceItemViewsSection::AnimateIn(
ui::LayerAnimationObserver* observer) {
if (views_by_item_id_.empty() && placeholder_) {
DCHECK(!placeholder_->GetVisible());
......@@ -261,7 +259,7 @@ void HoldingSpaceItemViewsContainer::AnimateIn(
// TODO(dmblack): Handle animate out of `placeholder_`.
// TODO(dmblack): Handle animate out of `header_` if this section is leaving.
void HoldingSpaceItemViewsContainer::AnimateOut(
void HoldingSpaceItemViewsSection::AnimateOut(
ui::LayerAnimationObserver* observer) {
if (placeholder_ && placeholder_->GetVisible()) {
DCHECK(views_by_item_id_.empty());
......@@ -272,7 +270,7 @@ void HoldingSpaceItemViewsContainer::AnimateOut(
view_by_item_id.second->AnimateOut(observer);
}
bool HoldingSpaceItemViewsContainer::OnAnimateInCompleted(
bool HoldingSpaceItemViewsSection::OnAnimateInCompleted(
const ui::CallbackLayerAnimationObserver& observer) {
DCHECK(animation_state_ & AnimationState::kAnimatingIn);
animation_state_ &= ~AnimationState::kAnimatingIn;
......@@ -290,7 +288,7 @@ bool HoldingSpaceItemViewsContainer::OnAnimateInCompleted(
return kDeleteObserver;
}
bool HoldingSpaceItemViewsContainer::OnAnimateOutCompleted(
bool HoldingSpaceItemViewsSection::OnAnimateOutCompleted(
const ui::CallbackLayerAnimationObserver& observer) {
DCHECK(animation_state_ & AnimationState::kAnimatingOut);
animation_state_ &= ~AnimationState::kAnimatingOut;
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_SYSTEM_HOLDING_SPACE_HOLDING_SPACE_ITEM_VIEWS_CONTAINER_H_
#define ASH_SYSTEM_HOLDING_SPACE_HOLDING_SPACE_ITEM_VIEWS_CONTAINER_H_
#ifndef ASH_SYSTEM_HOLDING_SPACE_HOLDING_SPACE_ITEM_VIEWS_SECTION_H_
#define ASH_SYSTEM_HOLDING_SPACE_HOLDING_SPACE_ITEM_VIEWS_SECTION_H_
#include <map>
#include <memory>
......@@ -29,21 +29,20 @@ namespace ash {
class HoldingSpaceItemView;
class HoldingSpaceItemViewDelegate;
// TODO(dmblack): Rename to `HoldingSpaceItemViewsSection`.
// A section of holding space item views in a `HoldingSpaceTrayChildBubble`.
class HoldingSpaceItemViewsContainer : public views::View,
public HoldingSpaceControllerObserver,
public HoldingSpaceModelObserver {
class HoldingSpaceItemViewsSection : public views::View,
public HoldingSpaceControllerObserver,
public HoldingSpaceModelObserver {
public:
HoldingSpaceItemViewsContainer(
HoldingSpaceItemViewsSection(
HoldingSpaceItemViewDelegate* delegate,
std::vector<HoldingSpaceItem::Type> supported_types,
const base::Optional<size_t>& max_count);
HoldingSpaceItemViewsContainer(const HoldingSpaceItemViewsContainer& other) =
HoldingSpaceItemViewsSection(const HoldingSpaceItemViewsSection& other) =
delete;
HoldingSpaceItemViewsContainer& operator=(
const HoldingSpaceItemViewsContainer& other) = delete;
~HoldingSpaceItemViewsContainer() override;
HoldingSpaceItemViewsSection& operator=(
const HoldingSpaceItemViewsSection& other) = delete;
~HoldingSpaceItemViewsSection() override;
// Initializes the section.
void Init();
......@@ -143,4 +142,4 @@ class HoldingSpaceItemViewsContainer : public views::View,
} // namespace ash
#endif // ASH_SYSTEM_HOLDING_SPACE_HOLDING_SPACE_ITEM_VIEWS_CONTAINER_H_
#endif // ASH_SYSTEM_HOLDING_SPACE_HOLDING_SPACE_ITEM_VIEWS_SECTION_H_
......@@ -98,7 +98,7 @@ std::vector<views::View*> HoldingSpaceTestApi::GetDownloadChips() {
if (holding_space_tray_->GetBubbleView()) {
FindDescendentsOfClass<HoldingSpaceItemChipView>(
holding_space_tray_->GetBubbleView()->GetViewByID(
kHoldingSpaceRecentFilesContainerId),
kHoldingSpaceRecentFilesBubbleId),
&download_chips);
}
return download_chips;
......@@ -109,7 +109,7 @@ std::vector<views::View*> HoldingSpaceTestApi::GetPinnedFileChips() {
if (holding_space_tray_->GetBubbleView()) {
FindDescendentsOfClass<HoldingSpaceItemChipView>(
holding_space_tray_->GetBubbleView()->GetViewByID(
kHoldingSpacePinnedFilesContainerId),
kHoldingSpacePinnedFilesBubbleId),
&pinned_file_chips);
}
return pinned_file_chips;
......@@ -120,7 +120,7 @@ std::vector<views::View*> HoldingSpaceTestApi::GetScreenCaptureViews() {
if (holding_space_tray_->GetBubbleView()) {
FindDescendentsOfClass<HoldingSpaceItemScreenCaptureView>(
holding_space_tray_->GetBubbleView()->GetViewByID(
kHoldingSpaceRecentFilesContainerId),
kHoldingSpaceRecentFilesBubbleId),
&screen_capture_views);
}
return screen_capture_views;
......@@ -138,22 +138,22 @@ views::View* HoldingSpaceTestApi::GetPreviewsTrayIcon() {
return holding_space_tray_->GetViewByID(kHoldingSpaceTrayPreviewsIconId);
}
bool HoldingSpaceTestApi::PinnedFilesContainerShown() const {
bool HoldingSpaceTestApi::PinnedFilesBubbleShown() const {
if (!holding_space_tray_->GetBubbleView())
return false;
views::View* container = holding_space_tray_->GetBubbleView()->GetViewByID(
kHoldingSpacePinnedFilesContainerId);
return container && container->GetVisible();
views::View* bubble = holding_space_tray_->GetBubbleView()->GetViewByID(
kHoldingSpacePinnedFilesBubbleId);
return bubble && bubble->GetVisible();
}
bool HoldingSpaceTestApi::RecentFilesContainerShown() const {
bool HoldingSpaceTestApi::RecentFilesBubbleShown() const {
if (!holding_space_tray_->GetBubbleView())
return false;
views::View* container = holding_space_tray_->GetBubbleView()->GetViewByID(
kHoldingSpaceRecentFilesContainerId);
return container && container->GetVisible();
views::View* bubble = holding_space_tray_->GetBubbleView()->GetViewByID(
kHoldingSpaceRecentFilesBubbleId);
return bubble && bubble->GetVisible();
}
} // namespace ash
......@@ -15,8 +15,8 @@
#include "ash/shell.h"
#include "ash/system/holding_space/holding_space_item_view.h"
#include "ash/system/holding_space/holding_space_tray.h"
#include "ash/system/holding_space/pinned_files_container.h"
#include "ash/system/holding_space/recent_files_container.h"
#include "ash/system/holding_space/pinned_files_bubble.h"
#include "ash/system/holding_space/recent_files_bubble.h"
#include "ash/system/tray/tray_bubble_wrapper.h"
#include "ash/system/tray/tray_constants.h"
#include "ash/system/tray/tray_utils.h"
......@@ -59,7 +59,7 @@ class HoldingSpaceBubbleContainer : public views::View {
HoldingSpaceBubbleContainer() {
layout_ = SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kVertical, gfx::Insets(),
kHoldingSpaceContainerSpacing));
kHoldingSpaceBubbleContainerChildSpacing));
}
void SetFlexForChild(views::View* child, int flex) {
......@@ -112,12 +112,12 @@ HoldingSpaceTrayBubble::HoldingSpaceTrayBubble(
// Add pinned files child bubble.
child_bubbles_.push_back(bubble_container->AddChildView(
std::make_unique<PinnedFilesContainer>(&delegate_)));
std::make_unique<PinnedFilesBubble>(&delegate_)));
bubble_container->SetFlexForChild(child_bubbles_.back(), 1);
// Add recent files child bubble.
child_bubbles_.push_back(bubble_container->AddChildView(
std::make_unique<RecentFilesContainer>(&delegate_)));
std::make_unique<RecentFilesBubble>(&delegate_)));
// Initialize child bubbles.
for (HoldingSpaceTrayChildBubble* child_bubble : child_bubbles_)
......
......@@ -6,7 +6,7 @@
#include "ash/public/cpp/holding_space/holding_space_constants.h"
#include "ash/style/ash_color_provider.h"
#include "ash/system/holding_space/holding_space_item_views_container.h"
#include "ash/system/holding_space/holding_space_item_views_section.h"
#include "ash/system/tray/tray_constants.h"
#include "ui/views/layout/box_layout.h"
......@@ -20,8 +20,8 @@ HoldingSpaceTrayChildBubble::~HoldingSpaceTrayChildBubble() = default;
void HoldingSpaceTrayChildBubble::Init() {
SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kVertical, kHoldingSpaceContainerPadding,
kHoldingSpaceContainerChildSpacing));
views::BoxLayout::Orientation::kVertical, kHoldingSpaceChildBubblePadding,
kHoldingSpaceChildBubbleChildSpacing));
// Layer.
SetPaintToLayer(ui::LAYER_SOLID_COLOR);
......@@ -41,7 +41,7 @@ void HoldingSpaceTrayChildBubble::Init() {
}
void HoldingSpaceTrayChildBubble::Reset() {
for (HoldingSpaceItemViewsContainer* section : sections_)
for (HoldingSpaceItemViewsSection* section : sections_)
section->Reset();
}
......
......@@ -13,7 +13,7 @@
namespace ash {
class HoldingSpaceItemViewDelegate;
class HoldingSpaceItemViewsContainer;
class HoldingSpaceItemViewsSection;
// Child bubble of the `HoldingSpaceTrayBubble`.
class HoldingSpaceTrayChildBubble : public views::View {
......@@ -35,7 +35,7 @@ class HoldingSpaceTrayChildBubble : public views::View {
protected:
// Invoked to create the `sections_` for this child bubble.
virtual std::vector<std::unique_ptr<HoldingSpaceItemViewsContainer>>
virtual std::vector<std::unique_ptr<HoldingSpaceItemViewsSection>>
CreateSections() = 0;
HoldingSpaceItemViewDelegate* delegate() { return delegate_; }
......@@ -49,7 +49,7 @@ class HoldingSpaceTrayChildBubble : public views::View {
HoldingSpaceItemViewDelegate* const delegate_;
// Views owned by view hierarchy.
std::vector<HoldingSpaceItemViewsContainer*> sections_;
std::vector<HoldingSpaceItemViewsSection*> sections_;
};
} // namespace ash
......
......@@ -2,28 +2,27 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/system/holding_space/pinned_files_container.h"
#include "ash/system/holding_space/pinned_files_bubble.h"
#include "ash/public/cpp/holding_space/holding_space_constants.h"
#include "ash/system/holding_space/pinned_files_section.h"
namespace ash {
PinnedFilesContainer::PinnedFilesContainer(
HoldingSpaceItemViewDelegate* delegate)
PinnedFilesBubble::PinnedFilesBubble(HoldingSpaceItemViewDelegate* delegate)
: HoldingSpaceTrayChildBubble(delegate) {
SetID(kHoldingSpacePinnedFilesContainerId);
SetID(kHoldingSpacePinnedFilesBubbleId);
}
PinnedFilesContainer::~PinnedFilesContainer() = default;
PinnedFilesBubble::~PinnedFilesBubble() = default;
const char* PinnedFilesContainer::GetClassName() const {
return "PinnedFilesContainer";
const char* PinnedFilesBubble::GetClassName() const {
return "PinnedFilesBubble";
}
std::vector<std::unique_ptr<HoldingSpaceItemViewsContainer>>
PinnedFilesContainer::CreateSections() {
std::vector<std::unique_ptr<HoldingSpaceItemViewsContainer>> sections;
std::vector<std::unique_ptr<HoldingSpaceItemViewsSection>>
PinnedFilesBubble::CreateSections() {
std::vector<std::unique_ptr<HoldingSpaceItemViewsSection>> sections;
sections.push_back(std::make_unique<PinnedFilesSection>(delegate()));
return sections;
}
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_SYSTEM_HOLDING_SPACE_PINNED_FILES_CONTAINER_H_
#define ASH_SYSTEM_HOLDING_SPACE_PINNED_FILES_CONTAINER_H_
#ifndef ASH_SYSTEM_HOLDING_SPACE_PINNED_FILES_BUBBLE_H_
#define ASH_SYSTEM_HOLDING_SPACE_PINNED_FILES_BUBBLE_H_
#include <memory>
#include <vector>
......@@ -12,21 +12,20 @@
namespace ash {
// TODO(dmblack): Rename to `PinnedFilesBubble`.
// Child bubble of `HoldingSpaceTrayBubble` for pinned files.
class PinnedFilesContainer : public HoldingSpaceTrayChildBubble {
class PinnedFilesBubble : public HoldingSpaceTrayChildBubble {
public:
explicit PinnedFilesContainer(HoldingSpaceItemViewDelegate* delegate);
PinnedFilesContainer(const PinnedFilesContainer& other) = delete;
PinnedFilesContainer& operator=(const PinnedFilesContainer& other) = delete;
~PinnedFilesContainer() override;
explicit PinnedFilesBubble(HoldingSpaceItemViewDelegate* delegate);
PinnedFilesBubble(const PinnedFilesBubble& other) = delete;
PinnedFilesBubble& operator=(const PinnedFilesBubble& other) = delete;
~PinnedFilesBubble() override;
// HoldingSpaceTrayChildBubble:
const char* GetClassName() const override;
std::vector<std::unique_ptr<HoldingSpaceItemViewsContainer>> CreateSections()
std::vector<std::unique_ptr<HoldingSpaceItemViewsSection>> CreateSections()
override;
};
} // namespace ash
#endif // ASH_SYSTEM_HOLDING_SPACE_PINNED_FILES_CONTAINER_H_
#endif // ASH_SYSTEM_HOLDING_SPACE_PINNED_FILES_BUBBLE_H_
......@@ -40,10 +40,10 @@ bool HasEverPinnedHoldingSpaceItem() {
// PinnedFilesSection ----------------------------------------------------------
PinnedFilesSection::PinnedFilesSection(HoldingSpaceItemViewDelegate* delegate)
: HoldingSpaceItemViewsContainer(delegate,
/*supported_types=*/
{HoldingSpaceItem::Type::kPinnedFile},
/*max_count=*/base::nullopt) {}
: HoldingSpaceItemViewsSection(delegate,
/*supported_types=*/
{HoldingSpaceItem::Type::kPinnedFile},
/*max_count=*/base::nullopt) {}
PinnedFilesSection::~PinnedFilesSection() = default;
......
......@@ -7,19 +7,19 @@
#include <memory>
#include "ash/system/holding_space/holding_space_item_views_container.h"
#include "ash/system/holding_space/holding_space_item_views_section.h"
namespace ash {
// Section for pinned files in the `PinnedFilesContainer`.
class PinnedFilesSection : public HoldingSpaceItemViewsContainer {
// Section for pinned files in the `PinnedFilesBubble`.
class PinnedFilesSection : public HoldingSpaceItemViewsSection {
public:
explicit PinnedFilesSection(HoldingSpaceItemViewDelegate* delegate);
PinnedFilesSection(const PinnedFilesSection& other) = delete;
PinnedFilesSection& operator=(const PinnedFilesSection& other) = delete;
~PinnedFilesSection() override;
// HoldingSpaceItemViewsContainer:
// HoldingSpaceItemViewsSection:
const char* GetClassName() const override;
std::unique_ptr<views::View> CreateHeader() override;
std::unique_ptr<views::View> CreateContainer() override;
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/system/holding_space/recent_files_container.h"
#include "ash/system/holding_space/recent_files_bubble.h"
#include "ash/public/cpp/holding_space/holding_space_constants.h"
#include "ash/system/holding_space/downloads_section.h"
......@@ -10,21 +10,20 @@
namespace ash {
RecentFilesContainer::RecentFilesContainer(
HoldingSpaceItemViewDelegate* delegate)
RecentFilesBubble::RecentFilesBubble(HoldingSpaceItemViewDelegate* delegate)
: HoldingSpaceTrayChildBubble(delegate) {
SetID(kHoldingSpaceRecentFilesContainerId);
SetID(kHoldingSpaceRecentFilesBubbleId);
}
RecentFilesContainer::~RecentFilesContainer() = default;
RecentFilesBubble::~RecentFilesBubble() = default;
const char* RecentFilesContainer::GetClassName() const {
return "RecentFilesContainer";
const char* RecentFilesBubble::GetClassName() const {
return "RecentFilesBubble";
}
std::vector<std::unique_ptr<HoldingSpaceItemViewsContainer>>
RecentFilesContainer::CreateSections() {
std::vector<std::unique_ptr<HoldingSpaceItemViewsContainer>> sections;
std::vector<std::unique_ptr<HoldingSpaceItemViewsSection>>
RecentFilesBubble::CreateSections() {
std::vector<std::unique_ptr<HoldingSpaceItemViewsSection>> sections;
sections.push_back(std::make_unique<ScreenCapturesSection>(delegate()));
sections.push_back(std::make_unique<DownloadsSection>(delegate()));
return sections;
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_SYSTEM_HOLDING_SPACE_RECENT_FILES_CONTAINER_H_
#define ASH_SYSTEM_HOLDING_SPACE_RECENT_FILES_CONTAINER_H_
#ifndef ASH_SYSTEM_HOLDING_SPACE_RECENT_FILES_BUBBLE_H_
#define ASH_SYSTEM_HOLDING_SPACE_RECENT_FILES_BUBBLE_H_
#include <memory>
#include <vector>
......@@ -12,21 +12,20 @@
namespace ash {
// TODO(dmblack): Rename to `RecentFilesBubble`.
// Child bubble of `HoldingSpaceTrayBubble` for recent files.
class RecentFilesContainer : public HoldingSpaceTrayChildBubble {
class RecentFilesBubble : public HoldingSpaceTrayChildBubble {
public:
explicit RecentFilesContainer(HoldingSpaceItemViewDelegate* delegate);
RecentFilesContainer(const RecentFilesContainer& other) = delete;
RecentFilesContainer& operator=(const RecentFilesContainer& other) = delete;
~RecentFilesContainer() override;
explicit RecentFilesBubble(HoldingSpaceItemViewDelegate* delegate);
RecentFilesBubble(const RecentFilesBubble& other) = delete;
RecentFilesBubble& operator=(const RecentFilesBubble& other) = delete;
~RecentFilesBubble() override;
// HoldingSpaceTrayChildBubble:
const char* GetClassName() const override;
std::vector<std::unique_ptr<HoldingSpaceItemViewsContainer>> CreateSections()
std::vector<std::unique_ptr<HoldingSpaceItemViewsSection>> CreateSections()
override;
};
} // namespace ash
#endif // ASH_SYSTEM_HOLDING_SPACE_RECENT_FILES_CONTAINER_H_
#endif // ASH_SYSTEM_HOLDING_SPACE_RECENT_FILES_BUBBLE_H_
......@@ -21,11 +21,11 @@ namespace ash {
ScreenCapturesSection::ScreenCapturesSection(
HoldingSpaceItemViewDelegate* delegate)
: HoldingSpaceItemViewsContainer(delegate,
/*supported_types=*/
{HoldingSpaceItem::Type::kScreenshot,
HoldingSpaceItem::Type::kScreenRecording},
/*max_count=*/kMaxScreenCaptures) {}
: HoldingSpaceItemViewsSection(delegate,
/*supported_types=*/
{HoldingSpaceItem::Type::kScreenshot,
HoldingSpaceItem::Type::kScreenRecording},
/*max_count=*/kMaxScreenCaptures) {}
ScreenCapturesSection::~ScreenCapturesSection() = default;
......
......@@ -7,19 +7,19 @@
#include <memory>
#include "ash/system/holding_space/holding_space_item_views_container.h"
#include "ash/system/holding_space/holding_space_item_views_section.h"
namespace ash {
// Section for screen captures in the `RecentFilesContainer`.
class ScreenCapturesSection : public HoldingSpaceItemViewsContainer {
// Section for screen captures in the `RecentFilesBubble`.
class ScreenCapturesSection : public HoldingSpaceItemViewsSection {
public:
explicit ScreenCapturesSection(HoldingSpaceItemViewDelegate* delegate);
ScreenCapturesSection(const ScreenCapturesSection& other) = delete;
ScreenCapturesSection& operator=(const ScreenCapturesSection& other) = delete;
~ScreenCapturesSection() override;
// HoldingSpaceItemViewsContainer:
// HoldingSpaceItemViewsSection:
const char* GetClassName() const override;
std::unique_ptr<views::View> CreateHeader() override;
std::unique_ptr<views::View> CreateContainer() override;
......
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