Commit b46532dd authored by Ahmed Mehfooz's avatar Ahmed Mehfooz Committed by Commit Bot

Make message view control buttons visible if chrome vox is enabled

There is currently no way to close notifications in tablet
mode with chrome vox enabled.

Bug: 1022595
Change-Id: Ia7fcfa5139bed04cfc465e2342b0938b6431c89f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2072910
Commit-Queue: Ahmed Mehfooz <amehfooz@chromium.org>
Reviewed-by: default avatarTim Song <tengs@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#746913}
parent 673cb0b9
...@@ -1507,6 +1507,7 @@ void AccessibilityControllerImpl::UpdateSpokenFeedbackFromPref() { ...@@ -1507,6 +1507,7 @@ void AccessibilityControllerImpl::UpdateSpokenFeedbackFromPref() {
return; return;
spoken_feedback_enabled_ = enabled; spoken_feedback_enabled_ = enabled;
message_center::MessageCenter::Get()->SetSpokenFeedbackEnabled(enabled);
NotifyAccessibilityStatusChanged(); NotifyAccessibilityStatusChanged();
......
...@@ -40,6 +40,10 @@ bool FakeMessageCenter::IsQuietMode() const { ...@@ -40,6 +40,10 @@ bool FakeMessageCenter::IsQuietMode() const {
return false; return false;
} }
bool FakeMessageCenter::IsSpokenFeedbackEnabled() const {
return false;
}
Notification* FakeMessageCenter::FindVisibleNotificationById( Notification* FakeMessageCenter::FindVisibleNotificationById(
const std::string& id) { const std::string& id) {
const auto& notifications = GetVisibleNotifications(); const auto& notifications = GetVisibleNotifications();
...@@ -133,6 +137,8 @@ void FakeMessageCenter::DisplayedNotification(const std::string& id, ...@@ -133,6 +137,8 @@ void FakeMessageCenter::DisplayedNotification(const std::string& id,
void FakeMessageCenter::SetQuietMode(bool in_quiet_mode) {} void FakeMessageCenter::SetQuietMode(bool in_quiet_mode) {}
void FakeMessageCenter::SetSpokenFeedbackEnabled(bool enabled) {}
void FakeMessageCenter::EnterQuietModeWithExpire( void FakeMessageCenter::EnterQuietModeWithExpire(
const base::TimeDelta& expires_in) {} const base::TimeDelta& expires_in) {}
......
...@@ -32,6 +32,7 @@ class FakeMessageCenter : public MessageCenter { ...@@ -32,6 +32,7 @@ class FakeMessageCenter : public MessageCenter {
size_t NotificationCount() const override; size_t NotificationCount() const override;
bool HasPopupNotifications() const override; bool HasPopupNotifications() const override;
bool IsQuietMode() const override; bool IsQuietMode() const override;
bool IsSpokenFeedbackEnabled() const override;
Notification* FindVisibleNotificationById(const std::string& id) override; Notification* FindVisibleNotificationById(const std::string& id) override;
NotificationList::Notifications FindNotificationsByAppId( NotificationList::Notifications FindNotificationsByAppId(
const std::string& app_id) override; const std::string& app_id) override;
...@@ -64,6 +65,7 @@ class FakeMessageCenter : public MessageCenter { ...@@ -64,6 +65,7 @@ class FakeMessageCenter : public MessageCenter {
void DisplayedNotification(const std::string& id, void DisplayedNotification(const std::string& id,
const DisplaySource source) override; const DisplaySource source) override;
void SetQuietMode(bool in_quiet_mode) override; void SetQuietMode(bool in_quiet_mode) override;
void SetSpokenFeedbackEnabled(bool enabled) override;
void EnterQuietModeWithExpire(const base::TimeDelta& expires_in) override; void EnterQuietModeWithExpire(const base::TimeDelta& expires_in) override;
void SetVisibility(Visibility visible) override; void SetVisibility(Visibility visible) override;
bool IsMessageCenterVisible() const override; bool IsMessageCenterVisible() const override;
......
...@@ -74,6 +74,9 @@ class MESSAGE_CENTER_EXPORT MessageCenter { ...@@ -74,6 +74,9 @@ class MESSAGE_CENTER_EXPORT MessageCenter {
virtual bool HasPopupNotifications() const = 0; virtual bool HasPopupNotifications() const = 0;
virtual bool IsQuietMode() const = 0; virtual bool IsQuietMode() const = 0;
// Returns true if chrome vox spoken feedback is enabled.
virtual bool IsSpokenFeedbackEnabled() const = 0;
// Find the notification with the corresponding id. Returns null if not // Find the notification with the corresponding id. Returns null if not
// found. The returned instance is owned by the message center. // found. The returned instance is owned by the message center.
virtual Notification* FindVisibleNotificationById(const std::string& id) = 0; virtual Notification* FindVisibleNotificationById(const std::string& id) = 0;
...@@ -168,6 +171,9 @@ class MESSAGE_CENTER_EXPORT MessageCenter { ...@@ -168,6 +171,9 @@ class MESSAGE_CENTER_EXPORT MessageCenter {
// This can be called to change the quiet mode state (without a timeout). // This can be called to change the quiet mode state (without a timeout).
virtual void SetQuietMode(bool in_quiet_mode) = 0; virtual void SetQuietMode(bool in_quiet_mode) = 0;
// Used to set the spoken feedback state.
virtual void SetSpokenFeedbackEnabled(bool enabled) = 0;
// Temporarily enables quiet mode for |expires_in| time. // Temporarily enables quiet mode for |expires_in| time.
virtual void EnterQuietModeWithExpire(const base::TimeDelta& expires_in) = 0; virtual void EnterQuietModeWithExpire(const base::TimeDelta& expires_in) = 0;
......
...@@ -141,6 +141,10 @@ bool MessageCenterImpl::IsQuietMode() const { ...@@ -141,6 +141,10 @@ bool MessageCenterImpl::IsQuietMode() const {
return notification_list_->quiet_mode(); return notification_list_->quiet_mode();
} }
bool MessageCenterImpl::IsSpokenFeedbackEnabled() const {
return spoken_feedback_enabled_;
}
Notification* MessageCenterImpl::FindVisibleNotificationById( Notification* MessageCenterImpl::FindVisibleNotificationById(
const std::string& id) { const std::string& id) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
...@@ -449,6 +453,10 @@ void MessageCenterImpl::SetQuietMode(bool in_quiet_mode) { ...@@ -449,6 +453,10 @@ void MessageCenterImpl::SetQuietMode(bool in_quiet_mode) {
quiet_mode_timer_.reset(); quiet_mode_timer_.reset();
} }
void MessageCenterImpl::SetSpokenFeedbackEnabled(bool enabled) {
spoken_feedback_enabled_ = enabled;
}
void MessageCenterImpl::EnterQuietModeWithExpire( void MessageCenterImpl::EnterQuietModeWithExpire(
const base::TimeDelta& expires_in) { const base::TimeDelta& expires_in) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
......
...@@ -49,6 +49,7 @@ class MessageCenterImpl : public MessageCenter, ...@@ -49,6 +49,7 @@ class MessageCenterImpl : public MessageCenter,
size_t NotificationCount() const override; size_t NotificationCount() const override;
bool HasPopupNotifications() const override; bool HasPopupNotifications() const override;
bool IsQuietMode() const override; bool IsQuietMode() const override;
bool IsSpokenFeedbackEnabled() const override;
Notification* FindVisibleNotificationById(const std::string& id) override; Notification* FindVisibleNotificationById(const std::string& id) override;
NotificationList::Notifications FindNotificationsByAppId( NotificationList::Notifications FindNotificationsByAppId(
const std::string& app_id) override; const std::string& app_id) override;
...@@ -78,6 +79,7 @@ class MessageCenterImpl : public MessageCenter, ...@@ -78,6 +79,7 @@ class MessageCenterImpl : public MessageCenter,
void DisplayedNotification(const std::string& id, void DisplayedNotification(const std::string& id,
const DisplaySource source) override; const DisplaySource source) override;
void SetQuietMode(bool in_quiet_mode) override; void SetQuietMode(bool in_quiet_mode) override;
void SetSpokenFeedbackEnabled(bool enabled) override;
void EnterQuietModeWithExpire(const base::TimeDelta& expires_in) override; void EnterQuietModeWithExpire(const base::TimeDelta& expires_in) override;
void RestartPopupTimers() override; void RestartPopupTimers() override;
void PausePopupTimers() override; void PausePopupTimers() override;
...@@ -115,6 +117,7 @@ class MessageCenterImpl : public MessageCenter, ...@@ -115,6 +117,7 @@ class MessageCenterImpl : public MessageCenter,
bool visible_ = false; bool visible_ = false;
bool has_message_center_view_ = true; bool has_message_center_view_ = true;
bool spoken_feedback_enabled_ = false;
base::string16 system_notification_app_name_; base::string16 system_notification_app_name_;
......
...@@ -449,7 +449,8 @@ bool MessageView::ShouldShowControlButtons() const { ...@@ -449,7 +449,8 @@ bool MessageView::ShouldShowControlButtons() const {
auto* control_buttons_view = GetControlButtonsView(); auto* control_buttons_view = GetControlButtonsView();
return control_buttons_view && return control_buttons_view &&
(control_buttons_view->IsAnyButtonFocused() || (control_buttons_view->IsAnyButtonFocused() ||
(GetMode() != Mode::SETTING && IsMouseHovered())); (GetMode() != Mode::SETTING && IsMouseHovered()) ||
MessageCenter::Get()->IsSpokenFeedbackEnabled());
#else #else
return true; return true;
#endif #endif
......
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