| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/chooser_content_view_cocoa.h" | 5 #import "chrome/browser/ui/cocoa/chooser_content_view_cocoa.h" |
| 6 | 6 |
| 7 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_button.h" | 7 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_button.h" |
| 8 #include "chrome/grit/generated_resources.h" | 8 #include "chrome/grit/generated_resources.h" |
| 9 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw
eaker.h" | 9 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTw
eaker.h" |
| 10 #import "ui/base/cocoa/controls/hyperlink_button_cell.h" | 10 #import "ui/base/cocoa/controls/hyperlink_button_cell.h" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 base::scoped_nsobject<NSButton> button( | 181 base::scoped_nsobject<NSButton> button( |
| 182 [[ConstrainedWindowButton alloc] initWithFrame:NSZeroRect]); | 182 [[ConstrainedWindowButton alloc] initWithFrame:NSZeroRect]); |
| 183 [button setButtonType:NSMomentaryPushInButton]; | 183 [button setButtonType:NSMomentaryPushInButton]; |
| 184 [button setTitle:title]; | 184 [button setTitle:title]; |
| 185 [button sizeToFit]; | 185 [button sizeToFit]; |
| 186 return button; | 186 return button; |
| 187 } | 187 } |
| 188 | 188 |
| 189 - (base::scoped_nsobject<NSButton>)createConnectButton { | 189 - (base::scoped_nsobject<NSButton>)createConnectButton { |
| 190 NSString* connectTitle = | 190 NSString* connectTitle = |
| 191 l10n_util::GetNSString(IDS_CHOOSER_BUBBLE_CONNECT_BUTTON_TEXT); | 191 l10n_util::GetNSString(IDS_CHOOSER_CONNECT_BUTTON_TEXT); |
| 192 return [self createButtonWithTitle:connectTitle]; | 192 return [self createButtonWithTitle:connectTitle]; |
| 193 } | 193 } |
| 194 | 194 |
| 195 - (base::scoped_nsobject<NSButton>)createCancelButton { | 195 - (base::scoped_nsobject<NSButton>)createCancelButton { |
| 196 NSString* cancelTitle = | 196 NSString* cancelTitle = |
| 197 l10n_util::GetNSString(IDS_CHOOSER_BUBBLE_CANCEL_BUTTON_TEXT); | 197 l10n_util::GetNSString(IDS_CHOOSER_CANCEL_BUTTON_TEXT); |
| 198 return [self createButtonWithTitle:cancelTitle]; | 198 return [self createButtonWithTitle:cancelTitle]; |
| 199 } | 199 } |
| 200 | 200 |
| 201 - (base::scoped_nsobject<NSBox>)createSeparator { | 201 - (base::scoped_nsobject<NSBox>)createSeparator { |
| 202 base::scoped_nsobject<NSBox> spacer([[NSBox alloc] initWithFrame:NSZeroRect]); | 202 base::scoped_nsobject<NSBox> spacer([[NSBox alloc] initWithFrame:NSZeroRect]); |
| 203 [spacer setBoxType:NSBoxSeparator]; | 203 [spacer setBoxType:NSBoxSeparator]; |
| 204 [spacer setBorderType:NSLineBorder]; | 204 [spacer setBorderType:NSLineBorder]; |
| 205 [spacer setAlphaValue:kSeparatorAlphaValue]; | 205 [spacer setAlphaValue:kSeparatorAlphaValue]; |
| 206 [spacer setFrameSize:NSMakeSize(kChooserWidth, kSeparatorHeight)]; | 206 [spacer setFrameSize:NSMakeSize(kChooserWidth, kSeparatorHeight)]; |
| 207 return spacer; | 207 return spacer; |
| 208 } | 208 } |
| 209 | 209 |
| 210 - (base::scoped_nsobject<NSTextField>)createMessage { | 210 - (base::scoped_nsobject<NSTextField>)createMessage { |
| 211 base::scoped_nsobject<NSTextField> messageView( | 211 base::scoped_nsobject<NSTextField> messageView( |
| 212 [[NSTextField alloc] initWithFrame:NSZeroRect]); | 212 [[NSTextField alloc] initWithFrame:NSZeroRect]); |
| 213 [messageView setDrawsBackground:NO]; | 213 [messageView setDrawsBackground:NO]; |
| 214 [messageView setBezeled:NO]; | 214 [messageView setBezeled:NO]; |
| 215 [messageView setEditable:NO]; | 215 [messageView setEditable:NO]; |
| 216 [messageView setSelectable:NO]; | 216 [messageView setSelectable:NO]; |
| 217 [messageView | 217 [messageView setStringValue:l10n_util::GetNSStringF(IDS_CHOOSER_FOOTNOTE_TEXT, |
| 218 setStringValue:l10n_util::GetNSStringF(IDS_CHOOSER_BUBBLE_FOOTNOTE_TEXT, | 218 base::string16())]; |
| 219 base::string16())]; | |
| 220 [messageView setFont:[NSFont systemFontOfSize:[NSFont systemFontSize]]]; | 219 [messageView setFont:[NSFont systemFontOfSize:[NSFont systemFontSize]]]; |
| 221 [messageView sizeToFit]; | 220 [messageView sizeToFit]; |
| 222 return messageView; | 221 return messageView; |
| 223 } | 222 } |
| 224 | 223 |
| 225 - (base::scoped_nsobject<NSButton>)createHelpButton { | 224 - (base::scoped_nsobject<NSButton>)createHelpButton { |
| 226 base::scoped_nsobject<NSButton> button( | 225 base::scoped_nsobject<NSButton> button( |
| 227 [[NSButton alloc] initWithFrame:NSZeroRect]); | 226 [[NSButton alloc] initWithFrame:NSZeroRect]); |
| 228 base::scoped_nsobject<HyperlinkButtonCell> cell([[HyperlinkButtonCell alloc] | 227 base::scoped_nsobject<HyperlinkButtonCell> cell([[HyperlinkButtonCell alloc] |
| 229 initTextCell:l10n_util::GetNSString( | 228 initTextCell:l10n_util::GetNSString(IDS_CHOOSER_GET_HELP_LINK_TEXT)]); |
| 230 IDS_CHOOSER_BUBBLE_GET_HELP_LINK_TEXT)]); | |
| 231 [button setCell:cell.get()]; | 229 [button setCell:cell.get()]; |
| 232 [button sizeToFit]; | 230 [button sizeToFit]; |
| 233 return button; | 231 return button; |
| 234 } | 232 } |
| 235 | 233 |
| 236 - (NSTableView*)tableView { | 234 - (NSTableView*)tableView { |
| 237 return tableView_.get(); | 235 return tableView_.get(); |
| 238 } | 236 } |
| 239 | 237 |
| 240 - (NSButton*)connectButton { | 238 - (NSButton*)connectButton { |
| 241 return connectButton_.get(); | 239 return connectButton_.get(); |
| 242 } | 240 } |
| 243 | 241 |
| 244 - (NSButton*)cancelButton { | 242 - (NSButton*)cancelButton { |
| 245 return cancelButton_.get(); | 243 return cancelButton_.get(); |
| 246 } | 244 } |
| 247 | 245 |
| 248 - (NSButton*)helpButton { | 246 - (NSButton*)helpButton { |
| 249 return helpButton_.get(); | 247 return helpButton_.get(); |
| 250 } | 248 } |
| 251 | 249 |
| 252 @end | 250 @end |
| OLD | NEW |