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

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

Issue 10872067: No more extension install infobars. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/cocoa/extensions/extension_installed_bubble_bridge.mm ('k') | no next file » | 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 #import "chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controlle r.h" 5 #import "chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controlle r.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/mac/bundle_locations.h" 8 #include "base/mac/bundle_locations.h"
9 #include "base/mac/mac_util.h" 9 #include "base/mac/mac_util.h"
10 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 if (bundle_) { 106 if (bundle_) {
107 type_ = extension_installed_bubble::kBundle; 107 type_ = extension_installed_bubble::kBundle;
108 } else if (!extension->omnibox_keyword().empty()) { 108 } else if (!extension->omnibox_keyword().empty()) {
109 type_ = extension_installed_bubble::kOmniboxKeyword; 109 type_ = extension_installed_bubble::kOmniboxKeyword;
110 } else if (extension->browser_action()) { 110 } else if (extension->browser_action()) {
111 type_ = extension_installed_bubble::kBrowserAction; 111 type_ = extension_installed_bubble::kBrowserAction;
112 } else if (extension->page_action() && 112 } else if (extension->page_action() &&
113 !extension->page_action()->default_icon_path().empty()) { 113 !extension->page_action()->default_icon_path().empty()) {
114 type_ = extension_installed_bubble::kPageAction; 114 type_ = extension_installed_bubble::kPageAction;
115 } else { 115 } else {
116 NOTREACHED(); // kGeneric installs handled in extension_install_prompt. 116 type_ = extension_installed_bubble::kGeneric;
117 } 117 }
118 118
119 if (type_ == extension_installed_bubble::kBundle) { 119 if (type_ == extension_installed_bubble::kBundle) {
120 [self showWindow:self]; 120 [self showWindow:self];
121 } else { 121 } else {
122 // Start showing window only after extension has fully loaded. 122 // Start showing window only after extension has fully loaded.
123 extensionObserver_.reset(new ExtensionLoadedNotificationObserver( 123 extensionObserver_.reset(new ExtensionLoadedNotificationObserver(
124 self, browser->profile())); 124 self, browser->profile()));
125 } 125 }
126 } 126 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 // would ordinarily only be displayed on a page of the appropriate type. 200 // would ordinarily only be displayed on a page of the appropriate type.
201 // We remove this preview when the extension installed bubble closes. 201 // We remove this preview when the extension installed bubble closes.
202 locationBarView->SetPreviewEnabledPageAction(extension_->page_action(), 202 locationBarView->SetPreviewEnabledPageAction(extension_->page_action(),
203 true); 203 true);
204 204
205 // Find the center of the bottom of the page action icon. 205 // Find the center of the bottom of the page action icon.
206 arrowPoint = 206 arrowPoint =
207 locationBarView->GetPageActionBubblePoint(extension_->page_action()); 207 locationBarView->GetPageActionBubblePoint(extension_->page_action());
208 break; 208 break;
209 } 209 }
210 case extension_installed_bubble::kBundle: { 210 case extension_installed_bubble::kBundle:
211 case extension_installed_bubble::kGeneric: {
212 // Point at the bottom of the wrench menu.
211 NSView* wrenchButton = 213 NSView* wrenchButton =
212 [[window->cocoa_controller() toolbarController] wrenchButton]; 214 [[window->cocoa_controller() toolbarController] wrenchButton];
213 const NSRect bounds = [wrenchButton bounds]; 215 const NSRect bounds = [wrenchButton bounds];
214 NSPoint anchor = NSMakePoint(NSMidX(bounds), NSMidY(bounds)); 216 NSPoint anchor = NSMakePoint(NSMidX(bounds), NSMaxY(bounds));
215 arrowPoint = [wrenchButton convertPoint:anchor toView:nil]; 217 arrowPoint = [wrenchButton convertPoint:anchor toView:nil];
216 break; 218 break;
217 } 219 }
218 default: { 220 default: {
219 NOTREACHED() << "Generic extension type not allowed in install bubble."; 221 NOTREACHED();
220 } 222 }
221 } 223 }
222 return arrowPoint; 224 return arrowPoint;
223 } 225 }
224 226
225 // Override -[BaseBubbleController showWindow:] to tweak bubble location and 227 // Override -[BaseBubbleController showWindow:] to tweak bubble location and
226 // set up UI elements. 228 // set up UI elements.
227 - (void)showWindow:(id)sender { 229 - (void)showWindow:(id)sender {
228 // Generic extensions get an infobar rather than a bubble.
229 DCHECK(type_ != extension_installed_bubble::kGeneric);
230 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 230 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
231 231
232 // Load nib and calculate height based on messages to be shown. 232 // Load nib and calculate height based on messages to be shown.
233 NSWindow* window = [self initializeWindow]; 233 NSWindow* window = [self initializeWindow];
234 int newWindowHeight = [self calculateWindowHeight]; 234 int newWindowHeight = [self calculateWindowHeight];
235 [self.bubble setFrameSize:NSMakeSize( 235 [self.bubble setFrameSize:NSMakeSize(
236 NSWidth([[window contentView] bounds]), newWindowHeight)]; 236 NSWidth([[window contentView] bounds]), newWindowHeight)];
237 NSSize windowDelta = NSMakeSize( 237 NSSize windowDelta = NSMakeSize(
238 0, newWindowHeight - NSHeight([[window contentView] bounds])); 238 0, newWindowHeight - NSHeight([[window contentView] bounds]));
239 windowDelta = [[window contentView] convertSize:windowDelta toView:nil]; 239 windowDelta = [[window contentView] convertSize:windowDelta toView:nil];
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 450
451 - (NSRect)getExtensionInstalledInfoMsgFrame { 451 - (NSRect)getExtensionInstalledInfoMsgFrame {
452 return [extensionInstalledInfoMsg_ frame]; 452 return [extensionInstalledInfoMsg_ frame];
453 } 453 }
454 454
455 - (void)extensionUnloaded:(id)sender { 455 - (void)extensionUnloaded:(id)sender {
456 extension_ = NULL; 456 extension_ = NULL;
457 } 457 }
458 458
459 @end 459 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/extensions/extension_installed_bubble_bridge.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698