| 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> |
| 11 | 11 |
| 12 #include "base/mac/scoped_nsobject.h" | 12 #include "base/mac/scoped_nsobject.h" |
| 13 #include "base/memory/ptr_util.h" |
| 13 #include "base/strings/sys_string_conversions.h" | 14 #include "base/strings/sys_string_conversions.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 15 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/browser/ui/browser_finder.h" | 17 #include "chrome/browser/ui/browser_finder.h" |
| 17 #include "chrome/browser/ui/browser_window.h" | 18 #include "chrome/browser/ui/browser_window.h" |
| 18 #import "chrome/browser/ui/chrome_style.h" | 19 #import "chrome/browser/ui/chrome_style.h" |
| 19 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" | 20 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" |
| 20 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 21 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 21 #import "chrome/browser/ui/cocoa/browser_window_utils.h" | 22 #import "chrome/browser/ui/cocoa/browser_window_utils.h" |
| 22 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_button.h" | 23 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_button.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 46 // border. | 47 // border. |
| 47 const CGFloat kMarginX = 20.0f; | 48 const CGFloat kMarginX = 20.0f; |
| 48 const CGFloat kMarginY = 20.0f; | 49 const CGFloat kMarginY = 20.0f; |
| 49 | 50 |
| 50 // Distance between two views inside the bubble. | 51 // Distance between two views inside the bubble. |
| 51 const CGFloat kHorizontalPadding = 10.0f; | 52 const CGFloat kHorizontalPadding = 10.0f; |
| 52 const CGFloat kVerticalPadding = 10.0f; | 53 const CGFloat kVerticalPadding = 10.0f; |
| 53 | 54 |
| 54 } // namespace | 55 } // namespace |
| 55 | 56 |
| 56 scoped_ptr<BubbleUi> ChooserBubbleController::BuildBubbleUi() { | 57 std::unique_ptr<BubbleUi> ChooserBubbleController::BuildBubbleUi() { |
| 57 return make_scoped_ptr(new ChooserBubbleUiCocoa(browser_, this)); | 58 return base::WrapUnique(new ChooserBubbleUiCocoa(browser_, this)); |
| 58 } | 59 } |
| 59 | 60 |
| 60 @interface ChooserBubbleUiController | 61 @interface ChooserBubbleUiController |
| 61 : BaseBubbleController<NSTableViewDataSource, NSTableViewDelegate> { | 62 : BaseBubbleController<NSTableViewDataSource, NSTableViewDelegate> { |
| 62 @private | 63 @private |
| 63 // Bridge to the C++ class that created this object. | 64 // Bridge to the C++ class that created this object. |
| 64 ChooserBubbleUiCocoa* bridge_; | 65 ChooserBubbleUiCocoa* bridge_; |
| 65 | 66 |
| 66 base::scoped_nsobject<NSTextField> titleView_; | 67 base::scoped_nsobject<NSTextField> titleView_; |
| 67 base::scoped_nsobject<NSScrollView> scrollView_; | 68 base::scoped_nsobject<NSScrollView> scrollView_; |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 [chooser_bubble_ui_controller_ onOptionAdded:static_cast<NSInteger>(index)]; | 593 [chooser_bubble_ui_controller_ onOptionAdded:static_cast<NSInteger>(index)]; |
| 593 } | 594 } |
| 594 | 595 |
| 595 void ChooserBubbleUiCocoa::OnOptionRemoved(size_t index) { | 596 void ChooserBubbleUiCocoa::OnOptionRemoved(size_t index) { |
| 596 [chooser_bubble_ui_controller_ onOptionRemoved:static_cast<NSInteger>(index)]; | 597 [chooser_bubble_ui_controller_ onOptionRemoved:static_cast<NSInteger>(index)]; |
| 597 } | 598 } |
| 598 | 599 |
| 599 void ChooserBubbleUiCocoa::OnBubbleClosing() { | 600 void ChooserBubbleUiCocoa::OnBubbleClosing() { |
| 600 chooser_bubble_ui_controller_ = nil; | 601 chooser_bubble_ui_controller_ = nil; |
| 601 } | 602 } |
| OLD | NEW |