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 #ifndef CHROME_BROWSER_UI_COCOA_CHOOSER_CONTENT_VIEW_COCOA_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_CHOOSER_CONTENT_VIEW_COCOA_H_ |
6 #define CHROME_BROWSER_UI_COCOA_CHOOSER_CONTENT_VIEW_COCOA_H_ | 6 #define CHROME_BROWSER_UI_COCOA_CHOOSER_CONTENT_VIEW_COCOA_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
| 10 #include <memory> |
| 11 |
10 #include "base/mac/scoped_nsobject.h" | 12 #include "base/mac/scoped_nsobject.h" |
11 | 13 |
| 14 class ChooserController; |
| 15 class TableViewController; |
| 16 |
12 // A chooser content view class that user can select an option. | 17 // A chooser content view class that user can select an option. |
13 @interface ChooserContentViewCocoa : NSView { | 18 @interface ChooserContentViewCocoa : NSView { |
14 @private | 19 @private |
15 base::scoped_nsobject<NSTextField> titleView_; | 20 base::scoped_nsobject<NSTextField> titleView_; |
16 base::scoped_nsobject<NSScrollView> scrollView_; | 21 base::scoped_nsobject<NSScrollView> scrollView_; |
17 base::scoped_nsobject<NSTableColumn> tableColumn_; | 22 base::scoped_nsobject<NSTableColumn> tableColumn_; |
18 base::scoped_nsobject<NSTableView> tableView_; | 23 base::scoped_nsobject<NSTableView> tableView_; |
19 base::scoped_nsobject<NSButton> connectButton_; | 24 base::scoped_nsobject<NSButton> connectButton_; |
20 base::scoped_nsobject<NSButton> cancelButton_; | 25 base::scoped_nsobject<NSButton> cancelButton_; |
21 base::scoped_nsobject<NSBox> separator_; | 26 base::scoped_nsobject<NSBox> separator_; |
22 base::scoped_nsobject<NSTextField> message_; | 27 base::scoped_nsobject<NSTextField> message_; |
23 base::scoped_nsobject<NSButton> helpButton_; | 28 base::scoped_nsobject<NSButton> helpButton_; |
| 29 std::unique_ptr<ChooserController> chooserController_; |
| 30 std::unique_ptr<TableViewController> tableViewController_; |
24 } | 31 } |
25 | 32 |
26 // Designated initializer. | 33 // Designated initializer. |
27 - (instancetype)initWithChooserTitle:(NSString*)chooserTitle; | 34 - (instancetype)initWithChooserTitle:(NSString*)chooserTitle |
| 35 ChooserController: |
| 36 (std::unique_ptr<ChooserController>)chooserController; |
28 | 37 |
29 // Creates the title for the chooser. | 38 // Creates the title for the chooser. |
30 - (base::scoped_nsobject<NSTextField>)createChooserTitle:(NSString*)title; | 39 - (base::scoped_nsobject<NSTextField>)createChooserTitle:(NSString*)title; |
31 | 40 |
32 // Creates a button with |title|. | 41 // Creates a button with |title|. |
33 - (base::scoped_nsobject<NSButton>)createButtonWithTitle:(NSString*)title; | 42 - (base::scoped_nsobject<NSButton>)createButtonWithTitle:(NSString*)title; |
34 | 43 |
35 // Creates the "Connect" button. | 44 // Creates the "Connect" button. |
36 - (base::scoped_nsobject<NSButton>)createConnectButton; | 45 - (base::scoped_nsobject<NSButton>)createConnectButton; |
37 | 46 |
(...skipping 14 matching lines...) Expand all Loading... |
52 | 61 |
53 // Gets the "Connect" button. | 62 // Gets the "Connect" button. |
54 - (NSButton*)connectButton; | 63 - (NSButton*)connectButton; |
55 | 64 |
56 // Gets the "Cancel" button. | 65 // Gets the "Cancel" button. |
57 - (NSButton*)cancelButton; | 66 - (NSButton*)cancelButton; |
58 | 67 |
59 // Gets the "Get help" button. | 68 // Gets the "Get help" button. |
60 - (NSButton*)helpButton; | 69 - (NSButton*)helpButton; |
61 | 70 |
| 71 // The number of options in the |tableView_|. |
| 72 - (NSInteger)numOptions; |
| 73 |
| 74 // The |index|th option string which is listed in the chooser. |
| 75 - (NSString*)getOption:(NSInteger)index; |
| 76 |
| 77 // Update |tableView_| when chooser options changed. |
| 78 - (void)updateTableView; |
| 79 |
| 80 // Called when the "Connect" button is pressed. |
| 81 - (void)Accept; |
| 82 |
| 83 // Called when the "Cancel" button is pressed. |
| 84 - (void)Cancel; |
| 85 |
| 86 // Called when the chooser is closed. |
| 87 - (void)Close; |
| 88 |
| 89 // Called when the "Get help" button is pressed. |
| 90 - (void)onHelpPressed:(id)sender; |
| 91 |
62 @end | 92 @end |
63 | 93 |
64 #endif // CHROME_BROWSER_UI_COCOA_CHOOSER_CONTENT_VIEW_COCOA_H_ | 94 #endif // CHROME_BROWSER_UI_COCOA_CHOOSER_CONTENT_VIEW_COCOA_H_ |
OLD | NEW |