| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/website_settings/chooser_bubble_ui_cocoa.h" | 5 #import "chrome/browser/ui/cocoa/website_settings/chooser_bubble_ui_cocoa.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 return browser_->window()->GetNativeWindow(); | 447 return browser_->window()->GetNativeWindow(); |
| 448 } | 448 } |
| 449 | 449 |
| 450 - (base::scoped_nsobject<NSTextField>)bubbleTitle { | 450 - (base::scoped_nsobject<NSTextField>)bubbleTitle { |
| 451 base::scoped_nsobject<NSTextField> titleView( | 451 base::scoped_nsobject<NSTextField> titleView( |
| 452 [[NSTextField alloc] initWithFrame:NSZeroRect]); | 452 [[NSTextField alloc] initWithFrame:NSZeroRect]); |
| 453 [titleView setDrawsBackground:NO]; | 453 [titleView setDrawsBackground:NO]; |
| 454 [titleView setBezeled:NO]; | 454 [titleView setBezeled:NO]; |
| 455 [titleView setEditable:NO]; | 455 [titleView setEditable:NO]; |
| 456 [titleView setSelectable:NO]; | 456 [titleView setSelectable:NO]; |
| 457 [titleView setStringValue:l10n_util::GetNSStringF( | 457 [titleView |
| 458 IDS_CHOOSER_BUBBLE_PROMPT, | 458 setStringValue:l10n_util::GetNSStringF( |
| 459 base::ASCIIToUTF16( | 459 IDS_CHOOSER_BUBBLE_PROMPT, |
| 460 chooserBubbleController_->GetOrigin() | 460 base::ASCIIToUTF16( |
| 461 .Serialize()))]; | 461 chooserBubbleController_->GetOrigin().host()))]; |
| 462 [titleView setFont:[NSFont systemFontOfSize:[NSFont systemFontSize]]]; | 462 [titleView setFont:[NSFont systemFontOfSize:[NSFont systemFontSize]]]; |
| 463 // The height is arbitrary as it will be adjusted later. | 463 // The height is arbitrary as it will be adjusted later. |
| 464 [titleView setFrameSize:NSMakeSize(kChooserBubbleWidth - 2 * kMarginX, 0.0f)]; | 464 [titleView setFrameSize:NSMakeSize(kChooserBubbleWidth - 2 * kMarginX, 0.0f)]; |
| 465 [GTMUILocalizerAndLayoutTweaker sizeToFitFixedWidthTextField:titleView]; | 465 [GTMUILocalizerAndLayoutTweaker sizeToFitFixedWidthTextField:titleView]; |
| 466 return titleView; | 466 return titleView; |
| 467 } | 467 } |
| 468 | 468 |
| 469 - (base::scoped_nsobject<NSButton>)buttonWithTitle:(NSString*)title | 469 - (base::scoped_nsobject<NSButton>)buttonWithTitle:(NSString*)title |
| 470 action:(SEL)action { | 470 action:(SEL)action { |
| 471 base::scoped_nsobject<NSButton> button( | 471 base::scoped_nsobject<NSButton> button( |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 [chooser_bubble_ui_controller_ onOptionAdded:static_cast<NSInteger>(index)]; | 600 [chooser_bubble_ui_controller_ onOptionAdded:static_cast<NSInteger>(index)]; |
| 601 } | 601 } |
| 602 | 602 |
| 603 void ChooserBubbleUiCocoa::OnOptionRemoved(size_t index) { | 603 void ChooserBubbleUiCocoa::OnOptionRemoved(size_t index) { |
| 604 [chooser_bubble_ui_controller_ onOptionRemoved:static_cast<NSInteger>(index)]; | 604 [chooser_bubble_ui_controller_ onOptionRemoved:static_cast<NSInteger>(index)]; |
| 605 } | 605 } |
| 606 | 606 |
| 607 void ChooserBubbleUiCocoa::OnBubbleClosing() { | 607 void ChooserBubbleUiCocoa::OnBubbleClosing() { |
| 608 chooser_bubble_ui_controller_ = nil; | 608 chooser_bubble_ui_controller_ = nil; |
| 609 } | 609 } |
| OLD | NEW |