1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
ash / wm / window_restore / informed_restore_items_container_view.cc [blame]
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/wm/window_restore/informed_restore_items_container_view.h"
#include "ash/wm/window_restore/informed_restore_constants.h"
#include "ash/wm/window_restore/informed_restore_item_view.h"
#include "ash/wm/window_restore/informed_restore_items_overflow_view.h"
#include "ui/chromeos/styles/cros_tokens_color_mappings.h"
#include "ui/views/background.h"
#include "ui/views/layout/box_layout_view.h"
namespace ash {
InformedRestoreItemsContainerView::InformedRestoreItemsContainerView(
const InformedRestoreContentsData::AppsInfos& apps_infos) {
const int elements = static_cast<int>(apps_infos.size());
CHECK_GT(elements, 0);
SetBackground(views::CreateThemedRoundedRectBackground(
cros_tokens::kCrosSysSystemBaseElevated,
informed_restore::kPreviewContainerRadius));
SetBetweenChildSpacing(informed_restore::kItemsContainerChildSpacing);
SetInsideBorderInsets(informed_restore::kItemsContainerInsets);
SetMainAxisAlignment(views::BoxLayout::MainAxisAlignment::kStart);
SetOrientation(views::BoxLayout::Orientation::kVertical);
for (int i = 0; i < elements; ++i) {
const InformedRestoreContentsData::AppInfo& app_info = apps_infos[i];
// If there are more than four elements, we will need to save the last
// space for the overflow view to condense the remaining info.
if (elements > informed_restore::kMaxItems &&
i >= informed_restore::kOverflowMinThreshold) {
AddChildView(std::make_unique<InformedRestoreItemsOverflowView>(
apps_infos));
break;
}
AddChildView(
std::make_unique<InformedRestoreItemView>(
app_info, /*inside_screenshot=*/false));
}
}
BEGIN_METADATA(InformedRestoreItemsContainerView)
END_METADATA
} // namespace ash