Commit f708c466 authored by Tetsui Ohkubo's avatar Tetsui Ohkubo Committed by Commit Bot

Remove notifier settings access from outside

On Chrome OS, there's no way to access notifier settings bubble from
outside MessageCenterView, as right click menu is removed and inline
settings is introduced. Therefore, they are dead code right now.

BUG=802997

Change-Id: If498fa9b8949975d4c7c06a38667798b7124fc12
Reviewed-on: https://chromium-review.googlesource.com/1168268Reviewed-by: default avatarYoshiki Iguchi <yoshiki@chromium.org>
Commit-Queue: Tetsui Ohkubo <tetsui@chromium.org>
Cr-Commit-Position: refs/heads/master@{#582490}
parent fcd63c07
......@@ -106,19 +106,11 @@ void MessageCenterBubble::SetMaxHeight(int height) {
message_center_view_->SetMaxHeight(max_height_);
}
void MessageCenterBubble::SetSettingsVisible() {
if (message_center_view_)
message_center_view_->SetSettingsVisible(true);
else
initially_settings_visible_ = true;
}
void MessageCenterBubble::InitializeContents(
views::TrayBubbleView* new_bubble_view) {
bubble_view_ = new_bubble_view;
bubble_view_->GetWidget()->AddObserver(this);
message_center_view_ = new MessageCenterView(message_center_, max_height_,
initially_settings_visible_);
message_center_view_ = new MessageCenterView(message_center_, max_height_);
bubble_view_->AddChildView(new ContentsView(this, message_center_view_));
message_center_view_->SetMaxHeight(max_height_);
message_center_view_->Init();
......
......@@ -41,8 +41,6 @@ class MessageCenterBubble : public views::WidgetObserver,
void SetMaxHeight(int height);
int max_height() const { return max_height_; }
void SetSettingsVisible();
// Called after the bubble view has been constructed. Creates and initializes
// the bubble contents.
void InitializeContents(views::TrayBubbleView* bubble_view);
......@@ -67,9 +65,6 @@ class MessageCenterBubble : public views::WidgetObserver,
// InitializeContents.
MessageCenterView* message_center_view_ = nullptr;
// Use settings view as the initially visible content if true.
bool initially_settings_visible_ = false;
int max_height_;
base::WeakPtrFactory<MessageCenterBubble> weak_ptr_factory_{this};
......
......@@ -106,7 +106,6 @@ views::Separator* CreateVerticalSeparator() {
MessageCenterButtonBar::MessageCenterButtonBar(
MessageCenterView* message_center_view,
MessageCenter* message_center,
bool settings_initially_visible,
bool locked)
: message_center_view_(message_center_view),
message_center_(message_center),
......@@ -191,8 +190,8 @@ MessageCenterButtonBar::MessageCenterButtonBar(
AddChildView(button_container_);
SetCloseAllButtonEnabled(!settings_initially_visible);
SetBackArrowVisible(settings_initially_visible);
SetCloseAllButtonEnabled(true);
SetBackArrowVisible(false);
}
MessageCenterButtonBar::~MessageCenterButtonBar() = default;
......
......@@ -34,7 +34,6 @@ class MessageCenterButtonBar : public views::View,
public:
MessageCenterButtonBar(MessageCenterView* message_center_view,
message_center::MessageCenter* message_center,
bool settings_initially_visible,
bool locked);
~MessageCenterButtonBar() override;
......
......@@ -107,16 +107,6 @@ void MessageCenterUiController::HidePopupBubbleInternal() {
popups_visible_ = false;
}
void MessageCenterUiController::ShowNotifierSettingsBubble() {
if (popups_visible_)
HidePopupBubbleInternal();
message_center_visible_ = delegate_->ShowNotifierSettings();
message_center_->SetVisibility(message_center::VISIBILITY_SETTINGS);
NotifyUiControllerChanged();
}
void MessageCenterUiController::OnNotificationAdded(
const std::string& notification_id) {
OnMessageCenterChanged();
......@@ -141,11 +131,6 @@ void MessageCenterUiController::OnNotificationClicked(
OnMessageCenterChanged();
}
void MessageCenterUiController::OnNotificationSettingsClicked(bool handled) {
if (!handled)
ShowNotifierSettingsBubble();
}
void MessageCenterUiController::OnNotificationDisplayed(
const std::string& notification_id,
const message_center::DisplaySource source) {
......
......@@ -50,9 +50,6 @@ class ASH_EXPORT MessageCenterUiController
// Returns whether the popup was visible before.
bool HidePopupBubble();
// Toggles the visibility of the settings view in the message center bubble.
void ShowNotifierSettingsBubble();
bool message_center_visible() { return message_center_visible_; }
bool popups_visible() { return popups_visible_; }
MessageCenterUiDelegate* delegate() { return delegate_; }
......@@ -73,7 +70,6 @@ class ASH_EXPORT MessageCenterUiController
const std::string& notification_id,
const base::Optional<int>& button_index,
const base::Optional<base::string16>& reply) override;
void OnNotificationSettingsClicked(bool handled) override;
void OnNotificationDisplayed(
const std::string& notification_id,
const message_center::DisplaySource source) override;
......
......@@ -40,7 +40,6 @@ class MockDelegate : public MessageCenterUiDelegate {
return show_popups_success_;
}
void HideMessageCenter() override {}
bool ShowNotifierSettings() override { return true; }
bool show_popups_success_ = true;
bool show_message_center_success_ = true;
......
......@@ -32,9 +32,6 @@ class MessageCenterUiDelegate {
// Remove the message center from the UI.
virtual void HideMessageCenter() = 0;
// Display the notifier settings as a bubble.
virtual bool ShowNotifierSettings() = 0;
};
} // namespace ash
......
......@@ -181,24 +181,19 @@ class ScrollShadowView : public views::View {
// MessageCenterView ///////////////////////////////////////////////////////////
MessageCenterView::MessageCenterView(
MessageCenter* message_center,
int max_height,
bool initially_settings_visible)
MessageCenterView::MessageCenterView(MessageCenter* message_center,
int max_height)
: message_center_(message_center),
settings_visible_(initially_settings_visible),
settings_visible_(false),
is_locked_(Shell::Get()->session_controller()->IsScreenLocked()) {
if (is_locked_ && !AshMessageCenterLockScreenController::IsEnabled())
mode_ = Mode::LOCKED;
else if (initially_settings_visible)
mode_ = Mode::SETTINGS;
message_center_->AddObserver(this);
set_notify_enter_exit_on_child(true);
SetFocusBehavior(views::View::FocusBehavior::NEVER);
button_bar_ = new MessageCenterButtonBar(
this, message_center, initially_settings_visible, is_locked_);
button_bar_ = new MessageCenterButtonBar(this, message_center, is_locked_);
button_bar_->SetCloseAllButtonEnabled(false);
const int button_height = button_bar_->GetPreferredSize().height();
......@@ -523,11 +518,6 @@ void MessageCenterView::OnQuietModeChanged(bool is_quiet_mode) {
void MessageCenterView::AnimationEnded(const gfx::Animation* animation) {
DCHECK_EQ(animation, settings_transition_animation_.get());
message_center::Visibility visibility =
mode_ == Mode::SETTINGS ? message_center::VISIBILITY_SETTINGS
: message_center::VISIBILITY_MESSAGE_CENTER;
message_center_->SetVisibility(visibility);
if (source_view_) {
source_view_->SetVisible(false);
}
......
......@@ -48,8 +48,7 @@ class ASH_EXPORT MessageCenterView
public views::ViewObserver {
public:
MessageCenterView(message_center::MessageCenter* message_center,
int max_height,
bool initially_settings_visible);
int max_height);
~MessageCenterView() override;
void Init();
......
......@@ -131,9 +131,7 @@ class FakeMessageCenterImpl : public FakeMessageCenter {
// in it, hence MockMessageCenterView.
class MockMessageCenterView : public MessageCenterView {
public:
MockMessageCenterView(MessageCenter* message_center,
int max_height,
bool initially_settings_visible);
MockMessageCenterView(MessageCenter* message_center, int max_height);
bool SetRepositionTarget() override;
......@@ -144,11 +142,8 @@ class MockMessageCenterView : public MessageCenterView {
};
MockMessageCenterView::MockMessageCenterView(MessageCenter* message_center,
int max_height,
bool initially_settings_visible)
: MessageCenterView(message_center,
max_height,
initially_settings_visible) {}
int max_height)
: MessageCenterView(message_center, max_height) {}
// Always say that the current reposition session is still active, by
// returning true. Normally the reposition session is set based on where the
......@@ -265,7 +260,7 @@ void MessageCenterViewTest::SetUp() {
// Then create a new MockMessageCenterView with that single notification.
message_center_view_.reset(
new MockMessageCenterView(message_center_.get(), 600, false));
new MockMessageCenterView(message_center_.get(), 600));
GetMessageCenterView()->SetBounds(0, 0, 380, 100);
message_center_view_->SetNotifications(notifications);
message_center_view_->set_owned_by_client();
......
......@@ -344,8 +344,7 @@ void NotificationTray::DisableAnimationsForTest(bool disable) {
// Public methods.
bool NotificationTray::ShowMessageCenterInternal(bool show_settings,
bool show_by_click) {
bool NotificationTray::ShowMessageCenter(bool show_by_click) {
if (!ShouldShowMessageCenter())
return false;
......@@ -365,9 +364,6 @@ bool NotificationTray::ShowMessageCenterInternal(bool show_settings,
// screen. This padding should be applied in all types of shelf alignment.
message_center_bubble->SetMaxHeight(max_height - kPaddingFromScreenTop);
if (show_settings)
message_center_bubble->SetSettingsVisible();
// For vertical shelf alignments, anchor to the NotificationTray, but for
// horizontal (i.e. bottom) shelves, anchor to the system tray.
TrayBackgroundView* anchor_tray = this;
......@@ -382,10 +378,6 @@ bool NotificationTray::ShowMessageCenterInternal(bool show_settings,
return true;
}
bool NotificationTray::ShowMessageCenter(bool show_by_click) {
return ShowMessageCenterInternal(false /* show_settings */, show_by_click);
}
void NotificationTray::HideMessageCenter() {
if (!message_center_bubble())
return;
......@@ -502,16 +494,6 @@ void NotificationTray::HideBubble(const views::TrayBubbleView* bubble_view) {
HideBubbleWithView(bubble_view);
}
bool NotificationTray::ShowNotifierSettings() {
if (IsMessageCenterVisible()) {
static_cast<MessageCenterBubble*>(message_center_bubble()->bubble())
->SetSettingsVisible();
return true;
}
return ShowMessageCenterInternal(true /* show_settings */,
false /* show_by_click */);
}
void NotificationTray::OnMessageCenterContentsChanged() {
// Do not update the tray contents directly. Multiple change events can happen
// consecutively, and calling Update in the middle of those events will show
......
......@@ -85,7 +85,6 @@ class ASH_EXPORT NotificationTray
void HideMessageCenter() override;
bool ShowPopups() override;
void HidePopups() override;
bool ShowNotifierSettings() override;
// Activates the notification tray bubble.
void ActivateBubble();
......@@ -109,12 +108,6 @@ class ASH_EXPORT NotificationTray
void UpdateTrayContent();
// The actual process to show the message center. Set |show_settings| to true
// if the message center should be initialized with the settings visible. Set
// |show_by_click| to true if the message center is shown by mouse or gesture
// click. Returns true if the center is successfully created.
bool ShowMessageCenterInternal(bool show_settings, bool show_by_click);
// Queries login status and the status area widget to determine visibility of
// the message center.
bool ShouldShowMessageCenter() const;
......
......@@ -45,7 +45,6 @@ class UnifiedSystemTray::UiDelegate : public MessageCenterUiDelegate {
void HidePopups() override;
bool ShowMessageCenter(bool show_by_click) override;
void HideMessageCenter() override;
bool ShowNotifierSettings() override;
MessageCenterUiController* ui_controller() { return ui_controller_.get(); }
......@@ -109,10 +108,6 @@ void UnifiedSystemTray::UiDelegate::HideMessageCenter() {
owner_->HideBubbleInternal();
}
bool UnifiedSystemTray::UiDelegate::ShowNotifierSettings() {
return false;
}
class UnifiedSystemTray::NetworkStateDelegate
: public TrayNetworkStateObserver::Delegate {
public:
......
......@@ -129,9 +129,6 @@ void MessageCenterStatsCollector::OnCenterVisibilityChanged(
base::RecordAction(
base::UserMetricsAction("Notifications.ShowMessageCenter"));
break;
case VISIBILITY_SETTINGS:
base::RecordAction(base::UserMetricsAction("Notifications.ShowSettings"));
break;
}
}
......
......@@ -12,8 +12,6 @@ enum Visibility {
VISIBILITY_TRANSIENT = 0,
// When the message center view is being displayed.
VISIBILITY_MESSAGE_CENTER,
// When the settings view is being displayed.
VISIBILITY_SETTINGS,
};
// Identifies the source of a displayed notification.
......
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