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