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

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

Issue 2050303003: [Mac][Material]Update the text color on Guest Mode Chip (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #import "chrome/browser/ui/cocoa/profiles/avatar_button.h" 19 #import "chrome/browser/ui/cocoa/profiles/avatar_button.h"
20 #include "chrome/grit/generated_resources.h" 20 #include "chrome/grit/generated_resources.h"
21 #include "components/signin/core/browser/signin_error_controller.h" 21 #include "components/signin/core/browser/signin_error_controller.h"
22 #include "grit/theme_resources.h" 22 #include "grit/theme_resources.h"
23 #import "ui/base/cocoa/appkit_utils.h" 23 #import "ui/base/cocoa/appkit_utils.h"
24 #include "ui/base/l10n/l10n_util_mac.h" 24 #include "ui/base/l10n/l10n_util_mac.h"
25 #include "ui/base/material_design/material_design_controller.h"
25 #include "ui/base/nine_image_painter_factory.h" 26 #include "ui/base/nine_image_painter_factory.h"
26 #include "ui/base/resource/resource_bundle.h" 27 #include "ui/base/resource/resource_bundle.h"
27 #include "ui/gfx/image/image_skia_operations.h" 28 #include "ui/gfx/image/image_skia_operations.h"
28 #include "ui/gfx/image/image_skia_util_mac.h" 29 #include "ui/gfx/image/image_skia_util_mac.h"
29 30
30 namespace { 31 namespace {
31 32
32 // NSButtons have a default padding of 5px. This button should have a padding 33 // NSButtons have a default padding of 5px. This button should have a padding
33 // of 8px. 34 // of 8px.
34 const CGFloat kButtonExtraPadding = 8 - 5; 35 const CGFloat kButtonExtraPadding = 8 - 5;
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 210
210 - (void)updateAvatarButtonAndLayoutParent:(BOOL)layoutParent { 211 - (void)updateAvatarButtonAndLayoutParent:(BOOL)layoutParent {
211 // The button text has a black foreground and a white drop shadow for regular 212 // The button text has a black foreground and a white drop shadow for regular
212 // windows, and a light text with a dark drop shadow for guest windows 213 // windows, and a light text with a dark drop shadow for guest windows
213 // which are themed with a dark background. 214 // which are themed with a dark background.
214 base::scoped_nsobject<NSShadow> shadow([[NSShadow alloc] init]); 215 base::scoped_nsobject<NSShadow> shadow([[NSShadow alloc] init]);
215 [shadow setShadowOffset:NSMakeSize(0, -1)]; 216 [shadow setShadowOffset:NSMakeSize(0, -1)];
216 [shadow setShadowBlurRadius:0]; 217 [shadow setShadowBlurRadius:0];
217 218
218 NSColor* foregroundColor; 219 NSColor* foregroundColor;
219 if (browser_->profile()->IsGuestSession()) { 220 if (browser_->profile()->IsGuestSession() &&
221 !ui::MaterialDesignController::IsModeMaterial()) {
220 foregroundColor = [NSColor colorWithCalibratedWhite:1.0 alpha:0.9]; 222 foregroundColor = [NSColor colorWithCalibratedWhite:1.0 alpha:0.9];
221 [shadow setShadowColor:[NSColor colorWithCalibratedWhite:0.0 alpha:0.4]]; 223 [shadow setShadowColor:[NSColor colorWithCalibratedWhite:0.0 alpha:0.4]];
222 } else if (!isThemedWindow_) { 224 } else if (!isThemedWindow_) {
223 foregroundColor = [NSColor blackColor]; 225 foregroundColor = [NSColor blackColor];
224 [shadow setShadowColor:[NSColor colorWithCalibratedWhite:1.0 alpha:0.7]]; 226 [shadow setShadowColor:[NSColor colorWithCalibratedWhite:1.0 alpha:0.7]];
225 } else { 227 } else {
226 foregroundColor = [NSColor blackColor]; 228 foregroundColor = [NSColor blackColor];
227 [shadow setShadowColor:[NSColor colorWithCalibratedWhite:1.0 alpha:0.4]]; 229 [shadow setShadowColor:[NSColor colorWithCalibratedWhite:1.0 alpha:0.4]];
228 } 230 }
229 231
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 layoutSubviews]; 295 layoutSubviews];
294 } 296 }
295 } 297 }
296 298
297 - (void)updateErrorStatus:(BOOL)hasError { 299 - (void)updateErrorStatus:(BOOL)hasError {
298 hasError_ = hasError; 300 hasError_ = hasError;
299 [self updateAvatarButtonAndLayoutParent:YES]; 301 [self updateAvatarButtonAndLayoutParent:YES];
300 } 302 }
301 303
302 @end 304 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698