Commit 82fccc55 authored by Jiewei Qian's avatar Jiewei Qian Committed by Chromium LUCI CQ

Revert "Scalable Status Area: Show date in status area in large screen."

This reverts commit 5ac617b2.

Reason for revert: Causing multiple builds to fail.

https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20ChromiumOS%20MSan%20Tests/22042/overview

https://ci.chromium.org/ui/p/chromium/builders/ci/linux-chromeos-dbg/22108/overview

MSAN suggests use-of-uninitialized-value. See: https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket.appspot.com/8858716359442887296/+/steps/oobe_only_browser_tests__experimental_/0/logs/Deterministic_failure:_All__x2f_PendingUpdateScreenTest.UpdateScreenShown__x2f_1__status_CRASH_/0

Original change's description:
> Scalable Status Area: Show date in status area in large screen.
>
> - Add a flag for the scalable status area feature.
> - Add enum and helper function in SystemTrayModel to capture system tray
> size.
> - Add date to system tray when the screen is large.
>
> Bug: 1161557
> Change-Id: Id85a6bee9a30684c65b2253862ba30ab78583525
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2600912
> Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
> Reviewed-by: Toni Baržić <tbarzic@chromium.org>
> Reviewed-by: Tetsui Ohkubo <tetsui@chromium.org>
> Commit-Queue: Andre Le <leandre@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#841227}

TBR=xiyuan@chromium.org,tbarzic@chromium.org,tetsui@chromium.org,chromium-scoped@luci-project-accounts.iam.gserviceaccount.com,leandre@chromium.org

