Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_EXTENSION_INSTALL_VIEW_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_INSTALL_VIEW_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_INSTALL_VIEW_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_INSTALL_VIEW_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #import <Cocoa/Cocoa.h> | 10 #import <Cocoa/Cocoa.h> |
| 11 | 11 |
| 12 #include "base/mac/scoped_nsobject.h" | 12 #include "base/mac/scoped_nsobject.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
| 15 #include "chrome/browser/extensions/extension_install_prompt.h" | 15 #include "chrome/browser/extensions/extension_install_prompt.h" |
| 16 #include "ui/gfx/image/image_skia.h" | 16 #include "ui/gfx/image/image_skia.h" |
| 17 | 17 |
| 18 class Profile; | 18 class Profile; |
| 19 | 19 |
| 20 namespace content { | 20 namespace content { |
| 21 class PageNavigator; | 21 class PageNavigator; |
| 22 } | 22 } |
| 23 | 23 |
| 24 class ExtensionInstallViewDelegate { | |
|
Devlin
2015/12/29 00:12:52
It was incredibly confusing to me that two differe
| |
| 25 public: | |
| 26 virtual void OnOkButtonClicked() = 0; | |
| 27 virtual void OnCancelButtonClicked() = 0; | |
| 28 virtual void OnStoreLinkClicked() = 0; | |
| 29 | |
| 30 protected: | |
| 31 virtual ~ExtensionInstallViewDelegate() {} | |
| 32 }; | |
| 33 | |
| 24 // Displays the extension or bundle install prompt, and notifies the | 34 // Displays the extension or bundle install prompt, and notifies the |
| 25 // ExtensionInstallPrompt::Delegate of success or failure | 35 // Delegate of success or failure. |
| 26 @interface ExtensionInstallViewController : NSViewController | 36 @interface ExtensionInstallViewController : NSViewController |
| 27 <NSOutlineViewDataSource, | 37 <NSOutlineViewDataSource, |
| 28 NSOutlineViewDelegate> { | 38 NSOutlineViewDelegate> { |
| 29 IBOutlet NSImageView* iconView_; | 39 IBOutlet NSImageView* iconView_; |
| 30 IBOutlet NSTextField* titleField_; | 40 IBOutlet NSTextField* titleField_; |
| 31 IBOutlet NSTextField* itemsField_; | 41 IBOutlet NSTextField* itemsField_; |
| 32 IBOutlet NSButton* cancelButton_; | 42 IBOutlet NSButton* cancelButton_; |
| 33 IBOutlet NSButton* okButton_; | 43 IBOutlet NSButton* okButton_; |
| 34 | 44 |
| 35 // Present only when the dialog has permission warnings issues to display. | 45 // Present only when the dialog has permission warnings issues to display. |
| 36 IBOutlet NSOutlineView* outlineView_; | 46 IBOutlet NSOutlineView* outlineView_; |
| 37 | 47 |
| 38 // Present only in the install dialogs with webstore data (inline and | 48 // Present only in the install dialogs with webstore data (inline and |
| 39 // external). | 49 // external). |
| 40 IBOutlet NSBox* warningsSeparator_; // Only when there are permissions. | 50 IBOutlet NSBox* warningsSeparator_; // Only when there are permissions. |
| 41 IBOutlet NSView* ratingStars_; | 51 IBOutlet NSView* ratingStars_; |
| 42 IBOutlet NSTextField* ratingCountField_; | 52 IBOutlet NSTextField* ratingCountField_; |
| 43 IBOutlet NSTextField* userCountField_; | 53 IBOutlet NSTextField* userCountField_; |
| 44 IBOutlet NSButton* storeLinkButton_; | 54 IBOutlet NSButton* storeLinkButton_; |
| 45 | 55 |
| 46 Profile* profile_; // weak | 56 Profile* profile_; // weak |
| 47 content::PageNavigator* navigator_; // weak | 57 content::PageNavigator* navigator_; // weak |
| 48 ExtensionInstallPrompt::Delegate* delegate_; // weak | 58 ExtensionInstallViewDelegate* delegate_; // weak |
| 49 scoped_ptr<ExtensionInstallPrompt::Prompt> prompt_; | 59 scoped_ptr<ExtensionInstallPrompt::Prompt> prompt_; |
| 50 | 60 |
| 51 base::scoped_nsobject<NSArray> warnings_; | 61 base::scoped_nsobject<NSArray> warnings_; |
| 52 BOOL isComputingRowHeight_; | 62 BOOL isComputingRowHeight_; |
| 53 } | 63 } |
| 54 | 64 |
| 55 // For unit test use only. | 65 // For unit test use only. |
| 56 @property(nonatomic, readonly) NSImageView* iconView; | 66 @property(nonatomic, readonly) NSImageView* iconView; |
| 57 @property(nonatomic, readonly) NSTextField* titleField; | 67 @property(nonatomic, readonly) NSTextField* titleField; |
| 58 @property(nonatomic, readonly) NSTextField* itemsField; | 68 @property(nonatomic, readonly) NSTextField* itemsField; |
| 59 @property(nonatomic, readonly) NSButton* cancelButton; | 69 @property(nonatomic, readonly) NSButton* cancelButton; |
| 60 @property(nonatomic, readonly) NSButton* okButton; | 70 @property(nonatomic, readonly) NSButton* okButton; |
| 61 @property(nonatomic, readonly) NSOutlineView* outlineView; | 71 @property(nonatomic, readonly) NSOutlineView* outlineView; |
| 62 @property(nonatomic, readonly) NSBox* warningsSeparator; | 72 @property(nonatomic, readonly) NSBox* warningsSeparator; |
| 63 @property(nonatomic, readonly) NSView* ratingStars; | 73 @property(nonatomic, readonly) NSView* ratingStars; |
| 64 @property(nonatomic, readonly) NSTextField* ratingCountField; | 74 @property(nonatomic, readonly) NSTextField* ratingCountField; |
| 65 @property(nonatomic, readonly) NSTextField* userCountField; | 75 @property(nonatomic, readonly) NSTextField* userCountField; |
| 66 @property(nonatomic, readonly) NSButton* storeLinkButton; | 76 @property(nonatomic, readonly) NSButton* storeLinkButton; |
| 67 | 77 |
| 68 - (id)initWithProfile:(Profile*)profile | 78 - (id)initWithProfile:(Profile*)profile |
| 69 navigator:(content::PageNavigator*)navigator | 79 navigator:(content::PageNavigator*)navigator |
| 70 delegate:(ExtensionInstallPrompt::Delegate*)delegate | 80 delegate:(ExtensionInstallViewDelegate*)delegate |
| 71 prompt:(scoped_ptr<ExtensionInstallPrompt::Prompt>)prompt; | 81 prompt:(scoped_ptr<ExtensionInstallPrompt::Prompt>)prompt; |
| 72 - (IBAction)storeLinkClicked:(id)sender; // Callback for "View details" link. | 82 - (IBAction)storeLinkClicked:(id)sender; // Callback for "View details" link. |
| 73 - (IBAction)cancel:(id)sender; | 83 - (IBAction)cancel:(id)sender; |
| 74 - (IBAction)ok:(id)sender; | 84 - (IBAction)ok:(id)sender; |
| 75 | 85 |
| 76 @end | 86 @end |
| 77 | 87 |
| 78 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_INSTALL_VIEW_CONTROLLER_ H_ | 88 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_INSTALL_VIEW_CONTROLLER_ H_ |
| OLD | NEW |