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

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

Issue 290733006: remove oauth from extension install dialog (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 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
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 "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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 prompt:(const ExtensionInstallPrompt::Prompt&)prompt { 183 prompt:(const 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.GetOAuthIssueCount() == 0 &&
194 prompt.GetRetainedFileCount() == 0) { 193 prompt.GetRetainedFileCount() == 0) {
195 nibName = @"ExtensionInstallPromptNoWarnings"; 194 nibName = @"ExtensionInstallPromptNoWarnings";
196 } else { 195 } else {
197 nibName = @"ExtensionInstallPrompt"; 196 nibName = @"ExtensionInstallPrompt";
198 } 197 }
199 198
200 if ((self = [super initWithNibName:nibName 199 if ((self = [super initWithNibName:nibName
201 bundle:base::mac::FrameworkBundle()])) { 200 bundle:base::mac::FrameworkBundle()])) {
202 navigator_ = navigator; 201 navigator_ = navigator;
203 delegate_ = delegate; 202 delegate_ = delegate;
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 [joinedItems appendString:@"\n"]; 300 [joinedItems appendString:@"\n"];
302 [joinedItems appendString:base::SysUTF16ToNSString( 301 [joinedItems appendString:base::SysUTF16ToNSString(
303 items[i].GetNameForDisplay())]; 302 items[i].GetNameForDisplay())];
304 } 303 }
305 [itemsField_ setStringValue:joinedItems]; 304 [itemsField_ setStringValue:joinedItems];
306 305
307 // Adjust the controls to fit the list of extensions. 306 // Adjust the controls to fit the list of extensions.
308 OffsetControlVerticallyToFitContent(itemsField_, &totalOffset); 307 OffsetControlVerticallyToFitContent(itemsField_, &totalOffset);
309 } 308 }
310 309
311 // If there are any warnings or OAuth issues, then we have to do some special 310 // If there are any warnings or retained files, then we have to do
312 // layout. 311 // some special layout.
313 if (prompt_->ShouldShowPermissions() || prompt_->GetOAuthIssueCount() > 0 || 312 if (prompt_->ShouldShowPermissions() || prompt_->GetRetainedFileCount() > 0) {
314 prompt_->GetRetainedFileCount() > 0) {
315 NSSize spacing = [outlineView_ intercellSpacing]; 313 NSSize spacing = [outlineView_ intercellSpacing];
316 spacing.width += 2; 314 spacing.width += 2;
317 spacing.height += 2; 315 spacing.height += 2;
318 [outlineView_ setIntercellSpacing:spacing]; 316 [outlineView_ setIntercellSpacing:spacing];
319 [[[[outlineView_ tableColumns] objectAtIndex:0] dataCell] setWraps:YES]; 317 [[[[outlineView_ tableColumns] objectAtIndex:0] dataCell] setWraps:YES];
320 for (id item in warnings_.get()) 318 for (id item in warnings_.get())
321 [self expandItemAndChildren:item]; 319 [self expandItemAndChildren:item];
322 320
323 // Adjust the outline view to fit the warnings. 321 // Adjust the outline view to fit the warnings.
324 OffsetOutlineViewVerticallyToFitContent(outlineView_, &totalOffset); 322 OffsetOutlineViewVerticallyToFitContent(outlineView_, &totalOffset);
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 children:nil]]; 630 children:nil]];
633 heading = @""; 631 heading = @"";
634 } 632 }
635 633
636 [warnings addObject:[self 634 [warnings addObject:[self
637 buildItemWithTitle:heading 635 buildItemWithTitle:heading
638 cellAttributes:kBoldText | kAutoExpandCell | kNoExpandMarker 636 cellAttributes:kBoldText | kAutoExpandCell | kNoExpandMarker
639 children:children]]; 637 children:children]];
640 } 638 }
641 639
642 if (prompt.GetOAuthIssueCount() > 0) {
643 type = ExtensionInstallPrompt::OAUTH_DETAILS;
644
645 NSMutableArray* children = [NSMutableArray array];
646
647 for (size_t i = 0; i < prompt.GetOAuthIssueCount(); ++i) {
648 NSMutableArray* details = [NSMutableArray array];
649 const IssueAdviceInfoEntry& issue = prompt.GetOAuthIssue(i);
650 if (!issue.details.empty() && prompt.GetIsShowingDetails(type, i)) {
651 for (size_t j = 0; j < issue.details.size(); ++j) {
652 [details addObject:
653 [self buildItemWithTitle:SysUTF16ToNSString(issue.details[j])
654 cellAttributes:kNoExpandMarker
655 children:nil]];
656 }
657 }
658
659 [children addObject:
660 [self buildItemWithTitle:SysUTF16ToNSString(issue.description)
661 cellAttributes:kUseBullet | kAutoExpandCell
662 children:details]];
663
664 if (!issue.details.empty()) {
665 // Add a row for the link.
666 [children addObject:
667 [self buildDetailToggleItem:type permissionsDetailIndex:i]];
668 }
669 }
670
671 [warnings addObject:
672 [self buildItemWithTitle:SysUTF16ToNSString(prompt.GetOAuthHeading())
673 cellAttributes:kBoldText | kAutoExpandCell| kNoExpandMarker
674 children:children]];
675 }
676
677 if (prompt.GetRetainedFileCount() > 0) { 640 if (prompt.GetRetainedFileCount() > 0) {
678 type = ExtensionInstallPrompt::RETAINED_FILES_DETAILS; 641 type = ExtensionInstallPrompt::RETAINED_FILES_DETAILS;
679 642
680 NSMutableArray* children = [NSMutableArray array]; 643 NSMutableArray* children = [NSMutableArray array];
681 644
682 if (prompt.GetIsShowingDetails(type, 0)) { 645 if (prompt.GetIsShowingDetails(type, 0)) {
683 for (size_t i = 0; i < prompt.GetRetainedFileCount(); ++i) { 646 for (size_t i = 0; i < prompt.GetRetainedFileCount(); ++i) {
684 [children addObject: 647 [children addObject:
685 [self buildItemWithTitle:SysUTF16ToNSString( 648 [self buildItemWithTitle:SysUTF16ToNSString(
686 prompt.GetRetainedFile(i)) 649 prompt.GetRetainedFile(i))
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 } 734 }
772 735
773 - (void)accessibilityPerformAction:(NSString*)action { 736 - (void)accessibilityPerformAction:(NSString*)action {
774 if ([action isEqualToString:NSAccessibilityPressAction]) 737 if ([action isEqualToString:NSAccessibilityPressAction])
775 [self handleLinkClicked]; 738 [self handleLinkClicked];
776 else 739 else
777 [super accessibilityPerformAction:action]; 740 [super accessibilityPerformAction:action];
778 } 741 }
779 742
780 @end 743 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698