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

Unified 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: Rebased to ToT. 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/extensions/extension_install_view_controller.mm
diff --git a/chrome/browser/ui/cocoa/extensions/extension_install_view_controller.mm b/chrome/browser/ui/cocoa/extensions/extension_install_view_controller.mm
index cf9918ca4a2449bffc9aadc66dcd6b644fc78d89..d621a69406ca9153afd06fa8829589033cd4ef86 100644
--- a/chrome/browser/ui/cocoa/extensions/extension_install_view_controller.mm
+++ b/chrome/browser/ui/cocoa/extensions/extension_install_view_controller.mm
@@ -198,7 +198,8 @@ bool HasAttribute(id item, CellAttributesMask attributeMask) {
} else if (prompt->has_webstore_data()) {
nibName = @"ExtensionInstallPromptWebstoreData";
} else if (!prompt->ShouldShowPermissions() &&
- prompt->GetRetainedFileCount() == 0) {
+ prompt->GetRetainedFileCount() == 0 &&
+ prompt->GetRetainedDeviceCount() == 0) {
nibName = @"ExtensionInstallPromptNoWarnings";
} else {
nibName = @"ExtensionInstallPrompt";
@@ -315,8 +316,8 @@ bool HasAttribute(id item, CellAttributesMask attributeMask) {
OffsetControlVerticallyToFitContent(itemsField_, &totalOffset);
}
- // If there are any warnings or retained files, then we have to do
- // some special layout.
+ // If there are any warnings, retained devices or retained files, then we
+ // have to do some special layout.
if (prompt_->ShouldShowPermissions() || prompt_->GetRetainedFileCount() > 0) {
NSSize spacing = [outlineView_ intercellSpacing];
spacing.width += 2;
@@ -602,8 +603,6 @@ bool HasAttribute(id item, CellAttributesMask attributeMask) {
NSString* heading = nil;
NSString* withheldHeading = nil;
- ExtensionInstallPrompt::DetailsType type =
- ExtensionInstallPrompt::PERMISSIONS_DETAILS;
bool hasPermissions = prompt.GetPermissionCount(
ExtensionInstallPrompt::PermissionsType::ALL_PERMISSIONS);
CellAttributes warningCellAttributes =
@@ -647,31 +646,56 @@ bool HasAttribute(id item, CellAttributesMask attributeMask) {
}
if (prompt.GetRetainedFileCount() > 0) {
- type = ExtensionInstallPrompt::RETAINED_FILES_DETAILS;
+ const ExtensionInstallPrompt::DetailsType type =
+ ExtensionInstallPrompt::RETAINED_FILES_DETAILS;
NSMutableArray* children = [NSMutableArray array];
if (prompt.GetIsShowingDetails(type, 0)) {
for (size_t i = 0; i < prompt.GetRetainedFileCount(); ++i) {
- [children addObject:
- [self buildItemWithTitle:SysUTF16ToNSString(
- prompt.GetRetainedFile(i))
- cellAttributes:kUseBullet
- children:nil]];
+ NSString* title = SysUTF16ToNSString(prompt.GetRetainedFile(i));
+ [children addObject:[self buildItemWithTitle:title
+ cellAttributes:kUseBullet
+ children:nil]];
}
}
- [warnings
- addObject:[self buildItemWithTitle:SysUTF16ToNSString(
- prompt.GetRetainedFilesHeading())
- cellAttributes:warningCellAttributes
- children:children]];
+ NSString* title = SysUTF16ToNSString(prompt.GetRetainedFilesHeading());
+ [warnings addObject:[self buildItemWithTitle:title
+ cellAttributes:warningCellAttributes
+ children:children]];
// Add a row for the link.
[warnings addObject:
[self buildDetailToggleItem:type permissionsDetailIndex:0]];
}
+ if (prompt.GetRetainedDeviceCount() > 0) {
+ const ExtensionInstallPrompt::DetailsType type =
+ ExtensionInstallPrompt::RETAINED_DEVICES_DETAILS;
+
+ NSMutableArray* children = [NSMutableArray array];
+
+ if (prompt.GetIsShowingDetails(type, 0)) {
+ for (size_t i = 0; i < prompt.GetRetainedDeviceCount(); ++i) {
+ NSString* title =
+ SysUTF16ToNSString(prompt.GetRetainedDeviceMessageString(i));
+ [children addObject:[self buildItemWithTitle:title
+ cellAttributes:kUseBullet
+ children:nil]];
+ }
+ }
+
+ NSString* title = SysUTF16ToNSString(prompt.GetRetainedDevicesHeading());
+ [warnings addObject:[self buildItemWithTitle:title
+ cellAttributes:warningCellAttributes
+ children:children]];
+
+ // Add a row for the link.
+ [warnings
+ addObject:[self buildDetailToggleItem:type permissionsDetailIndex:0]];
+ }
+
return warnings;
}

Powered by Google App Engine
This is Rietveld 408576698