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

Unified Diff: chrome/browser/ui/cocoa/profiles/avatar_button_controller.mm

Issue 471703002: [Mac] Add accessibility features to the new avatar menu (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix a bunch of rebase mishaps >_< Created 6 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 | « chrome/app/generated_resources.grd ('k') | chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/profiles/avatar_button_controller.mm
diff --git a/chrome/browser/ui/cocoa/profiles/avatar_button_controller.mm b/chrome/browser/ui/cocoa/profiles/avatar_button_controller.mm
index 65024ab6b23c8b4839acc84e31de4e08c5b70cdd..08be14c19134bb8ff37e3458011a77edfc909d69 100644
--- a/chrome/browser/ui/cocoa/profiles/avatar_button_controller.mm
+++ b/chrome/browser/ui/cocoa/profiles/avatar_button_controller.mm
@@ -13,9 +13,11 @@
#include "chrome/browser/ui/browser_window.h"
#import "chrome/browser/ui/cocoa/browser_window_controller.h"
#include "components/signin/core/browser/signin_error_controller.h"
+#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
#import "ui/base/cocoa/appkit_utils.h"
#import "ui/base/cocoa/hover_image_button.h"
+#include "ui/base/l10n/l10n_util_mac.h"
#include "ui/base/nine_image_painter_factory.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/image/image_skia_operations.h"
@@ -51,7 +53,7 @@ NSImage* GetImageFromResourceID(int resourceId) {
base::scoped_nsobject<NSImage> authenticationErrorImage_;
}
- (void)setIsThemedWindow:(BOOL)isThemedWindow;
-- (void)setHasError:(BOOL)hasError;
+- (void)setHasError:(BOOL)hasError withTitle:(NSString*)title;
@end
@@ -131,13 +133,19 @@ NSImage* GetImageFromResourceID(int resourceId) {
isThemedWindow_ = isThemedWindow;
}
-- (void)setHasError:(BOOL)hasError {
+- (void)setHasError:(BOOL)hasError withTitle:(NSString*)title {
if (hasError) {
authenticationErrorImage_.reset(
[ui::ResourceBundle::GetSharedInstance().GetImageNamed(
IDR_ICON_PROFILES_AVATAR_BUTTON_ERROR).ToNSImage() retain]);
+ [self accessibilitySetOverrideValue:l10n_util::GetNSStringF(
+ IDS_PROFILES_ACCOUNT_BUTTON_AUTH_ERROR_ACCESSIBLE_NAME,
+ base::SysNSStringToUTF16(title))
+ forAttribute:NSAccessibilityTitleAttribute];
} else {
authenticationErrorImage_.reset();
+ [self accessibilitySetOverrideValue:title
+ forAttribute:NSAccessibilityTitleAttribute];
}
}
@@ -172,8 +180,7 @@ NSImage* GetImageFromResourceID(int resourceId) {
[[CustomThemeButtonCell alloc] initWithThemedWindow:isThemedWindow_]);
SigninErrorController* errorController =
profiles::GetSigninErrorController(browser->profile());
- if (errorController)
- [cell setHasError:errorController->HasError()];
+
[button_ setCell:cell.get()];
[self setView:button_];
@@ -189,6 +196,8 @@ NSImage* GetImageFromResourceID(int resourceId) {
[button_ setAction:@selector(buttonClicked:)];
[self updateAvatarButtonAndLayoutParent:NO];
+ if (errorController)
+ [cell setHasError:errorController->HasError() withTitle:[button_ title]];
NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
[center addObserver:self
@@ -262,7 +271,7 @@ NSImage* GetImageFromResourceID(int resourceId) {
}
- (void)updateErrorStatus:(BOOL)hasError {
- [[button_ cell] setHasError:hasError];
+ [[button_ cell] setHasError:hasError withTitle:[button_ title]];
[self updateAvatarButtonAndLayoutParent:YES];
}
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698