Commit 373abe24 authored by Aaron Leventhal's avatar Aaron Leventhal Committed by Commit Bot

Accessible names for nameless focusable glass browser frame buttons

This is split out from the CL to test all widgets and views for nameless
focusable objects. See crrev.com/c/951933.

Bug: 819350
Change-Id: If1a9f377c0179c0b4b9b1f18d870ccccfc221296
Reviewed-on: https://chromium-review.googlesource.com/952328
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#541653}
parent d3c6f1b7
......@@ -22,6 +22,7 @@
#include "chrome/browser/win/titlebar_config.h"
#include "content/public/browser/web_contents.h"
#include "skia/ext/image_operations.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle_win.h"
#include "ui/base/theme_provider.h"
#include "ui/display/win/dpi.h"
......@@ -31,6 +32,7 @@
#include "ui/gfx/icon_util.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/scoped_canvas.h"
#include "ui/strings/grit/ui_strings.h"
#include "ui/views/resources/grit/views_resources.h"
#include "ui/views/win/hwnd_util.h"
#include "ui/views/window/client_view.h"
......@@ -119,10 +121,14 @@ GlassBrowserFrameView::GlassBrowserFrameView(BrowserFrame* frame,
AddChildView(window_title_);
}
minimize_button_ = CreateCaptionButton(VIEW_ID_MINIMIZE_BUTTON);
maximize_button_ = CreateCaptionButton(VIEW_ID_MAXIMIZE_BUTTON);
restore_button_ = CreateCaptionButton(VIEW_ID_RESTORE_BUTTON);
close_button_ = CreateCaptionButton(VIEW_ID_CLOSE_BUTTON);
minimize_button_ =
CreateCaptionButton(VIEW_ID_MINIMIZE_BUTTON, IDS_APP_ACCNAME_MINIMIZE);
maximize_button_ =
CreateCaptionButton(VIEW_ID_MAXIMIZE_BUTTON, IDS_APP_ACCNAME_MAXIMIZE);
restore_button_ =
CreateCaptionButton(VIEW_ID_RESTORE_BUTTON, IDS_APP_ACCNAME_RESTORE);
close_button_ =
CreateCaptionButton(VIEW_ID_CLOSE_BUTTON, IDS_APP_ACCNAME_CLOSE);
}
GlassBrowserFrameView::~GlassBrowserFrameView() {
......@@ -586,9 +592,11 @@ SkColor GlassBrowserFrameView::GetTitlebarColor() const {
}
Windows10CaptionButton* GlassBrowserFrameView::CreateCaptionButton(
ViewID button_type) {
Windows10CaptionButton* button =
new Windows10CaptionButton(this, button_type);
ViewID button_type,
int accessible_name_resource_id) {
Windows10CaptionButton* button = new Windows10CaptionButton(
this, button_type,
l10n_util::GetStringUTF16(accessible_name_resource_id));
AddChildView(button);
return button;
}
......
......@@ -131,7 +131,8 @@ class GlassBrowserFrameView : public BrowserNonClientFrameView,
bool ShowCustomTitle() const;
bool ShowSystemIcon() const;
Windows10CaptionButton* CreateCaptionButton(ViewID button_type);
Windows10CaptionButton* CreateCaptionButton(ViewID button_type,
int accessible_name_resource_id);
// Paint various sub-components of this view.
void PaintTitlebar(gfx::Canvas* canvas) const;
......
......@@ -16,11 +16,13 @@
Windows10CaptionButton::Windows10CaptionButton(
GlassBrowserFrameView* frame_view,
ViewID button_type)
ViewID button_type,
const base::string16& accessible_name)
: views::Button(frame_view),
frame_view_(frame_view),
button_type_(button_type) {
set_animate_on_state_change(true);
SetAccessibleName(accessible_name);
}
gfx::Size Windows10CaptionButton::CalculatePreferredSize() const {
......
......@@ -13,7 +13,9 @@ class GlassBrowserFrameView;
class Windows10CaptionButton : public views::Button {
public:
Windows10CaptionButton(GlassBrowserFrameView* frame_view, ViewID button_type);
Windows10CaptionButton(GlassBrowserFrameView* frame_view,
ViewID button_type,
const base::string16& accessible_name);
// views::Button:
gfx::Size CalculatePreferredSize() const override;
......
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