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

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

Issue 1534123002: [Extensions] Migrate ExtensionInstallPrompt::Delegate to be a callback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
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_install_view_controller.h" 5 #import "chrome/browser/ui/cocoa/extensions/extension_install_view_controller.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 @synthesize okButton = okButton_; 218 @synthesize okButton = okButton_;
219 @synthesize outlineView = outlineView_; 219 @synthesize outlineView = outlineView_;
220 @synthesize warningsSeparator = warningsSeparator_; 220 @synthesize warningsSeparator = warningsSeparator_;
221 @synthesize ratingStars = ratingStars_; 221 @synthesize ratingStars = ratingStars_;
222 @synthesize ratingCountField = ratingCountField_; 222 @synthesize ratingCountField = ratingCountField_;
223 @synthesize userCountField = userCountField_; 223 @synthesize userCountField = userCountField_;
224 @synthesize storeLinkButton = storeLinkButton_; 224 @synthesize storeLinkButton = storeLinkButton_;
225 225
226 - (id)initWithProfile:(Profile*)profile 226 - (id)initWithProfile:(Profile*)profile
227 navigator:(content::PageNavigator*)navigator 227 navigator:(content::PageNavigator*)navigator
228 delegate:(ExtensionInstallPrompt::Delegate*)delegate 228 delegate:(ExtensionInstallViewDelegate*)delegate
229 prompt:(scoped_ptr<ExtensionInstallPrompt::Prompt>)prompt { 229 prompt:(scoped_ptr<ExtensionInstallPrompt::Prompt>)prompt {
230 // We use a different XIB in the case of bundle installs, installs with 230 // We use a different XIB in the case of bundle installs, installs with
231 // webstore data, or no permission warnings. These are laid out nicely for 231 // webstore data, or no permission warnings. These are laid out nicely for
232 // the data they display. 232 // the data they display.
233 NSString* nibName = nil; 233 NSString* nibName = nil;
234 if (prompt->type() == ExtensionInstallPrompt::BUNDLE_INSTALL_PROMPT) { 234 if (prompt->type() == ExtensionInstallPrompt::BUNDLE_INSTALL_PROMPT) {
235 nibName = @"ExtensionInstallPromptBundle"; 235 nibName = @"ExtensionInstallPromptBundle";
236 } else if (prompt->has_webstore_data()) { 236 } else if (prompt->has_webstore_data()) {
237 nibName = @"ExtensionInstallPromptWebstoreData"; 237 nibName = @"ExtensionInstallPromptWebstoreData";
238 } else if (!prompt->ShouldShowPermissions() && 238 } else if (!prompt->ShouldShowPermissions() &&
(...skipping 21 matching lines...) Expand all
260 OpenURLParams params(store_url, Referrer(), NEW_FOREGROUND_TAB, 260 OpenURLParams params(store_url, Referrer(), NEW_FOREGROUND_TAB,
261 ui::PAGE_TRANSITION_LINK, false); 261 ui::PAGE_TRANSITION_LINK, false);
262 if (navigator_) { 262 if (navigator_) {
263 navigator_->OpenURL(params); 263 navigator_->OpenURL(params);
264 } else { 264 } else {
265 chrome::ScopedTabbedBrowserDisplayer displayer( 265 chrome::ScopedTabbedBrowserDisplayer displayer(
266 profile_, chrome::GetActiveDesktop()); 266 profile_, chrome::GetActiveDesktop());
267 displayer.browser()->OpenURL(params); 267 displayer.browser()->OpenURL(params);
268 } 268 }
269 269
270 delegate_->InstallUIAbort(/*user_initiated=*/true); 270 delegate_->OnStoreLinkClicked();
271 } 271 }
272 272
273 - (IBAction)cancel:(id)sender { 273 - (IBAction)cancel:(id)sender {
274 delegate_->InstallUIAbort(/*user_initiated=*/true); 274 delegate_->OnCancelButtonClicked();
275 } 275 }
276 276
277 - (IBAction)ok:(id)sender { 277 - (IBAction)ok:(id)sender {
278 delegate_->InstallUIProceed(); 278 delegate_->OnOkButtonClicked();
279 } 279 }
280 280
281 - (void)awakeFromNib { 281 - (void)awakeFromNib {
282 // Since linking to 10.10, |outlineView_| needs an explicit background to 282 // Since linking to 10.10, |outlineView_| needs an explicit background to
283 // ensure subpixel antialiasing is enabled for the permissions text. At the 283 // ensure subpixel antialiasing is enabled for the permissions text. At the
284 // same time, the animation that shows the prompt breaks whenever the scroll 284 // same time, the animation that shows the prompt breaks whenever the scroll
285 // view is present. Giving the scroll view a layer restores the animation, and 285 // view is present. Giving the scroll view a layer restores the animation, and
286 // since its contents has an opaque background, subpixel AA isn't affected. 286 // since its contents has an opaque background, subpixel AA isn't affected.
287 [[outlineView_ enclosingScrollView] setWantsLayer:YES]; 287 [[outlineView_ enclosingScrollView] setWantsLayer:YES];
288 [outlineView_ setBackgroundColor:[NSColor whiteColor]]; 288 [outlineView_ setBackgroundColor:[NSColor whiteColor]];
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 } 856 }
857 857
858 - (void)accessibilityPerformAction:(NSString*)action { 858 - (void)accessibilityPerformAction:(NSString*)action {
859 if ([action isEqualToString:NSAccessibilityPressAction]) 859 if ([action isEqualToString:NSAccessibilityPressAction])
860 [self handleLinkClicked]; 860 [self handleLinkClicked];
861 else 861 else
862 [super accessibilityPerformAction:action]; 862 [super accessibilityPerformAction:action];
863 } 863 }
864 864
865 @end 865 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698