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
......
......@@ -159,17 +159,17 @@ TEST_P(HoldingSpaceTrayTest, ShowTrayButtonOnFirstUse) {
MarkTimeOfFirstAdd();
EXPECT_TRUE(test_api()->IsShowingInShelf());
// Show the bubble - both the pinned container and recent files container
// Show the bubble - both the pinned files and recent files child bubbles
// should be shown.
test_api()->Show();
EXPECT_TRUE(test_api()->PinnedFilesContainerShown());
EXPECT_TRUE(test_api()->RecentFilesContainerShown());
EXPECT_TRUE(test_api()->PinnedFilesBubbleShown());
EXPECT_TRUE(test_api()->RecentFilesBubbleShown());
// Remove the download item and verify the pinned files container, and the
// Remove the download item and verify the pinned files bubble, and the
// tray button are still shown.
model()->RemoveItem(item->id());
EXPECT_TRUE(test_api()->PinnedFilesContainerShown());
EXPECT_FALSE(test_api()->RecentFilesContainerShown());
EXPECT_TRUE(test_api()->PinnedFilesBubbleShown());
EXPECT_FALSE(test_api()->RecentFilesBubbleShown());
test_api()->Close();
EXPECT_TRUE(test_api()->IsShowingInShelf());
......@@ -182,8 +182,8 @@ TEST_P(HoldingSpaceTrayTest, ShowTrayButtonOnFirstUse) {
MarkTimeOfFirstPin();
model()->RemoveItem(pinned_item->id());
// Verify that the pinned files container, and the tray button get hidden.
EXPECT_FALSE(test_api()->PinnedFilesContainerShown());
// Verify that the pinned files bubble, and the tray button get hidden.
EXPECT_FALSE(test_api()->PinnedFilesBubbleShown());
test_api()->Close();
EXPECT_FALSE(test_api()->IsShowingInShelf());
}
......@@ -254,22 +254,22 @@ TEST_P(HoldingSpaceTrayTest, TrayButtonNotShownForPartialItemsOnly) {
}
// Tests how download chips are updated during item addition, removal and
// finalization
TEST_P(HoldingSpaceTrayTest, DownloadsContainer) {
// finalization.
TEST_P(HoldingSpaceTrayTest, DownloadsSection) {
StartSession();
test_api()->Show();
EXPECT_TRUE(test_api()->PinnedFilesContainerShown());
EXPECT_FALSE(test_api()->RecentFilesContainerShown());
EXPECT_TRUE(test_api()->PinnedFilesBubbleShown());
EXPECT_FALSE(test_api()->RecentFilesBubbleShown());
EXPECT_TRUE(test_api()->GetPinnedFileChips().empty());
// Add a download item and verify recent file container gets shown.
// Add a download item and verify recent file bubble gets shown.
HoldingSpaceItem* item_1 =
AddItem(HoldingSpaceItem::Type::kDownload, base::FilePath("/tmp/fake_1"));
EXPECT_TRUE(test_api()->PinnedFilesContainerShown());
EXPECT_TRUE(test_api()->RecentFilesContainerShown());
EXPECT_TRUE(test_api()->PinnedFilesBubbleShown());
EXPECT_TRUE(test_api()->RecentFilesBubbleShown());
EXPECT_TRUE(test_api()->GetPinnedFileChips().empty());
EXPECT_TRUE(test_api()->GetScreenCaptureViews().empty());
......@@ -301,7 +301,7 @@ TEST_P(HoldingSpaceTrayTest, DownloadsContainer) {
HoldingSpaceItemView::Cast(download_chips[1])->item()->id());
// Finalize partially initialized item, and verify it gets added to the
// container, in the order of addition, replacing the oldest item.
// section, in the order of addition, replacing the oldest item.
model()->FinalizeOrRemoveItem(item_2->id(), GURL("filesystem:fake_2"));
EXPECT_TRUE(test_api()->GetPinnedFileChips().empty());
......@@ -313,7 +313,7 @@ TEST_P(HoldingSpaceTrayTest, DownloadsContainer) {
EXPECT_EQ(item_2->id(),
HoldingSpaceItemView::Cast(download_chips[1])->item()->id());
// Remove the newest item, and verify the container gets updated.
// Remove the newest item, and verify the section gets updated.
model()->RemoveItem(item_3->id());
EXPECT_TRUE(test_api()->GetPinnedFileChips().empty());
......@@ -325,10 +325,10 @@ TEST_P(HoldingSpaceTrayTest, DownloadsContainer) {
EXPECT_EQ(item_1->id(),
HoldingSpaceItemView::Cast(download_chips[1])->item()->id());
// Remove other items, and verify the recent files container gets hidden.
// Remove other items, and verify the recent files bubble gets hidden.
model()->RemoveItem(item_2->id());
EXPECT_TRUE(test_api()->RecentFilesContainerShown());
EXPECT_TRUE(test_api()->RecentFilesBubbleShown());
download_chips = test_api()->GetDownloadChips();
ASSERT_EQ(1u, download_chips.size());
EXPECT_EQ(item_1->id(),
......@@ -337,15 +337,15 @@ TEST_P(HoldingSpaceTrayTest, DownloadsContainer) {
model()->RemoveItem(item_1->id());
EXPECT_TRUE(test_api()->GetDownloadChips().empty());
EXPECT_FALSE(test_api()->RecentFilesContainerShown());
EXPECT_FALSE(test_api()->RecentFilesBubbleShown());
// Pinned container is showing "educational" info, and it should remain shown.
EXPECT_TRUE(test_api()->PinnedFilesContainerShown());
// Pinned bubble is showing "educational" info, and it should remain shown.
EXPECT_TRUE(test_api()->PinnedFilesBubbleShown());
}
// Verifies the downloads container is shown and orders items as expected when
// the model contains a number of finalized items prior to showing UI.
TEST_P(HoldingSpaceTrayTest, DownloadsContainerWithFinalizedItemsOnly) {
// Verifies the downloads section is shown and orders items as expected when the
// model contains a number of finalized items prior to showing UI.
TEST_P(HoldingSpaceTrayTest, DownloadsSectionWithFinalizedItemsOnly) {
MarkTimeOfFirstPin();
StartSession();
......@@ -358,7 +358,7 @@ TEST_P(HoldingSpaceTrayTest, DownloadsContainerWithFinalizedItemsOnly) {
}
test_api()->Show();
EXPECT_TRUE(test_api()->RecentFilesContainerShown());
EXPECT_TRUE(test_api()->RecentFilesBubbleShown());
std::vector<views::View*> download_files = test_api()->GetDownloadChips();
ASSERT_EQ(items.size(), download_files.size());
......@@ -401,7 +401,7 @@ TEST_P(HoldingSpaceTrayTest, FinalizingDownloadItemThatShouldBeInvisible) {
HoldingSpaceItemView::Cast(download_chips[1])->item()->id());
// Finalize partially initialized item, and verify it's not added to the
// container.
// section.
model()->FinalizeOrRemoveItem(item_1->id(), GURL("filesystem:fake_1"));
EXPECT_TRUE(test_api()->GetPinnedFileChips().empty());
......@@ -413,7 +413,7 @@ TEST_P(HoldingSpaceTrayTest, FinalizingDownloadItemThatShouldBeInvisible) {
EXPECT_EQ(item_2->id(),
HoldingSpaceItemView::Cast(download_chips[1])->item()->id());
// Remove the oldest item, and verify the container doesn't get updated.
// Remove the oldest item, and verify the section doesn't get updated.
model()->RemoveItem(item_1->id());
EXPECT_TRUE(test_api()->GetPinnedFileChips().empty());
......@@ -465,20 +465,20 @@ TEST_P(HoldingSpaceTrayTest, PartialItemNowShownOnRemovingADownloadItem) {
HoldingSpaceItemView::Cast(download_chips[0])->item()->id());
}
// Tests how screen capture list is updated during item addition, removal and
// finalization
TEST_P(HoldingSpaceTrayTest, ScreenCaptureContainer) {
// Tests how screen captures section is updated during item addition, removal
// and finalization.
TEST_P(HoldingSpaceTrayTest, ScreenCapturesSection) {
StartSession();
test_api()->Show();
EXPECT_TRUE(test_api()->PinnedFilesContainerShown());
EXPECT_FALSE(test_api()->RecentFilesContainerShown());
EXPECT_TRUE(test_api()->PinnedFilesBubbleShown());
EXPECT_FALSE(test_api()->RecentFilesBubbleShown());
// Add a screenshot item and verify recent file container gets shown.
// Add a screenshot item and verify recent file bubble gets shown.
HoldingSpaceItem* item_1 = AddItem(HoldingSpaceItem::Type::kScreenshot,
base::FilePath("/tmp/fake_1"));
EXPECT_TRUE(test_api()->PinnedFilesContainerShown());
EXPECT_TRUE(test_api()->RecentFilesContainerShown());
EXPECT_TRUE(test_api()->PinnedFilesBubbleShown());
EXPECT_TRUE(test_api()->RecentFilesBubbleShown());
EXPECT_TRUE(test_api()->GetPinnedFileChips().empty());
EXPECT_TRUE(test_api()->GetDownloadChips().empty());
......@@ -497,7 +497,7 @@ TEST_P(HoldingSpaceTrayTest, ScreenCaptureContainer) {
EXPECT_EQ(item_1->id(),
HoldingSpaceItemView::Cast(screen_captures[0])->item()->id());
// Add more items to fill up the container.
// Add more items to fill up the section.
HoldingSpaceItem* item_3 = AddItem(HoldingSpaceItem::Type::kScreenshot,
base::FilePath("/tmp/fake_3"));
HoldingSpaceItem* item_4 = AddItem(HoldingSpaceItem::Type::kScreenshot,
......@@ -515,7 +515,7 @@ TEST_P(HoldingSpaceTrayTest, ScreenCaptureContainer) {
HoldingSpaceItemView::Cast(screen_captures[2])->item()->id());
// Finalize partially initialized item, and verify it gets added to the
// container, in the order of addition, replacing the oldest item.
// section, in the order of addition, replacing the oldest item.
model()->FinalizeOrRemoveItem(item_2->id(), GURL("filesystem:fake_2"));
EXPECT_TRUE(test_api()->GetPinnedFileChips().empty());
......@@ -529,7 +529,7 @@ TEST_P(HoldingSpaceTrayTest, ScreenCaptureContainer) {
EXPECT_EQ(item_2->id(),
HoldingSpaceItemView::Cast(screen_captures[2])->item()->id());
// Remove the newest item, and verify the container gets updated.
// Remove the newest item, and verify the section gets updated.
model()->RemoveItem(item_4->id());
EXPECT_TRUE(test_api()->GetPinnedFileChips().empty());
......@@ -543,7 +543,7 @@ TEST_P(HoldingSpaceTrayTest, ScreenCaptureContainer) {
EXPECT_EQ(item_1->id(),
HoldingSpaceItemView::Cast(screen_captures[2])->item()->id());
// Remove other items, and verify the recent files container gets hidden.
// Remove other items, and verify the recent files bubble gets hidden.
model()->RemoveItem(item_2->id());
EXPECT_TRUE(test_api()->GetPinnedFileChips().empty());
......@@ -559,15 +559,15 @@ TEST_P(HoldingSpaceTrayTest, ScreenCaptureContainer) {
model()->RemoveItem(item_1->id());
EXPECT_TRUE(test_api()->GetScreenCaptureViews().empty());
EXPECT_FALSE(test_api()->RecentFilesContainerShown());
EXPECT_FALSE(test_api()->RecentFilesBubbleShown());
// Pinned container is showing "educational" info, and it should remain shown.
EXPECT_TRUE(test_api()->PinnedFilesContainerShown());
// Pinned bubble is showing "educational" info, and it should remain shown.
EXPECT_TRUE(test_api()->PinnedFilesBubbleShown());
}
// Verifies the screen captures container is shown and orders items as expected
// Verifies the screen captures section is shown and orders items as expected
// when the model contains a number of finalized items prior to showing UI.
TEST_P(HoldingSpaceTrayTest, ScreenCapturesContainerWithFinalizedItemsOnly) {
TEST_P(HoldingSpaceTrayTest, ScreenCapturesSectionWithFinalizedItemsOnly) {
MarkTimeOfFirstPin();
StartSession();
......@@ -580,7 +580,7 @@ TEST_P(HoldingSpaceTrayTest, ScreenCapturesContainerWithFinalizedItemsOnly) {
}
test_api()->Show();
EXPECT_TRUE(test_api()->RecentFilesContainerShown());
EXPECT_TRUE(test_api()->RecentFilesBubbleShown());
std::vector<views::View*> screenshots = test_api()->GetScreenCaptureViews();
ASSERT_EQ(items.size(), screenshots.size());
......@@ -608,13 +608,13 @@ TEST_P(HoldingSpaceTrayTest, FinalizingScreenCaptureItemThatShouldBeInvisible) {
HoldingSpaceItem* item_1 = AddPartiallyInitializedItem(
HoldingSpaceItem::Type::kScreenshot, base::FilePath("/tmp/fake_1"));
EXPECT_FALSE(test_api()->RecentFilesContainerShown());
EXPECT_FALSE(test_api()->RecentFilesBubbleShown());
EXPECT_TRUE(test_api()->GetPinnedFileChips().empty());
EXPECT_TRUE(test_api()->GetDownloadChips().empty());
EXPECT_TRUE(test_api()->GetScreenCaptureViews().empty());
// Add enough screenshot items to fill up the container.
// Add enough screenshot items to fill up the section.
HoldingSpaceItem* item_2 = AddItem(HoldingSpaceItem::Type::kScreenshot,
base::FilePath("/tmp/fake_2"));
HoldingSpaceItem* item_3 = AddItem(HoldingSpaceItem::Type::kScreenshot,
......@@ -635,7 +635,7 @@ TEST_P(HoldingSpaceTrayTest, FinalizingScreenCaptureItemThatShouldBeInvisible) {
HoldingSpaceItemView::Cast(screen_captures[2])->item()->id());
// Finalize partially initialized item, and verify it's not added to the
// container.
// section.
model()->FinalizeOrRemoveItem(item_1->id(), GURL("filesystem:fake_1"));
EXPECT_TRUE(test_api()->GetPinnedFileChips().empty());
......@@ -649,7 +649,7 @@ TEST_P(HoldingSpaceTrayTest, FinalizingScreenCaptureItemThatShouldBeInvisible) {
EXPECT_EQ(item_2->id(),
HoldingSpaceItemView::Cast(screen_captures[2])->item()->id());
// Remove the oldest item, and verify the container doesn't get updated.
// Remove the oldest item, and verify the section doesn't get updated.
model()->RemoveItem(item_1->id());
EXPECT_TRUE(test_api()->GetPinnedFileChips().empty());
......@@ -712,9 +712,9 @@ TEST_P(HoldingSpaceTrayTest, PartialItemNowShownOnRemovingAScreenCapture) {
test_api()->Close();
}
// Tests how the pinned item list is updated during item addition, removal and
// finalization.
TEST_P(HoldingSpaceTrayTest, PinnedFilesContainer) {
// Tests how the pinned item section is updated during item addition, removal
// and finalization.
TEST_P(HoldingSpaceTrayTest, PinnedFilesSection) {
MarkTimeOfFirstPin();
StartSession();
......@@ -722,8 +722,8 @@ TEST_P(HoldingSpaceTrayTest, PinnedFilesContainer) {
base::FilePath("/tmp/fake_1"));
test_api()->Show();
EXPECT_TRUE(test_api()->PinnedFilesContainerShown());
EXPECT_FALSE(test_api()->RecentFilesContainerShown());
EXPECT_TRUE(test_api()->PinnedFilesBubbleShown());
EXPECT_FALSE(test_api()->RecentFilesBubbleShown());
EXPECT_TRUE(test_api()->GetDownloadChips().empty());
EXPECT_TRUE(test_api()->GetScreenCaptureViews().empty());
......@@ -744,7 +744,7 @@ TEST_P(HoldingSpaceTrayTest, PinnedFilesContainer) {
EXPECT_EQ(item_1->id(),
HoldingSpaceItemView::Cast(pinned_files[0])->item()->id());
// Add more items to the container.
// Add more items to the section.
HoldingSpaceItem* item_3 = AddPartiallyInitializedItem(
HoldingSpaceItem::Type::kPinnedFile, base::FilePath("/tmp/fake_3"));
HoldingSpaceItem* item_4 = AddItem(HoldingSpaceItem::Type::kPinnedFile,
......@@ -787,7 +787,7 @@ TEST_P(HoldingSpaceTrayTest, PinnedFilesContainer) {
EXPECT_EQ(item_1->id(),
HoldingSpaceItemView::Cast(pinned_files[2])->item()->id());
// Remove the newest item, and verify the container gets updated.
// Remove the newest item, and verify the section gets updated.
model()->RemoveItem(item_4->id());
EXPECT_TRUE(test_api()->GetDownloadChips().empty());
......@@ -799,7 +799,7 @@ TEST_P(HoldingSpaceTrayTest, PinnedFilesContainer) {
EXPECT_EQ(item_1->id(),
HoldingSpaceItemView::Cast(pinned_files[1])->item()->id());
// Remove other items, and verify the files container gets hidden.
// Remove other items, and verify the files section gets hidden.
model()->RemoveItem(item_2->id());
EXPECT_TRUE(test_api()->GetDownloadChips().empty());
EXPECT_TRUE(test_api()->GetScreenCaptureViews().empty());
......@@ -813,14 +813,14 @@ TEST_P(HoldingSpaceTrayTest, PinnedFilesContainer) {
EXPECT_TRUE(test_api()->GetScreenCaptureViews().empty());
EXPECT_TRUE(test_api()->GetPinnedFileChips().empty());
EXPECT_FALSE(test_api()->RecentFilesContainerShown());
EXPECT_FALSE(test_api()->PinnedFilesContainerShown());
EXPECT_FALSE(test_api()->RecentFilesBubbleShown());
EXPECT_FALSE(test_api()->PinnedFilesBubbleShown());
}
// Verifies the pinned items container is not shown if it only contains
// partially initialized items.
// Verifies the pinned files bubble is not shown if it only contains partially
// initialized items.
TEST_P(HoldingSpaceTrayTest,
PinnedFilesContainerWithPartiallyInitializedItemsOnly) {
PinnedFilesBubbleWithPartiallyInitializedItemsOnly) {
MarkTimeOfFirstPin();
StartSession();
......@@ -831,17 +831,17 @@ TEST_P(HoldingSpaceTrayTest,
base::FilePath("/tmp/fake_1"));
test_api()->Show();
EXPECT_FALSE(test_api()->PinnedFilesContainerShown());
EXPECT_FALSE(test_api()->PinnedFilesBubbleShown());
// Add another partially initialized item.
HoldingSpaceItem* item_2 = AddPartiallyInitializedItem(
HoldingSpaceItem::Type::kPinnedFile, base::FilePath("/tmp/fake_2"));
EXPECT_FALSE(test_api()->PinnedFilesContainerShown());
EXPECT_FALSE(test_api()->PinnedFilesBubbleShown());
// Add a fully initialized item, and verify it gets shown.
HoldingSpaceItem* item_3 = AddItem(HoldingSpaceItem::Type::kPinnedFile,
base::FilePath("/tmp/fake_3"));
EXPECT_TRUE(test_api()->PinnedFilesContainerShown());
EXPECT_TRUE(test_api()->PinnedFilesBubbleShown());
std::vector<views::View*> pinned_files = test_api()->GetPinnedFileChips();
ASSERT_EQ(1u, pinned_files.size());
......@@ -859,9 +859,9 @@ TEST_P(HoldingSpaceTrayTest,
HoldingSpaceItemView::Cast(pinned_files[0])->item()->id());
}
// Verifies the pinned items container is shown and orders items as expected
// when the model contains a number of finalized items prior to showing UI.
TEST_P(HoldingSpaceTrayTest, PinnedFilesContainerWithFinalizedItemsOnly) {
// Verifies the pinned items section is shown and orders items as expected when
// the model contains a number of finalized items prior to showing UI.
TEST_P(HoldingSpaceTrayTest, PinnedFilesSectionWithFinalizedItemsOnly) {
MarkTimeOfFirstPin();
StartSession();
......@@ -874,7 +874,7 @@ TEST_P(HoldingSpaceTrayTest, PinnedFilesContainerWithFinalizedItemsOnly) {
}
test_api()->Show();
EXPECT_TRUE(test_api()->PinnedFilesContainerShown());
EXPECT_TRUE(test_api()->PinnedFilesBubbleShown());
std::vector<views::View*> pinned_files = test_api()->GetPinnedFileChips();
ASSERT_EQ(items.size(), pinned_files.size());
......@@ -891,24 +891,24 @@ TEST_P(HoldingSpaceTrayTest, PinnedFilesContainerWithFinalizedItemsOnly) {
}
// Tests that as nearby shared files are added to the model, they show on the
// downloads container.
TEST_P(HoldingSpaceTrayTest, DownloadsContainerWithNearbySharedFiles) {
// downloads section.
TEST_P(HoldingSpaceTrayTest, DownloadsSectionWithNearbySharedFiles) {
StartSession();
test_api()->Show();
EXPECT_TRUE(test_api()->PinnedFilesContainerShown());
EXPECT_FALSE(test_api()->RecentFilesContainerShown());
EXPECT_TRUE(test_api()->PinnedFilesBubbleShown());
EXPECT_FALSE(test_api()->RecentFilesBubbleShown());
EXPECT_TRUE(test_api()->GetPinnedFileChips().empty());
ASSERT_TRUE(test_api()->GetDownloadChips().empty());
// Add a nearby share item and verify recent file container gets shown.
// Add a nearby share item and verify recent files bubble gets shown.
HoldingSpaceItem* item_1 = AddItem(HoldingSpaceItem::Type::kNearbyShare,
base::FilePath("/tmp/fake_1"));
ASSERT_TRUE(item_1->IsFinalized());
EXPECT_TRUE(test_api()->PinnedFilesContainerShown());
EXPECT_TRUE(test_api()->RecentFilesContainerShown());
EXPECT_TRUE(test_api()->PinnedFilesBubbleShown());
EXPECT_TRUE(test_api()->RecentFilesBubbleShown());
EXPECT_TRUE(test_api()->GetPinnedFileChips().empty());
EXPECT_TRUE(test_api()->GetScreenCaptureViews().empty());
......@@ -928,7 +928,7 @@ TEST_P(HoldingSpaceTrayTest, DownloadsContainerWithNearbySharedFiles) {
EXPECT_EQ(item_1->id(),
HoldingSpaceItemView::Cast(download_chips[1])->item()->id());
// Remove the first item, and verify the container gets updated.
// Remove the first item, and verify the section gets updated.
model()->RemoveItem(item_1->id());
EXPECT_TRUE(test_api()->GetPinnedFileChips().empty());
......@@ -947,7 +947,7 @@ TEST_P(HoldingSpaceTrayTest, PartialNearbyShareItemWithExistingDownloadItems) {
StartSession();
test_api()->Show();
EXPECT_FALSE(test_api()->RecentFilesContainerShown());
EXPECT_FALSE(test_api()->RecentFilesBubbleShown());
ASSERT_TRUE(test_api()->GetDownloadChips().empty());
// Add partially initialized nearby share item - verify it doesn't get shown
......@@ -955,21 +955,21 @@ TEST_P(HoldingSpaceTrayTest, PartialNearbyShareItemWithExistingDownloadItems) {
HoldingSpaceItem* nearby_share_item =
AddPartiallyInitializedItem(HoldingSpaceItem::Type::kNearbyShare,
base::FilePath("/tmp/nearby_share"));
EXPECT_FALSE(test_api()->RecentFilesContainerShown());
EXPECT_FALSE(test_api()->RecentFilesBubbleShown());
EXPECT_TRUE(test_api()->GetDownloadChips().empty());
// Add partially initialized screenshot item - verify it doesn't get shown in
// the UI yet.
HoldingSpaceItem* screenshot_item = AddPartiallyInitializedItem(
HoldingSpaceItem::Type::kScreenshot, base::FilePath("/tmp/screenshot"));
EXPECT_FALSE(test_api()->RecentFilesContainerShown());
EXPECT_FALSE(test_api()->RecentFilesBubbleShown());
// Add two download items.
HoldingSpaceItem* download_item_1 = AddItem(
HoldingSpaceItem::Type::kDownload, base::FilePath("/tmp/download_1"));
HoldingSpaceItem* download_item_2 = AddItem(
HoldingSpaceItem::Type::kDownload, base::FilePath("/tmp/download_2"));
EXPECT_TRUE(test_api()->RecentFilesContainerShown());
EXPECT_TRUE(test_api()->RecentFilesBubbleShown());
EXPECT_TRUE(test_api()->GetPinnedFileChips().empty());
EXPECT_TRUE(test_api()->GetScreenCaptureViews().empty());
std::vector<views::View*> download_chips = test_api()->GetDownloadChips();
......@@ -1027,14 +1027,14 @@ TEST_P(HoldingSpaceTrayTest, PartialDownloadItemWithExistingNearbyShareItems) {
StartSession();
test_api()->Show();
EXPECT_FALSE(test_api()->RecentFilesContainerShown());
EXPECT_FALSE(test_api()->RecentFilesBubbleShown());
ASSERT_TRUE(test_api()->GetDownloadChips().empty());
// Add partially initialized download item - verify it doesn't get shown
// in the UI yet.
HoldingSpaceItem* item_1 = AddPartiallyInitializedItem(
HoldingSpaceItem::Type::kDownload, base::FilePath("/tmp/fake_1"));
EXPECT_FALSE(test_api()->RecentFilesContainerShown());
EXPECT_FALSE(test_api()->RecentFilesBubbleShown());
EXPECT_TRUE(test_api()->GetDownloadChips().empty());
// Add two nearby share items.
......@@ -1042,7 +1042,7 @@ TEST_P(HoldingSpaceTrayTest, PartialDownloadItemWithExistingNearbyShareItems) {
base::FilePath("/tmp/fake_2"));
HoldingSpaceItem* item_3 = AddItem(HoldingSpaceItem::Type::kNearbyShare,
base::FilePath("/tmp/fake_3"));
EXPECT_TRUE(test_api()->RecentFilesContainerShown());
EXPECT_TRUE(test_api()->RecentFilesBubbleShown());
EXPECT_TRUE(test_api()->GetPinnedFileChips().empty());
EXPECT_TRUE(test_api()->GetScreenCaptureViews().empty());
std::vector<views::View*> download_chips = test_api()->GetDownloadChips();
......@@ -1099,24 +1099,24 @@ TEST_P(HoldingSpaceTrayTest, ShouldMaybeShowContextMenuOnRightClick) {
}
// Tests that as screen recording files are added to the model, they show in the
// screen capture container.
TEST_P(HoldingSpaceTrayTest, ScreenCaptureContainerWithScreenRecordingFiles) {
// screen captures section.
TEST_P(HoldingSpaceTrayTest, ScreenCapturesSectionWithScreenRecordingFiles) {
StartSession();
test_api()->Show();
EXPECT_TRUE(test_api()->PinnedFilesContainerShown());
EXPECT_FALSE(test_api()->RecentFilesContainerShown());
EXPECT_TRUE(test_api()->PinnedFilesBubbleShown());
EXPECT_FALSE(test_api()->RecentFilesBubbleShown());
EXPECT_TRUE(test_api()->GetPinnedFileChips().empty());
ASSERT_TRUE(test_api()->GetScreenCaptureViews().empty());
// Add a screen recording item and verify recent file container gets shown.
// Add a screen recording item and verify recent files section gets shown.
HoldingSpaceItem* item_1 = AddItem(HoldingSpaceItem::Type::kScreenRecording,
base::FilePath("/tmp/fake_1"));
ASSERT_TRUE(item_1->IsFinalized());
EXPECT_TRUE(test_api()->PinnedFilesContainerShown());
EXPECT_TRUE(test_api()->RecentFilesContainerShown());
EXPECT_TRUE(test_api()->PinnedFilesBubbleShown());
EXPECT_TRUE(test_api()->RecentFilesBubbleShown());
EXPECT_TRUE(test_api()->GetPinnedFileChips().empty());
EXPECT_TRUE(test_api()->GetDownloadChips().empty());
......@@ -1137,7 +1137,7 @@ TEST_P(HoldingSpaceTrayTest, ScreenCaptureContainerWithScreenRecordingFiles) {
EXPECT_EQ(item_1->id(),
HoldingSpaceItemView::Cast(screen_capture_chips[1])->item()->id());
// Remove the first item, and verify the container gets updated.
// Remove the first item, and verify the section gets updated.
model()->RemoveItem(item_1->id());
EXPECT_TRUE(test_api()->GetPinnedFileChips().empty());
......@@ -1157,7 +1157,7 @@ TEST_P(HoldingSpaceTrayTest,
StartSession();
test_api()->Show();
EXPECT_FALSE(test_api()->RecentFilesContainerShown());
EXPECT_FALSE(test_api()->RecentFilesBubbleShown());
ASSERT_TRUE(test_api()->GetScreenCaptureViews().empty());
// Add partially initialized screen recording item - verify it doesn't get
......@@ -1165,17 +1165,17 @@ TEST_P(HoldingSpaceTrayTest,
HoldingSpaceItem* screen_recording_item =
AddPartiallyInitializedItem(HoldingSpaceItem::Type::kScreenRecording,
base::FilePath("/tmp/screen_recording"));
EXPECT_FALSE(test_api()->RecentFilesContainerShown());
EXPECT_FALSE(test_api()->RecentFilesBubbleShown());
EXPECT_TRUE(test_api()->GetScreenCaptureViews().empty());
// Add three screenshot items to fill up the container.
// Add three screenshot items to fill up the section.
HoldingSpaceItem* screenshot_item_1 = AddItem(
HoldingSpaceItem::Type::kScreenshot, base::FilePath("/tmp/screenshot_1"));
HoldingSpaceItem* screenshot_item_2 = AddItem(
HoldingSpaceItem::Type::kScreenshot, base::FilePath("/tmp/screenshot_2"));
HoldingSpaceItem* screenshot_item_3 = AddItem(
HoldingSpaceItem::Type::kScreenshot, base::FilePath("/tmp/screenshot_3"));
EXPECT_TRUE(test_api()->RecentFilesContainerShown());
EXPECT_TRUE(test_api()->RecentFilesBubbleShown());
EXPECT_TRUE(test_api()->GetPinnedFileChips().empty());
EXPECT_TRUE(test_api()->GetDownloadChips().empty());
std::vector<views::View*> screen_capture_chips =
......@@ -1255,24 +1255,24 @@ TEST_P(HoldingSpaceTrayTest,
StartSession();
test_api()->Show();
EXPECT_FALSE(test_api()->RecentFilesContainerShown());
EXPECT_FALSE(test_api()->RecentFilesBubbleShown());
ASSERT_TRUE(test_api()->GetScreenCaptureViews().empty());
// Add partially initialized screenshot item - verify it doesn't get shown
// in the UI yet.
HoldingSpaceItem* screenshot_item = AddPartiallyInitializedItem(
HoldingSpaceItem::Type::kScreenshot, base::FilePath("/tmp/fake_1"));
EXPECT_FALSE(test_api()->RecentFilesContainerShown());
EXPECT_FALSE(test_api()->RecentFilesBubbleShown());
EXPECT_TRUE(test_api()->GetScreenCaptureViews().empty());
// Add three screenshot recording items to fill up the container.
// Add three screenshot recording items to fill up the section.
HoldingSpaceItem* screen_recording_item_1 = AddItem(
HoldingSpaceItem::Type::kScreenRecording, base::FilePath("/tmp/fake_2"));
HoldingSpaceItem* screen_recording_item_2 = AddItem(
HoldingSpaceItem::Type::kScreenRecording, base::FilePath("/tmp/fake_3"));
HoldingSpaceItem* screen_recording_item_3 = AddItem(
HoldingSpaceItem::Type::kScreenRecording, base::FilePath("/tmp/fake_4"));
EXPECT_TRUE(test_api()->RecentFilesContainerShown());
EXPECT_TRUE(test_api()->RecentFilesBubbleShown());
EXPECT_TRUE(test_api()->GetPinnedFileChips().empty());
EXPECT_TRUE(test_api()->GetDownloadChips().empty());
std::vector<views::View*> screen_capture_chips =
......@@ -1326,7 +1326,7 @@ TEST_P(HoldingSpaceTrayTest, PlayIconForScreenRecordings) {
HoldingSpaceItem::Type::kScreenshot, base::FilePath("/tmp/fake_1"));
HoldingSpaceItem* screen_recording_item = AddItem(
HoldingSpaceItem::Type::kScreenRecording, base::FilePath("/tmp/fake_2"));
EXPECT_TRUE(test_api()->RecentFilesContainerShown());
EXPECT_TRUE(test_api()->RecentFilesBubbleShown());
std::vector<views::View*> screen_capture_chips =
test_api()->GetScreenCaptureViews();
......
......@@ -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