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

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

Issue 580363002: Update app info and install prompt UI to show retained devices. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
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:(scoped_refptr<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 prompt->GetRetainedDeviceCount() == 0) {
194 nibName = @"ExtensionInstallPromptNoWarnings"; 195 nibName = @"ExtensionInstallPromptNoWarnings";
195 } else { 196 } else {
196 nibName = @"ExtensionInstallPrompt"; 197 nibName = @"ExtensionInstallPrompt";
197 } 198 }
198 199
199 if ((self = [super initWithNibName:nibName 200 if ((self = [super initWithNibName:nibName
200 bundle:base::mac::FrameworkBundle()])) { 201 bundle:base::mac::FrameworkBundle()])) {
201 navigator_ = navigator; 202 navigator_ = navigator;
202 delegate_ = delegate; 203 delegate_ = delegate;
203 prompt_ = prompt; 204 prompt_ = prompt;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 [joinedItems appendString:@"\n"]; 301 [joinedItems appendString:@"\n"];
301 [joinedItems appendString:base::SysUTF16ToNSString( 302 [joinedItems appendString:base::SysUTF16ToNSString(
302 items[i].GetNameForDisplay())]; 303 items[i].GetNameForDisplay())];
303 } 304 }
304 [itemsField_ setStringValue:joinedItems]; 305 [itemsField_ setStringValue:joinedItems];
305 306
306 // Adjust the controls to fit the list of extensions. 307 // Adjust the controls to fit the list of extensions.
307 OffsetControlVerticallyToFitContent(itemsField_, &totalOffset); 308 OffsetControlVerticallyToFitContent(itemsField_, &totalOffset);
308 } 309 }
309 310
310 // If there are any warnings or retained files, then we have to do 311 // If there are any warnings, retained devices or retained files, then we
311 // some special layout. 312 // have to do some special layout.
312 if (prompt_->ShouldShowPermissions() || prompt_->GetRetainedFileCount() > 0) { 313 if (prompt_->ShouldShowPermissions() || prompt_->GetRetainedFileCount() > 0) {
313 NSSize spacing = [outlineView_ intercellSpacing]; 314 NSSize spacing = [outlineView_ intercellSpacing];
314 spacing.width += 2; 315 spacing.width += 2;
315 spacing.height += 2; 316 spacing.height += 2;
316 [outlineView_ setIntercellSpacing:spacing]; 317 [outlineView_ setIntercellSpacing:spacing];
317 [[[[outlineView_ tableColumns] objectAtIndex:0] dataCell] setWraps:YES]; 318 [[[[outlineView_ tableColumns] objectAtIndex:0] dataCell] setWraps:YES];
318 for (id item in warnings_.get()) 319 for (id item in warnings_.get())
319 [self expandItemAndChildren:item]; 320 [self expandItemAndChildren:item];
320 321
321 // Adjust the outline view to fit the warnings. 322 // Adjust the outline view to fit the warnings.
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 [self buildItemWithTitle:SysUTF16ToNSString( 657 [self buildItemWithTitle:SysUTF16ToNSString(
657 prompt.GetRetainedFilesHeading()) 658 prompt.GetRetainedFilesHeading())
658 cellAttributes:kBoldText | kAutoExpandCell | kNoExpandMarker 659 cellAttributes:kBoldText | kAutoExpandCell | kNoExpandMarker
659 children:children]]; 660 children:children]];
660 661
661 // Add a row for the link. 662 // Add a row for the link.
662 [warnings addObject: 663 [warnings addObject:
663 [self buildDetailToggleItem:type permissionsDetailIndex:0]]; 664 [self buildDetailToggleItem:type permissionsDetailIndex:0]];
664 } 665 }
665 666
667 if (prompt.GetRetainedDeviceCount() > 0) {
668 type = ExtensionInstallPrompt::RETAINED_DEVICES_DETAILS;
tapted 2014/09/19 04:09:09 What happens if an extension has both retained dev
Reilly Grant (use Gerrit) 2014/09/19 19:30:09 You get two lists and the button says "Revoke File
tapted 2014/09/22 01:04:36 Ah - cool. On the cocoa side it looked like `type`
669
670 NSMutableArray* children = [NSMutableArray array];
671
672 if (prompt.GetIsShowingDetails(type, 0)) {
673 for (size_t i = 0; i < prompt.GetRetainedDeviceCount(); ++i) {
674 [children
tapted 2014/09/19 04:09:09 nit: a temporary `title` var will probably make th
Reilly Grant (use Gerrit) 2014/09/19 19:30:09 Done.
675 addObject:[self buildItemWithTitle:
676 SysUTF16ToNSString(
677 prompt.GetRetainedDeviceMessageString(i))
678 cellAttributes:kUseBullet
679 children:nil]];
680 }
681 }
682
683 [warnings
tapted 2014/09/19 04:09:09 same here, clang-format will probably do something
684 addObject:[self
685 buildItemWithTitle:SysUTF16ToNSString(
686 prompt.GetRetainedDevicesHeading())
687 cellAttributes:kBoldText | kAutoExpandCell |
688 kNoExpandMarker
689 children:children]];
690
691 // Add a row for the link.
692 [warnings
693 addObject:[self buildDetailToggleItem:type permissionsDetailIndex:0]];
694 }
695
666 return warnings; 696 return warnings;
667 } 697 }
668 698
669 - (void)updateViewFrame:(NSRect)frame { 699 - (void)updateViewFrame:(NSRect)frame {
670 NSWindow* window = [[self view] window]; 700 NSWindow* window = [[self view] window];
671 [window setFrame:[window frameRectForContentRect:frame] display:YES]; 701 [window setFrame:[window frameRectForContentRect:frame] display:YES];
672 [[self view] setFrame:frame]; 702 [[self view] setFrame:frame];
673 } 703 }
674 704
675 @end 705 @end
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 } 764 }
735 765
736 - (void)accessibilityPerformAction:(NSString*)action { 766 - (void)accessibilityPerformAction:(NSString*)action {
737 if ([action isEqualToString:NSAccessibilityPressAction]) 767 if ([action isEqualToString:NSAccessibilityPressAction])
738 [self handleLinkClicked]; 768 [self handleLinkClicked];
739 else 769 else
740 [super accessibilityPerformAction:action]; 770 [super accessibilityPerformAction:action];
741 } 771 }
742 772
743 @end 773 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698