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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_INSTALL_VIEW_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_INSTALL_VIEW_CONTROLLER_H_
10 #import <Cocoa/Cocoa.h>
12 #include "base/mac/scoped_nsobject.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/strings/string16.h"
15 #include "chrome/browser/extensions/extension_install_prompt.h"
16 #include "ui/gfx/image/image_skia.h"
22 // Displays the extension or bundle install prompt, and notifies the
23 // ExtensionInstallPrompt::Delegate of success or failure
24 @interface ExtensionInstallViewController
: NSViewController
25 <NSOutlineViewDataSource
,
26 NSOutlineViewDelegate
> {
27 IBOutlet NSImageView
* iconView_
;
28 IBOutlet NSTextField
* titleField_
;
29 IBOutlet NSTextField
* itemsField_
;
30 IBOutlet NSButton
* cancelButton_
;
31 IBOutlet NSButton
* okButton_
;
33 // Present only when the dialog has permission warnings or OAuth issues to
35 IBOutlet NSOutlineView
* outlineView_
;
37 // Present only in the install dialogs with webstore data (inline and
39 IBOutlet NSBox
* warningsSeparator_
; // Only when there are permissions.
40 IBOutlet NSView
* ratingStars_
;
41 IBOutlet NSTextField
* ratingCountField_
;
42 IBOutlet NSTextField
* userCountField_
;
43 IBOutlet NSButton
* storeLinkButton_
;
45 content::PageNavigator
* navigator_
; // weak
46 ExtensionInstallPrompt::Delegate
* delegate_
; // weak
47 scoped_ptr
<ExtensionInstallPrompt::Prompt
> prompt_
;
49 base::scoped_nsobject
<NSArray
> warnings_
;
50 BOOL isComputingRowHeight_
;
53 // For unit test use only.
54 @
property(nonatomic
, readonly
) NSImageView
* iconView
;
55 @
property(nonatomic
, readonly
) NSTextField
* titleField
;
56 @
property(nonatomic
, readonly
) NSTextField
* itemsField
;
57 @
property(nonatomic
, readonly
) NSButton
* cancelButton
;
58 @
property(nonatomic
, readonly
) NSButton
* okButton
;
59 @
property(nonatomic
, readonly
) NSOutlineView
* outlineView
;
60 @
property(nonatomic
, readonly
) NSBox
* warningsSeparator
;
61 @
property(nonatomic
, readonly
) NSView
* ratingStars
;
62 @
property(nonatomic
, readonly
) NSTextField
* ratingCountField
;
63 @
property(nonatomic
, readonly
) NSTextField
* userCountField
;
64 @
property(nonatomic
, readonly
) NSButton
* storeLinkButton
;
66 - (id
)initWithNavigator
:(content::PageNavigator
*)navigator
67 delegate
:(ExtensionInstallPrompt::Delegate
*)delegate
68 prompt
:(const ExtensionInstallPrompt::Prompt
&)prompt
;
69 - (IBAction
)storeLinkClicked
:(id
)sender
; // Callback for "View details" link.
70 - (IBAction
)cancel
:(id
)sender
;
71 - (IBAction
)ok
:(id
)sender
;
75 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_INSTALL_VIEW_CONTROLLER_H_