| 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/settings_controller.h" | 5 #import "ui/message_center/cocoa/settings_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
| 10 #import "base/mac/scoped_nsobject.h" | 10 #import "base/mac/scoped_nsobject.h" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 kHorizontalMargin, | 185 kHorizontalMargin, |
| 186 NSWidth(fullFrame), | 186 NSWidth(fullFrame), |
| 187 NSHeight(fullFrame)); | 187 NSHeight(fullFrame)); |
| 188 groupDropDownButton_.reset( | 188 groupDropDownButton_.reset( |
| 189 [[NSPopUpButton alloc] initWithFrame:dropDownButtonFrame | 189 [[NSPopUpButton alloc] initWithFrame:dropDownButtonFrame |
| 190 pullsDown:YES]); | 190 pullsDown:YES]); |
| 191 [groupDropDownButton_ setAction:@selector(notifierGroupSelectionChanged:)]; | 191 [groupDropDownButton_ setAction:@selector(notifierGroupSelectionChanged:)]; |
| 192 [groupDropDownButton_ setTarget:self]; | 192 [groupDropDownButton_ setTarget:self]; |
| 193 // Add a dummy item for pull-down. | 193 // Add a dummy item for pull-down. |
| 194 [groupDropDownButton_ addItemWithTitle:@""]; | 194 [groupDropDownButton_ addItemWithTitle:@""]; |
| 195 string16 title; | 195 base::string16 title; |
| 196 for (size_t i = 0; i < groupCount; ++i) { | 196 for (size_t i = 0; i < groupCount; ++i) { |
| 197 const message_center::NotifierGroup& group = | 197 const message_center::NotifierGroup& group = |
| 198 provider_->GetNotifierGroupAt(i); | 198 provider_->GetNotifierGroupAt(i); |
| 199 string16 item = group.login_info.empty() ? group.name : group.login_info; | 199 base::string16 item = |
| 200 group.login_info.empty() ? group.name : group.login_info; |
| 200 [groupDropDownButton_ addItemWithTitle:base::SysUTF16ToNSString(item)]; | 201 [groupDropDownButton_ addItemWithTitle:base::SysUTF16ToNSString(item)]; |
| 201 if (provider_->IsNotifierGroupActiveAt(i)) { | 202 if (provider_->IsNotifierGroupActiveAt(i)) { |
| 202 title = item; | 203 title = item; |
| 203 [[groupDropDownButton_ lastItem] setState:NSOnState]; | 204 [[groupDropDownButton_ lastItem] setState:NSOnState]; |
| 204 } | 205 } |
| 205 } | 206 } |
| 206 [groupDropDownButton_ setTitle:base::SysUTF16ToNSString(title)]; | 207 [groupDropDownButton_ setTitle:base::SysUTF16ToNSString(title)]; |
| 207 [groupDropDownButton_ sizeToFit]; | 208 [groupDropDownButton_ sizeToFit]; |
| 208 dropDownButtonFrame = [groupDropDownButton_ frame]; | 209 dropDownButtonFrame = [groupDropDownButton_ frame]; |
| 209 dropDownButtonFrame.origin.y = | 210 dropDownButtonFrame.origin.y = |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 NSPopUpButton* button = static_cast<NSPopUpButton*>(sender); | 331 NSPopUpButton* button = static_cast<NSPopUpButton*>(sender); |
| 331 // The first item is a dummy item. | 332 // The first item is a dummy item. |
| 332 provider_->SwitchToNotifierGroup([button indexOfSelectedItem] - 1); | 333 provider_->SwitchToNotifierGroup([button indexOfSelectedItem] - 1); |
| 333 } | 334 } |
| 334 | 335 |
| 335 - (BOOL)notifierHasAdvancedSettings:(const message_center::NotifierId&)id { | 336 - (BOOL)notifierHasAdvancedSettings:(const message_center::NotifierId&)id { |
| 336 return provider_->NotifierHasAdvancedSettings(id); | 337 return provider_->NotifierHasAdvancedSettings(id); |
| 337 } | 338 } |
| 338 | 339 |
| 339 @end | 340 @end |
| OLD | NEW |