Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

Unified Diff: ash/common/system/audio/volume_view.cc

Issue 2234823003: Make the mute button in the Ash system menu keyboard focusable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: override GetAccessibleState Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/ash_strings.grd ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/system/audio/volume_view.cc
diff --git a/ash/common/system/audio/volume_view.cc b/ash/common/system/audio/volume_view.cc
index 6435bac72442a11c2adea7f8446445d59eac75d7..ee36be3b6f38b960960e6f11cf6dcb9eb6ff4034 100644
--- a/ash/common/system/audio/volume_view.cc
+++ b/ash/common/system/audio/volume_view.cc
@@ -15,6 +15,7 @@
#include "ash/common/wm_shell.h"
#include "grit/ash_resources.h"
#include "grit/ash_strings.h"
+#include "ui/accessibility/ax_view_state.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/image/image_skia_operations.h"
@@ -26,6 +27,7 @@
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/separator.h"
#include "ui/views/layout/box_layout.h"
+#include "ui/views/painter.h"
namespace {
const int kVolumeImageWidth = 25;
@@ -54,6 +56,9 @@ class VolumeButton : public views::ToggleImageButton {
: views::ToggleImageButton(listener),
audio_delegate_(audio_delegate),
image_index_(-1) {
+ SetFocusBehavior(FocusBehavior::ALWAYS);
+ SetFocusPainter(views::Painter::CreateSolidFocusPainter(
+ kFocusBorderColor, gfx::Insets(1, 1, 1, 1)));
SetImageAlignment(ALIGN_CENTER, ALIGN_MIDDLE);
image_ = ui::ResourceBundle::GetSharedInstance().GetImageNamed(
IDR_AURA_UBER_TRAY_VOLUME_LEVELS);
@@ -89,6 +94,14 @@ class VolumeButton : public views::ToggleImageButton {
return size;
}
+ void GetAccessibleState(ui::AXViewState* state) override {
+ ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
+ state->name = bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_VOLUME_MUTE);
+ state->role = ui::AX_ROLE_TOGGLE_BUTTON;
+ if (audio_delegate_->IsOutputAudioMuted())
+ state->AddStateFlag(ui::AX_STATE_PRESSED);
+ }
+
// views::CustomButton:
void StateChanged() override {
if (state() == STATE_HOVERED || state() == STATE_PRESSED) {
« no previous file with comments | « ash/ash_strings.grd ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698