OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/settings_entry_view.h" | 5 #import "ui/message_center/cocoa/settings_entry_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 #include "skia/ext/skia_utils_mac.h" | 10 #include "skia/ext/skia_utils_mac.h" |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 [self setBoxType:NSBoxCustom]; | 162 [self setBoxType:NSBoxCustom]; |
163 [self setBorderType:NSNoBorder]; | 163 [self setBorderType:NSNoBorder]; |
164 [self setTitlePosition:NSNoTitle]; | 164 [self setTitlePosition:NSNoTitle]; |
165 [self setContentViewMargins:NSZeroSize]; | 165 [self setContentViewMargins:NSZeroSize]; |
166 | 166 |
167 hasSeparator_ = hasSeparator; | 167 hasSeparator_ = hasSeparator; |
168 controller_ = controller; | 168 controller_ = controller; |
169 notifier_ = notifier; | 169 notifier_ = notifier; |
170 if (!notifier->icon.IsEmpty()) | 170 if (!notifier->icon.IsEmpty()) |
171 notifierIcon_.reset(notifier->icon.CopyNSImage()); | 171 notifierIcon_.reset(notifier->icon.CopyNSImage()); |
172 [self layout]; | 172 [self layoutEntryView]; |
173 } | 173 } |
174 return self; | 174 return self; |
175 } | 175 } |
176 | 176 |
177 - (void)setNotifierIcon:(NSImage*)notifierIcon { | 177 - (void)setNotifierIcon:(NSImage*)notifierIcon { |
178 notifierIcon_.reset([notifierIcon retain]); | 178 notifierIcon_.reset([notifierIcon retain]); |
179 [self layout]; | 179 [self layoutEntryView]; |
180 } | 180 } |
181 | 181 |
182 - (NSButton*)checkbox { | 182 - (NSButton*)checkbox { |
183 return checkbox_; | 183 return checkbox_; |
184 } | 184 } |
185 | 185 |
186 - (void)layout { | 186 - (void)layoutEntryView { |
187 BOOL hasLearnMore = | 187 BOOL hasLearnMore = |
188 [controller_ notifierHasAdvancedSettings:notifier_->notifier_id]; | 188 [controller_ notifierHasAdvancedSettings:notifier_->notifier_id]; |
189 | 189 |
190 // Now calculate the space available for the checkbox button. | 190 // Now calculate the space available for the checkbox button. |
191 NSRect checkboxFrame = [self bounds]; | 191 NSRect checkboxFrame = [self bounds]; |
192 checkboxFrame.origin.x += kCorrectedCheckmarkLeftPadding; | 192 checkboxFrame.origin.x += kCorrectedCheckmarkLeftPadding; |
193 checkboxFrame.size.width -= | 193 checkboxFrame.size.width -= |
194 kCorrectedCheckmarkLeftPadding + kCorrectedEntryRightPadding; | 194 kCorrectedCheckmarkLeftPadding + kCorrectedEntryRightPadding; |
195 | 195 |
196 NSRect learnMoreFrame = | 196 NSRect learnMoreFrame = |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 | 284 |
285 // Testing API ///////////////////////////////////////////////////////////////// | 285 // Testing API ///////////////////////////////////////////////////////////////// |
286 | 286 |
287 - (void)clickLearnMore { | 287 - (void)clickLearnMore { |
288 [learnMoreButton_ performClick:nil]; | 288 [learnMoreButton_ performClick:nil]; |
289 } | 289 } |
290 | 290 |
291 @end | 291 @end |
292 | 292 |
293 /////////////////////////////////////////////////////////////////////////////// | 293 /////////////////////////////////////////////////////////////////////////////// |
OLD | NEW |