Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ui/message_center/cocoa/status_item_view.h" | 5 #import "ui/message_center/cocoa/status_item_view.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/mac/sdk_forward_declarations.h" | |
| 10 #include "ui/base/resource/resource_bundle.h" | 11 #include "ui/base/resource/resource_bundle.h" |
| 11 #include "ui/resources/grit/ui_resources.h" | 12 #include "ui/resources/grit/ui_resources.h" |
| 12 | 13 |
| 13 // The width of the status bar item when it's just the icon. | 14 // The width of the status bar item when it's just the icon. |
| 14 const CGFloat kStatusItemLength = 26; | 15 const CGFloat kStatusItemLength = 26; |
| 15 | 16 |
| 16 // The amount of space between the left and right edges and the content of the | 17 // The amount of space between the left and right edges and the content of the |
| 17 // status item. | 18 // status item. |
| 18 const CGFloat kMargin = 5; | 19 const CGFloat kMargin = 5; |
| 19 | 20 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 141 | 142 |
| 142 // Private ///////////////////////////////////////////////////////////////////// | 143 // Private ///////////////////////////////////////////////////////////////////// |
| 143 | 144 |
| 144 - (BOOL)shouldHighlight { | 145 - (BOOL)shouldHighlight { |
| 145 return highlight_ || inMouseEventSequence_; | 146 return highlight_ || inMouseEventSequence_; |
| 146 } | 147 } |
| 147 | 148 |
| 148 - (int)getTrayResourceId { | 149 - (int)getTrayResourceId { |
| 149 BOOL highlight = [self shouldHighlight]; | 150 BOOL highlight = [self shouldHighlight]; |
| 150 BOOL hasUnreadItems = unreadCount_ > 0; | 151 BOOL hasUnreadItems = unreadCount_ > 0; |
| 151 int kResourceIds[2][2][2] = { | 152 BOOL dark = NO; |
| 153 if ([self respondsToSelector:@selector(effectiveAppearance)]) { | |
| 154 NSString* appearanceName = [[self effectiveAppearance] name]; | |
| 155 dark = (appearanceName != nil) && | |
|
Robert Sesek
2014/09/12 19:16:23
You can drop the nil check. Messaging nil will alw
dewittj
2014/09/12 23:24:20
Done.
| |
| 156 [appearanceName isEqualToString:NSAppearanceNameVibrantDark]; | |
| 157 } | |
| 158 | |
| 159 int kResourceIds[2][2][2][2] = { | |
|
dewittj
2014/09/12 18:15:36
Wondering now if I should use a bitmask to index i
Robert Sesek
2014/09/12 19:16:23
I'd be fine with either. Your call.
dewittj
2014/09/12 23:24:20
Acknowledged.
| |
| 152 { | 160 { |
| 153 { IDR_TRAY_EMPTY, IDR_TRAY_EMPTY_PRESSED }, | 161 { |
| 154 { IDR_TRAY_ATTENTION, IDR_TRAY_ATTENTION_PRESSED }, | 162 { IDR_TRAY_EMPTY, IDR_TRAY_EMPTY_PRESSED }, |
| 163 { IDR_TRAY_ATTENTION, IDR_TRAY_ATTENTION_PRESSED }, | |
| 164 }, | |
| 165 { | |
| 166 { IDR_TRAY_DO_NOT_DISTURB_EMPTY, | |
| 167 IDR_TRAY_DO_NOT_DISTURB_EMPTY_PRESSED }, | |
| 168 { IDR_TRAY_DO_NOT_DISTURB_ATTENTION, | |
| 169 IDR_TRAY_DO_NOT_DISTURB_ATTENTION_PRESSED }, | |
| 170 }, | |
| 155 }, | 171 }, |
| 156 { | 172 { |
| 157 { IDR_TRAY_DO_NOT_DISTURB_EMPTY, | 173 { |
| 158 IDR_TRAY_DO_NOT_DISTURB_EMPTY_PRESSED }, | 174 { IDR_DARK_TRAY_EMPTY, IDR_DARK_TRAY_EMPTY_PRESSED }, |
| 159 { IDR_TRAY_DO_NOT_DISTURB_ATTENTION, | 175 { IDR_DARK_TRAY_ATTENTION, IDR_DARK_TRAY_ATTENTION_PRESSED }, |
| 160 IDR_TRAY_DO_NOT_DISTURB_ATTENTION_PRESSED }, | 176 }, |
| 161 }, | 177 { |
| 178 { IDR_DARK_TRAY_DO_NOT_DISTURB_EMPTY, | |
| 179 IDR_DARK_TRAY_DO_NOT_DISTURB_EMPTY_PRESSED }, | |
| 180 { IDR_DARK_TRAY_DO_NOT_DISTURB_ATTENTION, | |
| 181 IDR_DARK_TRAY_DO_NOT_DISTURB_ATTENTION_PRESSED }, | |
| 182 }, | |
| 183 } | |
| 162 }; | 184 }; |
| 163 return kResourceIds[quietMode_][hasUnreadItems][highlight]; | 185 return kResourceIds[dark][quietMode_][hasUnreadItems][highlight]; |
| 164 } | 186 } |
| 165 | 187 |
| 166 @end | 188 @end |
| OLD | NEW |