| OLD | NEW |
| 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" |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 [avatarButton setButtonType:NSMomentaryChangeButton]; | 217 [avatarButton setButtonType:NSMomentaryChangeButton]; |
| 218 if (switches::IsMaterialDesignUserMenu()) | 218 if (switches::IsMaterialDesignUserMenu()) |
| 219 [[avatarButton cell] setHighlightsBy:NSNoCellMask]; | 219 [[avatarButton cell] setHighlightsBy:NSNoCellMask]; |
| 220 [avatarButton setBordered:YES]; | 220 [avatarButton setBordered:YES]; |
| 221 | 221 |
| 222 [avatarButton setAutoresizingMask:NSViewMinXMargin | NSViewMinYMargin]; | 222 [avatarButton setAutoresizingMask:NSViewMinXMargin | NSViewMinYMargin]; |
| 223 [avatarButton setTarget:self]; | 223 [avatarButton setTarget:self]; |
| 224 [avatarButton setAction:@selector(buttonClicked:)]; | 224 [avatarButton setAction:@selector(buttonClicked:)]; |
| 225 [avatarButton setRightAction:@selector(buttonRightClicked:)]; | 225 [avatarButton setRightAction:@selector(buttonRightClicked:)]; |
| 226 | 226 |
| 227 if (ui::MaterialDesignController::IsModeMaterial()) |
| 228 [avatarButton sendActionOn:NSLeftMouseDownMask]; |
| 229 |
| 227 // Check if the account already has an authentication or sync error and | 230 // Check if the account already has an authentication or sync error and |
| 228 // initialize the avatar button UI. | 231 // initialize the avatar button UI. |
| 229 hasError_ = profileObserver_->HasAvatarError(); | 232 hasError_ = profileObserver_->HasAvatarError(); |
| 230 [self updateAvatarButtonAndLayoutParent:NO]; | 233 [self updateAvatarButtonAndLayoutParent:NO]; |
| 231 | 234 |
| 232 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; | 235 NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; |
| 233 [center addObserver:self | 236 [center addObserver:self |
| 234 selector:@selector(themeDidChangeNotification:) | 237 selector:@selector(themeDidChangeNotification:) |
| 235 name:kBrowserThemeDidChangeNotification | 238 name:kBrowserThemeDidChangeNotification |
| 236 object:nil]; | 239 object:nil]; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 layoutSubviews]; | 360 layoutSubviews]; |
| 358 } | 361 } |
| 359 } | 362 } |
| 360 | 363 |
| 361 - (void)setErrorStatus:(BOOL)hasError { | 364 - (void)setErrorStatus:(BOOL)hasError { |
| 362 hasError_ = hasError; | 365 hasError_ = hasError; |
| 363 [self updateAvatarButtonAndLayoutParent:YES]; | 366 [self updateAvatarButtonAndLayoutParent:YES]; |
| 364 } | 367 } |
| 365 | 368 |
| 366 @end | 369 @end |
| OLD | NEW |