Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1057)

Side by Side Diff: chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.h

Issue 917863003: [Extensions UI Mac] Wire up Mac to use the ExtensionInstalledBubble (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Robert's Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_INSTALLED_BUBBLE_CONTROLLER _H_ 5 #ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_CONTROLLER _H_
6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_CONTROLLER _H_ 6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_CONTROLLER _H_
7 7
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 11 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
12 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" 12 #import "chrome/browser/ui/cocoa/base_bubble_controller.h"
13 #include "third_party/skia/include/core/SkBitmap.h" 13 #include "third_party/skia/include/core/SkBitmap.h"
14 14
15 class Browser; 15 class Browser;
16 class ExtensionLoadedNotificationObserver; 16 class ExtensionInstalledBubble;
17 class ExtensionInstalledBubbleBridge;
17 @class HyperlinkTextView; 18 @class HyperlinkTextView;
18 @class HoverCloseButton; 19 @class HoverCloseButton;
19 @class InfoBubbleView; 20 @class InfoBubbleView;
20 21
21 namespace extensions { 22 namespace extensions {
22 class BundleInstaller; 23 class BundleInstaller;
23 class Extension; 24 class Extension;
24 } 25 }
25 26
26 namespace extension_installed_bubble { 27 namespace extension_installed_bubble {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 Browser* browser_; // weak 63 Browser* browser_; // weak
63 base::scoped_nsobject<NSImage> icon_; 64 base::scoped_nsobject<NSImage> icon_;
64 65
65 extension_installed_bubble::ExtensionType type_; 66 extension_installed_bubble::ExtensionType type_;
66 67
67 // We need to remove the page action immediately when the browser window 68 // We need to remove the page action immediately when the browser window
68 // closes while this bubble is still open, so the bubble's closing animation 69 // closes while this bubble is still open, so the bubble's closing animation
69 // doesn't overlap browser destruction. 70 // doesn't overlap browser destruction.
70 BOOL pageActionPreviewShowing_; 71 BOOL pageActionPreviewShowing_;
71 72
72 // Lets us register for EXTENSION_LOADED notifications. The actual 73 // The bridge to the C++ object that performs shared logic across platforms,
73 // notifications are sent to the observer object, which proxies them 74 // like listening for the notification that the extension is loaded. This
74 // back to the controller. 75 // tells us when to show the bubble.
75 scoped_ptr<ExtensionLoadedNotificationObserver> extensionObserver_; 76 scoped_ptr<ExtensionInstalledBubbleBridge> installedBubbleBridge_;
77 scoped_ptr<ExtensionInstalledBubble> installedBubble_;
76 78
77 // References below are weak, being obtained from the nib. 79 // References below are weak, being obtained from the nib.
78 IBOutlet HoverCloseButton* closeButton_; 80 IBOutlet HoverCloseButton* closeButton_;
79 IBOutlet NSImageView* iconImage_; 81 IBOutlet NSImageView* iconImage_;
80 IBOutlet NSTextField* heading_; 82 IBOutlet NSTextField* heading_;
81 // Only shown for browser actions, page actions and omnibox keywords. 83 // Only shown for browser actions, page actions and omnibox keywords.
82 IBOutlet NSTextField* howToUse_; 84 IBOutlet NSTextField* howToUse_;
83 IBOutlet NSTextField* howToManage_; 85 IBOutlet NSTextField* howToManage_;
84 // Only shown for app installs. 86 // Only shown for app installs.
85 IBOutlet NSButton* appShortcutLink_; 87 IBOutlet NSButton* appShortcutLink_;
86 // Only shown for extensions with commands. 88 // Only shown for extensions with commands.
87 IBOutlet NSButton* manageShortcutLink_; 89 IBOutlet NSButton* manageShortcutLink_;
88 // Only shown if the sign-in promo is active. 90 // Only shown if the sign-in promo is active.
89 IBOutlet NSTextField* promoPlaceholder_; 91 IBOutlet NSTextField* promoPlaceholder_;
90 // Text fields don't work as well with embedded links as text views, but 92 // Text fields don't work as well with embedded links as text views, but
91 // text views cannot conveniently be created in IB. The xib file contains 93 // text views cannot conveniently be created in IB. The xib file contains
92 // a text field |promoPlaceholder_| that's replaced by this text view |promo_| 94 // a text field |promoPlaceholder_| that's replaced by this text view |promo_|
93 // in -awakeFromNib. 95 // in -awakeFromNib.
94 base::scoped_nsobject<HyperlinkTextView> promo_; 96 base::scoped_nsobject<HyperlinkTextView> promo_;
95 // Only shown for bundle installs. 97 // Only shown for bundle installs.
96 IBOutlet NSTextField* installedHeadingMsg_; 98 IBOutlet NSTextField* installedHeadingMsg_;
97 IBOutlet NSTextField* installedItemsMsg_; 99 IBOutlet NSTextField* installedItemsMsg_;
98 IBOutlet NSTextField* failedHeadingMsg_; 100 IBOutlet NSTextField* failedHeadingMsg_;
99 IBOutlet NSTextField* failedItemsMsg_; 101 IBOutlet NSTextField* failedItemsMsg_;
100 } 102 }
101 103
102 @property(nonatomic, readonly) const extensions::Extension* extension;
103 @property(nonatomic, readonly) const extensions::BundleInstaller* bundle; 104 @property(nonatomic, readonly) const extensions::BundleInstaller* bundle;
104 @property(nonatomic) BOOL pageActionPreviewShowing; 105 @property(nonatomic) BOOL pageActionPreviewShowing;
105 106
106 // Initialize the window, and then create observers to wait for the extension 107 // Initialize the window, and then create observers to wait for the extension
107 // to complete loading, or the browser window to close. 108 // to complete loading, or the browser window to close.
108 - (id)initWithParentWindow:(NSWindow*)parentWindow 109 - (id)initWithParentWindow:(NSWindow*)parentWindow
109 extension:(const extensions::Extension*)extension 110 extension:(const extensions::Extension*)extension
110 bundle:(const extensions::BundleInstaller*)bundle 111 bundle:(const extensions::BundleInstaller*)bundle
111 browser:(Browser*)browser 112 browser:(Browser*)browser
112 icon:(SkBitmap)icon; 113 icon:(SkBitmap)icon;
113 114
114 // Action for close button. 115 // Action for close button.
115 - (IBAction)closeWindow:(id)sender; 116 - (IBAction)closeWindow:(id)sender;
116 117
117 // From NSTextViewDelegate: 118 // From NSTextViewDelegate:
118 - (BOOL)textView:(NSTextView*)aTextView 119 - (BOOL)textView:(NSTextView*)aTextView
119 clickedOnLink:(id)link 120 clickedOnLink:(id)link
120 atIndex:(NSUInteger)charIndex; 121 atIndex:(NSUInteger)charIndex;
121 122
122 // Displays the extension installed bubble. This callback is triggered by 123 // Displays the extension installed bubble. This callback is triggered by
123 // the extensionObserver when the extension has completed loading. 124 // the extensionObserver when the extension has completed loading.
124 - (void)showWindow:(id)sender; 125 - (void)showWindow:(id)sender;
125 126
126 // Clears our weak pointer to the Extension. This callback is triggered by
127 // the extensionObserver when the extension is unloaded.
128 - (void)extensionUnloaded:(id)sender;
129
130 // Opens the shortcut configuration UI. 127 // Opens the shortcut configuration UI.
131 - (IBAction)onManageShortcutClicked:(id)sender; 128 - (IBAction)onManageShortcutClicked:(id)sender;
132 129
133 // Shows the new app installed animation. 130 // Shows the new app installed animation.
134 - (IBAction)onAppShortcutClicked:(id)sender; 131 - (IBAction)onAppShortcutClicked:(id)sender;
135 132
136 @end 133 @end
137 134
138 @interface ExtensionInstalledBubbleController (ExposedForTesting) 135 @interface ExtensionInstalledBubbleController (ExposedForTesting)
139 136
140 - (void)removePageActionPreviewIfNecessary; 137 - (void)removePageActionPreviewIfNecessary;
141 - (NSWindow*)initializeWindow; 138 - (NSWindow*)initializeWindow;
142 - (int)calculateWindowHeight; 139 - (int)calculateWindowHeight;
143 - (void)setMessageFrames:(int)newWindowHeight; 140 - (void)setMessageFrames:(int)newWindowHeight;
144 - (NSRect)headingFrame; 141 - (NSRect)headingFrame;
145 - (NSRect)frameOfHowToUse; 142 - (NSRect)frameOfHowToUse;
146 - (NSRect)frameOfHowToManage; 143 - (NSRect)frameOfHowToManage;
147 - (NSRect)frameOfSigninPromo; 144 - (NSRect)frameOfSigninPromo;
148 - (BOOL)showSyncPromo; 145 - (BOOL)showSyncPromo;
149 - (NSButton*)appInstalledShortcutLink; 146 - (NSButton*)appInstalledShortcutLink;
150 147
151 @end // ExtensionInstalledBubbleController(ExposedForTesting) 148 @end // ExtensionInstalledBubbleController(ExposedForTesting)
152 149
153 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_CONTROL LER_H_ 150 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_CONTROL LER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698