| 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 #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 "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/i18n/rtl.h" | 8 #include "base/i18n/rtl.h" |
| 9 #include "base/mac/bundle_locations.h" | 9 #include "base/mac/bundle_locations.h" |
| 10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 @synthesize okButton = okButton_; | 173 @synthesize okButton = okButton_; |
| 174 @synthesize outlineView = outlineView_; | 174 @synthesize outlineView = outlineView_; |
| 175 @synthesize warningsSeparator = warningsSeparator_; | 175 @synthesize warningsSeparator = warningsSeparator_; |
| 176 @synthesize ratingStars = ratingStars_; | 176 @synthesize ratingStars = ratingStars_; |
| 177 @synthesize ratingCountField = ratingCountField_; | 177 @synthesize ratingCountField = ratingCountField_; |
| 178 @synthesize userCountField = userCountField_; | 178 @synthesize userCountField = userCountField_; |
| 179 @synthesize storeLinkButton = storeLinkButton_; | 179 @synthesize storeLinkButton = storeLinkButton_; |
| 180 | 180 |
| 181 - (id)initWithNavigator:(content::PageNavigator*)navigator | 181 - (id)initWithNavigator:(content::PageNavigator*)navigator |
| 182 delegate:(ExtensionInstallPrompt::Delegate*)delegate | 182 delegate:(ExtensionInstallPrompt::Delegate*)delegate |
| 183 prompt:(const ExtensionInstallPrompt::Prompt&)prompt { | 183 prompt:(scoped_refptr<ExtensionInstallPrompt::Prompt>)prompt { |
| 184 // We use a different XIB in the case of bundle installs, installs with | 184 // We use a different XIB in the case of bundle installs, installs with |
| 185 // webstore data, or no permission warnings. These are laid out nicely for | 185 // webstore data, or no permission warnings. These are laid out nicely for |
| 186 // the data they display. | 186 // the data they display. |
| 187 NSString* nibName = nil; | 187 NSString* nibName = nil; |
| 188 if (prompt.type() == ExtensionInstallPrompt::BUNDLE_INSTALL_PROMPT) { | 188 if (prompt->type() == ExtensionInstallPrompt::BUNDLE_INSTALL_PROMPT) { |
| 189 nibName = @"ExtensionInstallPromptBundle"; | 189 nibName = @"ExtensionInstallPromptBundle"; |
| 190 } else if (prompt.has_webstore_data()) { | 190 } else if (prompt->has_webstore_data()) { |
| 191 nibName = @"ExtensionInstallPromptWebstoreData"; | 191 nibName = @"ExtensionInstallPromptWebstoreData"; |
| 192 } else if (!prompt.ShouldShowPermissions() && | 192 } else if (!prompt->ShouldShowPermissions() && |
| 193 prompt.GetRetainedFileCount() == 0) { | 193 prompt->GetRetainedFileCount() == 0) { |
| 194 nibName = @"ExtensionInstallPromptNoWarnings"; | 194 nibName = @"ExtensionInstallPromptNoWarnings"; |
| 195 } else { | 195 } else { |
| 196 nibName = @"ExtensionInstallPrompt"; | 196 nibName = @"ExtensionInstallPrompt"; |
| 197 } | 197 } |
| 198 | 198 |
| 199 if ((self = [super initWithNibName:nibName | 199 if ((self = [super initWithNibName:nibName |
| 200 bundle:base::mac::FrameworkBundle()])) { | 200 bundle:base::mac::FrameworkBundle()])) { |
| 201 navigator_ = navigator; | 201 navigator_ = navigator; |
| 202 delegate_ = delegate; | 202 delegate_ = delegate; |
| 203 prompt_.reset(new ExtensionInstallPrompt::Prompt(prompt)); | 203 prompt_ = prompt; |
| 204 warnings_.reset([[self buildWarnings:prompt] retain]); | 204 warnings_.reset([[self buildWarnings:*prompt] retain]); |
| 205 } | 205 } |
| 206 return self; | 206 return self; |
| 207 } | 207 } |
| 208 | 208 |
| 209 - (IBAction)storeLinkClicked:(id)sender { | 209 - (IBAction)storeLinkClicked:(id)sender { |
| 210 GURL store_url(extension_urls::GetWebstoreItemDetailURLPrefix() + | 210 GURL store_url(extension_urls::GetWebstoreItemDetailURLPrefix() + |
| 211 prompt_->extension()->id()); | 211 prompt_->extension()->id()); |
| 212 navigator_->OpenURL(OpenURLParams( | 212 navigator_->OpenURL(OpenURLParams( |
| 213 store_url, Referrer(), NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, | 213 store_url, Referrer(), NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, |
| 214 false)); | 214 false)); |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 } | 734 } |
| 735 | 735 |
| 736 - (void)accessibilityPerformAction:(NSString*)action { | 736 - (void)accessibilityPerformAction:(NSString*)action { |
| 737 if ([action isEqualToString:NSAccessibilityPressAction]) | 737 if ([action isEqualToString:NSAccessibilityPressAction]) |
| 738 [self handleLinkClicked]; | 738 [self handleLinkClicked]; |
| 739 else | 739 else |
| 740 [super accessibilityPerformAction:action]; | 740 [super accessibilityPerformAction:action]; |
| 741 } | 741 } |
| 742 | 742 |
| 743 @end | 743 @end |
| OLD | NEW |