Commit ccb5af45 authored by sashab@chromium.org's avatar sashab@chromium.org

Make App Info Dialog file permissions middle elided

Update the list of file permissions in the App Info dialog to elide in
the middle, to better match the UI mocks of the dialog.

Screenshots on bug.

BUG=385978

Review URL: https://codereview.chromium.org/341703003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278395 0039d316-1c4b-4281-b951-d872f2087c98
parent 5203a35c
......@@ -55,7 +55,9 @@ AppInfoPermissionsPanel::~AppInfoPermissionsPanel() {
// Given a list of strings, returns a view containing a list of these strings
// as bulleted items.
views::View* AppInfoPermissionsPanel::CreateBulletedListView(
const std::vector<base::string16>& messages) {
const std::vector<base::string16>& messages,
bool allow_multiline,
gfx::ElideBehavior elide_behavior) {
const int kSpacingBetweenBulletAndStartOfText = 5;
views::View* list_view = CreateVerticalStack();
......@@ -64,7 +66,11 @@ views::View* AppInfoPermissionsPanel::CreateBulletedListView(
++it) {
views::Label* permission_label = new views::Label(*it);
permission_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
permission_label->SetMultiLine(true);
if (allow_multiline)
permission_label->SetMultiLine(true);
else
permission_label->SetElideBehavior(elide_behavior);
// Extract only the bullet from the IDS_EXTENSION_PERMISSION_LINE text, and
// place it in it's own view so it doesn't align vertically with the
......@@ -101,7 +107,8 @@ void AppInfoPermissionsPanel::CreateActivePermissionsControl() {
} else {
active_permissions_heading_ = CreateHeading(l10n_util::GetStringUTF16(
IDS_APPLICATION_INFO_ACTIVE_PERMISSIONS_TEXT));
active_permissions_list_ = CreateBulletedListView(permission_strings);
active_permissions_list_ =
CreateBulletedListView(permission_strings, true, gfx::TRUNCATE);
}
}
......@@ -118,8 +125,8 @@ void AppInfoPermissionsPanel::CreateRetainedFilesControl() {
retained_files_heading_ = CreateHeading(l10n_util::GetStringUTF16(
IDS_APPLICATION_INFO_RETAINED_FILE_PERMISSIONS_TEXT));
retained_files_list_ =
CreateBulletedListView(retained_file_permission_messages);
retained_files_list_ = CreateBulletedListView(
retained_file_permission_messages, false, gfx::ELIDE_MIDDLE);
}
}
......
......@@ -8,6 +8,7 @@
#include <vector>
#include "chrome/browser/ui/views/apps/app_info_dialog/app_info_panel.h"
#include "ui/gfx/text_constants.h"
#include "ui/views/controls/button/button.h"
class Profile;
......@@ -46,9 +47,12 @@ class AppInfoPermissionsPanel : public AppInfoPanel,
RetainedFilePermissionsObtainedCorrectly);
// Given a list of strings, returns a view containing a list of these strings
// as bulleted items.
// as bulleted items with the given |elide_behavior|. If |allow_multiline| is
// true, allow multi-lined bulleted items and ignore the |elide_behavior|.
views::View* CreateBulletedListView(
const std::vector<base::string16>& messages);
const std::vector<base::string16>& messages,
bool allow_multiline,
gfx::ElideBehavior elide_behavior);
// Internal initialisation methods.
void CreateActivePermissionsControl();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment