| 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_EXTENSIONS_CHOOSER_DIALOG_COCOA_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_CHOOSER_DIALOG_COCOA_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_CHOOSER_DIALOG_COCOA_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_CHOOSER_DIALOG_COCOA_CONTROLLER_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 |
| 12 @class ChooserContentViewCocoa; | 14 @class ChooserContentViewCocoa; |
| 13 class ChooserController; | 15 class ChooserController; |
| 14 class ChooserDialogCocoa; | 16 class ChooserDialogCocoa; |
| 15 | 17 |
| 16 // Displays a chooser dialog, and notifies the ChooserController | 18 // Displays a chooser dialog, and notifies the ChooserController |
| 17 // of the selected option. | 19 // of the selected option. |
| 18 @interface ChooserDialogCocoaController | 20 @interface ChooserDialogCocoaController |
| 19 : NSViewController<NSTableViewDataSource, NSTableViewDelegate> { | 21 : NSViewController<NSTableViewDataSource, NSTableViewDelegate> { |
| 20 base::scoped_nsobject<ChooserContentViewCocoa> chooserContentView_; | 22 base::scoped_nsobject<ChooserContentViewCocoa> chooserContentView_; |
| 21 NSTableView* tableView_; // Weak. | 23 NSTableView* tableView_; // Weak. |
| 22 NSButton* connectButton_; // Weak. | 24 NSButton* connectButton_; // Weak. |
| 23 NSButton* cancelButton_; // Weak. | 25 NSButton* cancelButton_; // Weak. |
| 24 NSButton* helpButton_; // Weak. | |
| 25 | 26 |
| 26 ChooserDialogCocoa* chooserDialogCocoa_; // Weak. | 27 ChooserDialogCocoa* chooserDialogCocoa_; // Weak. |
| 27 ChooserController* chooserController_; // Weak. | |
| 28 } | 28 } |
| 29 | 29 |
| 30 // Designated initializer. |chooserDialogCocoa| and |chooserController| | 30 // Designated initializer. |chooserDialogCocoa| and |chooserController| |
| 31 // must both be non-nil. | 31 // must both be non-nil. |
| 32 - (instancetype) | 32 - (instancetype) |
| 33 initWithChooserDialogCocoa:(ChooserDialogCocoa*)chooserDialogCocoa | 33 initWithChooserDialogCocoa:(ChooserDialogCocoa*)chooserDialogCocoa |
| 34 chooserController:(ChooserController*)chooserController; | 34 chooserController: |
| 35 | 35 (std::unique_ptr<ChooserController>)chooserController; |
| 36 // Update |tableView_| when chooser options were initialized. | |
| 37 - (void)onOptionsInitialized; | |
| 38 | |
| 39 // Update |tableView_| when chooser option was added. | |
| 40 - (void)onOptionAdded:(NSInteger)index; | |
| 41 | |
| 42 // Update |tableView_| when chooser option was removed. | |
| 43 - (void)onOptionRemoved:(NSInteger)index; | |
| 44 | |
| 45 // Update |tableView_| when chooser options changed. | |
| 46 - (void)updateTableView; | |
| 47 | 36 |
| 48 // Called when the "Connect" button is pressed. | 37 // Called when the "Connect" button is pressed. |
| 49 - (void)onConnect:(id)sender; | 38 - (void)onConnect:(id)sender; |
| 50 | 39 |
| 51 // Called when the "Cancel" button is pressed. | 40 // Called when the "Cancel" button is pressed. |
| 52 - (void)onCancel:(id)sender; | 41 - (void)onCancel:(id)sender; |
| 53 | 42 |
| 54 // Called when the "Get help" button is pressed. | |
| 55 - (void)onHelpPressed:(id)sender; | |
| 56 | |
| 57 // Gets the |chooserContentView_|. For testing only. | 43 // Gets the |chooserContentView_|. For testing only. |
| 58 - (ChooserContentViewCocoa*)chooserContentView; | 44 - (ChooserContentViewCocoa*)chooserContentView; |
| 59 | 45 |
| 60 @end | 46 @end |
| 61 | 47 |
| 62 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_CHOOSER_DIALOG_COCOA_CONTROLLER_H_ | 48 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_CHOOSER_DIALOG_COCOA_CONTROLLER_H_ |
| OLD | NEW |