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

Side by Side Diff: chrome/browser/ui/cocoa/profiles/avatar_button_controller.mm

Issue 2555033003: Add ScopedMacRTL class for Cocoa browser RTL testing (Closed)
Patch Set: Whitespace Created 4 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/ui/cocoa/profiles/avatar_button_controller.h" 5 #import "chrome/browser/ui/cocoa/profiles/avatar_button_controller.h"
6 6
7 #include "base/mac/foundation_util.h" 7 #include "base/mac/foundation_util.h"
8 #include "base/strings/sys_string_conversions.h" 8 #include "base/strings/sys_string_conversions.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/profiles/profile_attributes_entry.h" 10 #include "chrome/browser/profiles/profile_attributes_entry.h"
11 #include "chrome/browser/profiles/profile_attributes_storage.h" 11 #include "chrome/browser/profiles/profile_attributes_storage.h"
12 #include "chrome/browser/profiles/profile_manager.h" 12 #include "chrome/browser/profiles/profile_manager.h"
13 #include "chrome/browser/profiles/profiles_state.h" 13 #include "chrome/browser/profiles/profiles_state.h"
14 #include "chrome/browser/themes/theme_service.h" 14 #include "chrome/browser/themes/theme_service.h"
15 #include "chrome/browser/themes/theme_service_factory.h" 15 #include "chrome/browser/themes/theme_service_factory.h"
16 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_window.h" 17 #include "chrome/browser/ui/browser_window.h"
18 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 18 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
19 #include "chrome/browser/ui/cocoa/l10n_util.h"
20 #import "chrome/browser/ui/cocoa/profiles/avatar_button.h" 19 #import "chrome/browser/ui/cocoa/profiles/avatar_button.h"
21 #include "chrome/grit/generated_resources.h" 20 #include "chrome/grit/generated_resources.h"
22 #import "chrome/browser/themes/theme_properties.h" 21 #import "chrome/browser/themes/theme_properties.h"
23 #include "chrome/grit/theme_resources.h" 22 #include "chrome/grit/theme_resources.h"
24 #include "components/signin/core/common/profile_management_switches.h" 23 #include "components/signin/core/common/profile_management_switches.h"
25 #include "skia/ext/skia_utils_mac.h" 24 #include "skia/ext/skia_utils_mac.h"
26 #import "ui/base/cocoa/appkit_utils.h" 25 #import "ui/base/cocoa/appkit_utils.h"
26 #import "ui/base/cocoa/rtl_feature.h"
27 #include "ui/base/l10n/l10n_util_mac.h" 27 #include "ui/base/l10n/l10n_util_mac.h"
28 #include "ui/base/material_design/material_design_controller.h" 28 #include "ui/base/material_design/material_design_controller.h"
29 #include "ui/gfx/color_palette.h" 29 #include "ui/gfx/color_palette.h"
30 #include "ui/gfx/image/image_skia_util_mac.h" 30 #include "ui/gfx/image/image_skia_util_mac.h"
31 #include "ui/gfx/paint_vector_icon.h" 31 #include "ui/gfx/paint_vector_icon.h"
32 #include "ui/gfx/vector_icons_public.h" 32 #include "ui/gfx/vector_icons_public.h"
33 33
34 namespace { 34 namespace {
35 35
36 const SkColor kButtonHoverColor = SkColorSetARGB(20, 0, 0, 0); 36 const SkColor kButtonHoverColor = SkColorSetARGB(20, 0, 0, 0);
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 172
173 [avatarButton setWantsLayer:YES]; 173 [avatarButton setWantsLayer:YES];
174 [self setView:avatarButton]; 174 [self setView:avatarButton];
175 175
176 [avatarButton setBezelStyle:NSShadowlessSquareBezelStyle]; 176 [avatarButton setBezelStyle:NSShadowlessSquareBezelStyle];
177 [avatarButton setButtonType:NSMomentaryChangeButton]; 177 [avatarButton setButtonType:NSMomentaryChangeButton];
178 if (switches::IsMaterialDesignUserMenu()) 178 if (switches::IsMaterialDesignUserMenu())
179 [[avatarButton cell] setHighlightsBy:NSNoCellMask]; 179 [[avatarButton cell] setHighlightsBy:NSNoCellMask];
180 [avatarButton setBordered:YES]; 180 [avatarButton setBordered:YES];
181 181
182 if (cocoa_l10n_util::ShouldDoExperimentalRTLLayout()) 182 if (ui::ShouldDoExperimentalRTLLayout())
183 [avatarButton setAutoresizingMask:NSViewMaxXMargin | NSViewMinYMargin]; 183 [avatarButton setAutoresizingMask:NSViewMaxXMargin | NSViewMinYMargin];
184 else 184 else
185 [avatarButton setAutoresizingMask:NSViewMinXMargin | NSViewMinYMargin]; 185 [avatarButton setAutoresizingMask:NSViewMinXMargin | NSViewMinYMargin];
186 [avatarButton setTarget:self]; 186 [avatarButton setTarget:self];
187 [avatarButton setAction:@selector(buttonClicked:)]; 187 [avatarButton setAction:@selector(buttonClicked:)];
188 [avatarButton setRightAction:@selector(buttonRightClicked:)]; 188 [avatarButton setRightAction:@selector(buttonRightClicked:)];
189 189
190 // Check if the account already has an authentication or sync error and 190 // Check if the account already has an authentication or sync error and
191 // initialize the avatar button UI. 191 // initialize the avatar button UI.
192 hasError_ = profileObserver_->HasAvatarError(); 192 hasError_ = profileObserver_->HasAvatarError();
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 fromAccessPoint:accessPoint]; 306 fromAccessPoint:accessPoint];
307 } 307 }
308 308
309 - (void)bubbleWillClose:(NSNotification*)notif { 309 - (void)bubbleWillClose:(NSNotification*)notif {
310 AvatarButton* button = base::mac::ObjCCastStrict<AvatarButton>(button_); 310 AvatarButton* button = base::mac::ObjCCastStrict<AvatarButton>(button_);
311 [button setIsActive:NO]; 311 [button setIsActive:NO];
312 [super bubbleWillClose:notif]; 312 [super bubbleWillClose:notif];
313 } 313 }
314 314
315 @end 315 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698