Change-Id: I4072db4a1267389478963dfebacb55551e2c3186
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1161557
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2617405Reviewed-by: default avatarJiewei Qian  <qjw@chromium.org>
Commit-Queue: Jiewei Qian  <qjw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841356}
parent 06a2e07d
......@@ -2252,7 +2252,6 @@ test("ash_unittests") {
"system/session/session_limit_notification_controller_unittest.cc",
"system/status_area_widget_unittest.cc",
"system/supervised/supervised_notification_controller_unittest.cc",
"system/time/time_tray_item_view_unittest.cc",
"system/time/time_view_unittest.cc",
"system/toast/toast_manager_unittest.cc",
"system/tracing_notification_controller_unittest.cc",
......
......@@ -933,9 +933,6 @@ This file contains the strings for ash.
<message name="IDS_ASH_STATUS_TRAY_DATE" desc="The date displayed on ash system bubble, Depending on launguage, please choose the best separator(eg ',') between abbreviated weekday and date">
<ph name="short_weekday">$1<ex>Fri</ex></ph>, <ph name="date">$2<ex>Aug 31, 2012</ex></ph>
</message>
<message name="IDS_ASH_STATUS_TRAY_DATE_TIME" desc="The time displayed on ash system tray, Depending on launguage, please choose the best separator(eg ',') between abbreviated date and time">
<ph name="date">$1<ex>Aug 31</ex></ph>, <ph name="time">$2<ex>03:00</ex></ph>
</message>
<message name="IDS_ASH_STATUS_TRAY_REBOOT" desc="The accessible text for the reboot button.">
Restart
</message>
......
56b9ecb9b85721cdee47f52a37df3dcd4f6867a5
\ No newline at end of file
......@@ -143,9 +143,6 @@ const base::Feature kTemporaryHoldingSpacePreviews{
const base::Feature kDragUnpinnedAppToPin{"DragUnpinnedAppToPin",
base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kScalableStatusArea{"ScalableStatusArea",
base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kKeyboardBasedDisplayArrangementInSettings{
"KeyboardBasedDisplayArrangementInSettings",
base::FEATURE_ENABLED_BY_DEFAULT};
......@@ -324,10 +321,6 @@ bool IsDragUnpinnedAppToPinEnabled() {
return base::FeatureList::IsEnabled(kDragUnpinnedAppToPin);
}
bool IsScalableStatusAreaEnabled() {
return base::FeatureList::IsEnabled(kScalableStatusArea);
}
namespace {
// The boolean flag indicating if "WebUITabStrip" feature is enabled in Chrome.
......
......@@ -194,9 +194,6 @@ ASH_PUBLIC_EXPORT extern const base::Feature kTemporaryHoldingSpacePreviews;
// Enables dragging an unpinned open app to pinned app side to pin.
ASH_PUBLIC_EXPORT extern const base::Feature kDragUnpinnedAppToPin;
// Enables the system tray to show more information in larger screen.
ASH_PUBLIC_EXPORT extern const base::Feature kScalableStatusArea;
ASH_PUBLIC_EXPORT bool IsAllowAmbientEQEnabled();
ASH_PUBLIC_EXPORT bool IsAltTabLimitedToActiveDesk();
......@@ -277,8 +274,6 @@ ASH_PUBLIC_EXPORT bool IsTemporaryHoldingSpacePreviewsEnabled();
ASH_PUBLIC_EXPORT bool IsDragUnpinnedAppToPinEnabled();
ASH_PUBLIC_EXPORT bool IsScalableStatusAreaEnabled();
// These two functions are supposed to be temporary functions to set or get
// whether "WebUITabStrip" feature is enabled from Chrome.
ASH_PUBLIC_EXPORT void SetWebUITabStripEnabled(bool enabled);
......
......@@ -4,7 +4,6 @@
#include "ash/system/time/time_tray_item_view.h"
#include "ash/public/cpp/ash_features.h"
#include "ash/session/session_controller_impl.h"
#include "ash/shelf/shelf.h"
#include "ash/shell.h"
......@@ -17,18 +16,14 @@ namespace ash {
namespace tray {
TimeTrayItemView::TimeTrayItemView(Shelf* shelf, UnifiedSystemTrayModel* model)
: TrayItemView(shelf), model_(model), session_observer_(this) {
system_tray_model_observation_.Observe(model_);
TimeTrayItemView::TimeTrayItemView(Shelf* shelf)
: TrayItemView(shelf), session_observer_(this) {
TimeView::ClockLayout clock_layout =
shelf->IsHorizontalAlignment() ? TimeView::ClockLayout::HORIZONTAL_CLOCK
: TimeView::ClockLayout::VERTICAL_CLOCK;
time_view_ =
new TimeView(clock_layout, Shell::Get()->system_tray_model()->clock());
AddChildView(time_view_);
OnSystemTrayButtonSizeChanged(model_->GetSystemTrayButtonSize());
}
TimeTrayItemView::~TimeTrayItemView() = default;
......@@ -49,13 +44,6 @@ void TimeTrayItemView::OnSessionStateChanged(
time_view_->SetTextColor(TrayIconColor(state));
}
void TimeTrayItemView::OnSystemTrayButtonSizeChanged(
UnifiedSystemTrayModel::SystemTrayButtonSize system_tray_size) {
time_view_->SetShowDateWhenHorizontal(
features::IsScalableStatusAreaEnabled() &&
system_tray_size == UnifiedSystemTrayModel::SystemTrayButtonSize::kLarge);
}
const char* TimeTrayItemView::GetClassName() const {
return "TimeTrayItemView";
}
......
......@@ -8,9 +8,7 @@
#include "ash/ash_export.h"
#include "ash/public/cpp/session/session_observer.h"
#include "ash/system/tray/tray_item_view.h"
#include "ash/system/unified/unified_system_tray_model.h"
#include "base/macros.h"
#include "base/scoped_observation.h"
namespace ash {
class Shelf;
......@@ -19,11 +17,9 @@ namespace tray {
class TimeView;
class ASH_EXPORT TimeTrayItemView : public TrayItemView,
public SessionObserver,
public UnifiedSystemTrayModel::Observer {
class TimeTrayItemView : public TrayItemView, public SessionObserver {
public:
TimeTrayItemView(Shelf* shelf, UnifiedSystemTrayModel* model);
explicit TimeTrayItemView(Shelf* shelf);
~TimeTrayItemView() override;
void UpdateAlignmentForShelf(Shelf* shelf);
......@@ -35,23 +31,13 @@ class ASH_EXPORT TimeTrayItemView : public TrayItemView,
// SessionObserver:
void OnSessionStateChanged(session_manager::SessionState state) override;
// UnifiedSystemTrayModel::Observer:
void OnSystemTrayButtonSizeChanged(
UnifiedSystemTrayModel::SystemTrayButtonSize system_tray_size) override;
// views::View:
const char* GetClassName() const override;
void OnThemeChanged() override;
private:
friend class TimeTrayItemViewTest;
UnifiedSystemTrayModel* model_ = nullptr;
TimeView* time_view_ = nullptr;
ScopedSessionObserver session_observer_;
base::ScopedObservation<UnifiedSystemTrayModel,
UnifiedSystemTrayModel::Observer>
system_tray_model_observation_{this};
DISALLOW_COPY_AND_ASSIGN(TimeTrayItemView);
};
......
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/system/time/time_tray_item_view.h"
#include "ash/public/cpp/ash_features.h"
#include "ash/shelf/shelf.h"
#include "ash/system/time/time_view.h"
#include "ash/system/unified/unified_system_tray_model.h"
#include "ash/test/ash_test_base.h"
#include "base/test/scoped_feature_list.h"
namespace ash {
namespace tray {
class TimeTrayItemViewTest : public AshTestBase,
public testing::WithParamInterface<bool> {
public:
TimeTrayItemViewTest() = default;
~TimeTrayItemViewTest() override = default;
// AshTestBase:
void SetUp() override {
AshTestBase::SetUp();
scoped_feature_list_.InitWithFeatureState(
features::kScalableStatusArea, is_scalable_status_area_enabled());
model_ = std::make_unique<UnifiedSystemTrayModel>(GetPrimaryShelf());
time_tray_item_view_ =
std::make_unique<TimeTrayItemView>(GetPrimaryShelf(), model_.get());
}
void TearDown() override {
time_tray_item_view_.reset();
model_.reset();
AshTestBase::TearDown();
}
bool is_scalable_status_area_enabled() { return GetParam(); }
// Returns true if the time view is in horizontal layout, false if it is in
// vertical layout.
bool IsTimeViewInHorizontalLayout() {
// Time view is in horizontal layout if its subview is in use (it transfers
// the ownership to the views hierarchy and becomes nullptr),
return !time_tray_item_view_->time_view_->horizontal_view_;
}
bool ShouldShowDateInTimeView() {
return time_tray_item_view_->time_view_->show_date_when_horizontal_;
}
protected:
base::test::ScopedFeatureList scoped_feature_list_;
std::unique_ptr<UnifiedSystemTrayModel> model_;
std::unique_ptr<TimeTrayItemView> time_tray_item_view_;
};
INSTANTIATE_TEST_SUITE_P(All,
TimeTrayItemViewTest,
testing::Bool() /* is_scalable_status_area_enabled */);
TEST_P(TimeTrayItemViewTest, ShelfAlignment) {
// The tray should show time horizontal view when the shelf is bottom.
GetPrimaryShelf()->SetAlignment(ShelfAlignment::kBottom);
time_tray_item_view_->UpdateAlignmentForShelf(GetPrimaryShelf());
EXPECT_TRUE(IsTimeViewInHorizontalLayout());
// The tray should show time vertical view when the shelf is left or right.
GetPrimaryShelf()->SetAlignment(ShelfAlignment::kLeft);
time_tray_item_view_->UpdateAlignmentForShelf(GetPrimaryShelf());
EXPECT_FALSE(IsTimeViewInHorizontalLayout());
GetPrimaryShelf()->SetAlignment(ShelfAlignment::kRight);
time_tray_item_view_->UpdateAlignmentForShelf(GetPrimaryShelf());
EXPECT_FALSE(IsTimeViewInHorizontalLayout());
// The tray should show time horizontal view when switching back to bottom
// shelf.
GetPrimaryShelf()->SetAlignment(ShelfAlignment::kBottom);
time_tray_item_view_->UpdateAlignmentForShelf(GetPrimaryShelf());
EXPECT_TRUE(IsTimeViewInHorizontalLayout());
}
TEST_P(TimeTrayItemViewTest, DisplayChanged) {
UpdateDisplay("800x800");
EXPECT_FALSE(ShouldShowDateInTimeView());
// Date should be shown in large screen size (when scalable status area is
// enabled).
UpdateDisplay("1680x800");
EXPECT_EQ(is_scalable_status_area_enabled(), ShouldShowDateInTimeView());
}
} // namespace tray
} // namespace ash
......@@ -54,12 +54,6 @@ const int kVerticalClockMinutesTopOffset = -2;
// when the shelf is vertically aligned.
const int kClockLeadingPadding = 8;
base::string16 FormatDate(const base::Time& time) {
// Use 'short' month format (e.g., "Oct") followed by non-padded day of
// month (e.g., "2", "10").
return base::TimeFormatWithPattern(time, "LLLd");
}
} // namespace
TimeView::TimeView(ClockLayout clock_layout, ClockModel* model)
......@@ -118,14 +112,6 @@ void TimeView::SetTextShadowValues(const gfx::ShadowValues& shadows) {
vertical_label_minutes_->SetShadows(shadows);
}
void TimeView::SetShowDateWhenHorizontal(bool show_date_when_horizontal) {
if (show_date_when_horizontal_ == show_date_when_horizontal)
return;
show_date_when_horizontal_ = show_date_when_horizontal;
UpdateText();
PreferredSizeChanged();
}
void TimeView::OnDateFormatChanged() {
UpdateTimeFormat();
}
......@@ -203,11 +189,7 @@ void TimeView::UpdateTextInternal(const base::Time& now) {
base::string16 current_time = base::TimeFormatTimeOfDayWithHourClockType(
now, model_->hour_clock_type(), base::kDropAmPm);
base::string16 current_date_time = l10n_util::GetStringFUTF16(
IDS_ASH_STATUS_TRAY_DATE_TIME, FormatDate(now), current_time);
horizontal_label_->SetText(show_date_when_horizontal_ ? current_date_time
: current_time);
horizontal_label_->SetText(current_time);
horizontal_label_->SetTooltipText(base::TimeFormatFriendlyDate(now));
horizontal_label_->NotifyAccessibilityEvent(ax::mojom::Event::kTextChanged,
true);
......
......@@ -56,9 +56,6 @@ class ASH_EXPORT TimeView : public ActionableView, public ClockObserver {
// Updates the time text shadow values.
void SetTextShadowValues(const gfx::ShadowValues& shadows);
// Shows the date in horizontal view when |show_date_when_horizontal| is true.
void SetShowDateWhenHorizontal(bool show_date_when_horizontal);
// ClockObserver:
void OnDateFormatChanged() override;
void OnSystemClockTimeUpdated() override;
......@@ -72,7 +69,6 @@ class ASH_EXPORT TimeView : public ActionableView, public ClockObserver {
private:
friend class TimeViewTest;
friend class TimeTrayItemViewTest;
// ActionableView:
bool PerformAction(const ui::Event& event) override;
......@@ -111,9 +107,6 @@ class ASH_EXPORT TimeView : public ActionableView, public ClockObserver {
views::Label* vertical_label_hours_;
views::Label* vertical_label_minutes_;
// Indicates if date should be show in horizontal view.
bool show_date_when_horizontal_ = false;
// Invokes UpdateText() when the displayed time should change.
base::OneShotTimer timer_;
......
......@@ -76,29 +76,5 @@ TEST_F(TimeViewTest, Basics) {
EXPECT_FALSE(vertical_view()->parent());
}
// Test the show date mode in the time view.
TEST_F(TimeViewTest, ShowDateMode) {
CreateTimeView(TimeView::ClockLayout::HORIZONTAL_CLOCK);
base::string16 time_text = horizontal_label()->GetText();
// When showing date, the text is expected to be longer since it's showing
// more content.
time_view()->SetShowDateWhenHorizontal(true /* show_date_when_horizontal */);
EXPECT_GT(horizontal_label()->GetText(), time_text);
// Resetting show date mode should show only the time.
time_view()->SetShowDateWhenHorizontal(false /* show_date_when_horizontal */);
EXPECT_EQ(time_text, horizontal_label()->GetText());
time_view()->UpdateClockLayout(TimeView::ClockLayout::VERTICAL_CLOCK);
base::string16 hours_text = vertical_label_hours()->GetText();
base::string16 minutes_text = vertical_label_minutes()->GetText();
// Show date mode should not affect vertical view.
time_view()->SetShowDateWhenHorizontal(true /* show_date_when_horizontal */);
EXPECT_EQ(hours_text, vertical_label_hours()->GetText());
EXPECT_EQ(minutes_text, vertical_label_minutes()->GetText());
}
} // namespace tray
} // namespace ash
......@@ -20,6 +20,7 @@
#include "ash/system/network/network_tray_view.h"
#include "ash/system/power/tray_power.h"
#include "ash/system/privacy_screen/privacy_screen_toast_controller.h"
#include "ash/system/status_area_widget.h"
#include "ash/system/time/time_tray_item_view.h"
#include "ash/system/time/time_view.h"
#include "ash/system/tray/tray_constants.h"
......@@ -119,7 +120,8 @@ void UnifiedSystemTray::UiDelegate::HideMessageCenter() {}
UnifiedSystemTray::UnifiedSystemTray(Shelf* shelf)
: TrayBackgroundView(shelf),
ui_delegate_(std::make_unique<UiDelegate>(this)),
model_(std::make_unique<UnifiedSystemTrayModel>(shelf)),
model_(std::make_unique<UnifiedSystemTrayModel>(
shelf->GetStatusAreaWidget()->GetRootView())),
slider_bubble_controller_(
std::make_unique<UnifiedSliderBubbleController>(this)),
privacy_screen_toast_controller_(
......@@ -134,7 +136,7 @@ UnifiedSystemTray::UnifiedSystemTray(Shelf* shelf)
new CameraMicTrayItemView(shelf, CameraMicTrayItemView::Type::kMic)),
notification_counter_item_(new NotificationCounterView(shelf)),
quiet_mode_view_(new QuietModeView(shelf)),
time_view_(new tray::TimeTrayItemView(shelf, model())) {
time_view_(new tray::TimeTrayItemView(shelf)) {
tray_container()->SetMargin(
kUnifiedTrayContentPadding -
ShelfConfig::Get()->status_area_hit_region_padding(),
......
......@@ -5,24 +5,11 @@
#include "ash/system/unified/unified_system_tray_model.h"
#include "ash/accessibility/accessibility_controller_impl.h"
#include "ash/shelf/shelf_widget.h"
#include "ash/shell.h"
#include "ash/shell_observer.h"
#include "ash/system/brightness_control_delegate.h"
#include "ash/system/status_area_widget.h"
#include "base/bind.h"
#include "chromeos/dbus/power_manager/backlight.pb.h"
namespace {
// The minimum width for system tray with size of kMedium.
constexpr int kMinWidthMediumSystemTray = 800;
// The maximum width for system tray with size of kMedium.
constexpr int kMaxWidthMediumSystemTray = 1280;
} // namespace
namespace ash {
class UnifiedSystemTrayModel::DBusObserver
......@@ -47,31 +34,6 @@ class UnifiedSystemTrayModel::DBusObserver
DISALLOW_COPY_AND_ASSIGN(DBusObserver);
};
class UnifiedSystemTrayModel::SizeObserver : public display::DisplayObserver,
public ShellObserver {
public:
explicit SizeObserver(UnifiedSystemTrayModel* owner);
~SizeObserver() override;
SizeObserver(const SizeObserver&) = delete;
SizeObserver& operator=(const SizeObserver&) = delete;
private:
// display::DisplayObserver:
void OnDisplayMetricsChanged(const display::Display& display,
uint32_t changed_metrics) override;
// ShellObserver:
void OnShelfAlignmentChanged(aura::Window* root_window,
ShelfAlignment old_alignment) override;
void Update();
UnifiedSystemTrayModel* const owner_;
// Keep track of current system tray size.
UnifiedSystemTrayModel::SystemTrayButtonSize system_tray_size_;
};
UnifiedSystemTrayModel::DBusObserver::DBusObserver(
UnifiedSystemTrayModel* owner)
: owner_(owner) {
......@@ -110,51 +72,9 @@ void UnifiedSystemTrayModel::DBusObserver::KeyboardBrightnessChanged(
power_manager::BacklightBrightnessChange_Cause_USER_REQUEST);
}
UnifiedSystemTrayModel::SizeObserver::SizeObserver(
UnifiedSystemTrayModel* owner)
: owner_(owner) {
display::Screen::GetScreen()->AddObserver(this);
Shell::Get()->AddShellObserver(this);
system_tray_size_ = owner_->GetSystemTrayButtonSize();
}
UnifiedSystemTrayModel::SizeObserver::~SizeObserver() {
display::Screen::GetScreen()->RemoveObserver(this);
Shell::Get()->RemoveShellObserver(this);
}
void UnifiedSystemTrayModel::SizeObserver::OnDisplayMetricsChanged(
const display::Display& display,
uint32_t changed_metrics) {
if (owner_->GetDisplay().id() != display.id())
return;
Update();
}
void UnifiedSystemTrayModel::SizeObserver::OnShelfAlignmentChanged(
aura::Window* root_window,
ShelfAlignment old_alignment) {
Update();
}
void UnifiedSystemTrayModel::SizeObserver::Update() {
UnifiedSystemTrayModel::SystemTrayButtonSize new_size =
owner_->GetSystemTrayButtonSize();
if (system_tray_size_ == new_size)
return;
system_tray_size_ = new_size;
owner_->SystemTrayButtonSizeChanged(system_tray_size_);
}
UnifiedSystemTrayModel::UnifiedSystemTrayModel(Shelf* shelf)
: shelf_(shelf),
dbus_observer_(std::make_unique<DBusObserver>(this)),
size_observer_(std::make_unique<SizeObserver>(this)) {
// |shelf_| might be null in unit tests.
pagination_model_ = std::make_unique<PaginationModel>(
shelf_ ? shelf_->GetStatusAreaWidget()->GetRootView() : nullptr);
}
UnifiedSystemTrayModel::UnifiedSystemTrayModel(views::View* owner_view)
: dbus_observer_(std::make_unique<DBusObserver>(this)),
pagination_model_(std::make_unique<PaginationModel>(owner_view)) {}
UnifiedSystemTrayModel::~UnifiedSystemTrayModel() = default;
......@@ -204,23 +124,6 @@ void UnifiedSystemTrayModel::ClearNotificationChanges() {
notification_changes_.clear();
}
UnifiedSystemTrayModel::SystemTrayButtonSize
UnifiedSystemTrayModel::GetSystemTrayButtonSize() const {
// |shelf_| might be null in unit tests, returns medium size as default.
if (!shelf_)
return SystemTrayButtonSize::kMedium;
int display_size = shelf_->IsHorizontalAlignment()
? GetDisplay().size().width()
: GetDisplay().size().height();
if (display_size < kMinWidthMediumSystemTray)
return SystemTrayButtonSize::kSmall;
if (display_size <= kMaxWidthMediumSystemTray)
return SystemTrayButtonSize::kMedium;
return SystemTrayButtonSize::kLarge;
}
void UnifiedSystemTrayModel::DisplayBrightnessChanged(float brightness,
bool by_user) {
display_brightness_ = brightness;
......@@ -235,22 +138,4 @@ void UnifiedSystemTrayModel::KeyboardBrightnessChanged(float brightness,
observer.OnKeyboardBrightnessChanged(by_user);
}
void UnifiedSystemTrayModel::SystemTrayButtonSizeChanged(
SystemTrayButtonSize system_tray_size) {
for (auto& observer : observers_)
observer.OnSystemTrayButtonSizeChanged(system_tray_size);
}
const display::Display UnifiedSystemTrayModel::GetDisplay() const {
// |shelf_| might be null in unit tests, returns primary display as default.
if (!shelf_)
return display::Screen::GetScreen()->GetPrimaryDisplay();
return display::Screen::GetScreen()->GetDisplayNearestWindow(
shelf_->GetStatusAreaWidget()
->GetRootView()
->GetWidget()
->GetNativeWindow());
}
} // namespace ash
......@@ -10,14 +10,8 @@
#include "base/observer_list.h"
#include "chromeos/dbus/power/power_manager_client.h"
namespace display {
class Display;
} // namespace display
namespace ash {
class Shelf;
// Model class that stores UnifiedSystemTray's UI specific variables. Owned by
// UnifiedSystemTray status area button. Not to be confused with UI agnostic
// SystemTrayModel.
......@@ -42,19 +36,6 @@ class ASH_EXPORT UnifiedSystemTrayModel {
NOTIFICATION_ID,
};
// Enumeration of possible sizes of the system tray button. Larger screen will
// have larger tray button with additional information.
enum class SystemTrayButtonSize {
// Display wifi, battery, notification counter icons and time.
kSmall = 0,
// Display those in small unified system tray, plus important notification
// icons.
kMedium = 1,
// Display those in medium unified system tray, plus the current date.
kLarge = 2,
kMaxValue = kLarge,
};
class Observer {
public:
virtual ~Observer() {}
......@@ -62,11 +43,9 @@ class ASH_EXPORT UnifiedSystemTrayModel {
// |by_user| is true when brightness is changed by user action.
virtual void OnDisplayBrightnessChanged(bool by_user) {}
virtual void OnKeyboardBrightnessChanged(bool by_user) {}
virtual void OnSystemTrayButtonSizeChanged(
SystemTrayButtonSize system_tray_size) {}
};
explicit UnifiedSystemTrayModel(Shelf* shelf);
explicit UnifiedSystemTrayModel(views::View* owner_view);
~UnifiedSystemTrayModel();
void AddObserver(Observer* observer);
......@@ -99,9 +78,6 @@ class ASH_EXPORT UnifiedSystemTrayModel {
// NOTIFICATION_ID.
void SetTargetNotification(const std::string& notification_id);
// Get the size of the system tray depends on the size of the display screen.
SystemTrayButtonSize GetSystemTrayButtonSize() const;
float display_brightness() const { return display_brightness_; }
float keyboard_brightness() const { return keyboard_brightness_; }
......@@ -126,15 +102,8 @@ class ASH_EXPORT UnifiedSystemTrayModel {
private:
class DBusObserver;
// Keeps track all the sources that can change the size of system tray button.
class SizeObserver;
void DisplayBrightnessChanged(float brightness, bool by_user);
void KeyboardBrightnessChanged(float brightness, bool by_user);
void SystemTrayButtonSizeChanged(SystemTrayButtonSize system_tray_size);
// Get the display that owns the tray.
const display::Display GetDisplay() const;
// Target mode which is used to decide the scroll position of the message
// center on opening. See the comment in |NotificationTargetMode|.
......@@ -159,12 +128,8 @@ class ASH_EXPORT UnifiedSystemTrayModel {
// <notification ID, if notification is manually expanded>
std::map<std::string, bool> notification_changes_;
Shelf* const shelf_;
std::unique_ptr<DBusObserver> dbus_observer_;
std::unique_ptr<SizeObserver> size_observer_;
base::ObserverList<Observer>::Unchecked observers_;
std::unique_ptr<PaginationModel> pagination_model_;
......
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