Index: chrome/browser/ui/views/apps/app_info_dialog/app_info_summary_panel.cc |
diff --git a/chrome/browser/ui/views/apps/app_info_dialog/app_info_summary_panel.cc b/chrome/browser/ui/views/apps/app_info_dialog/app_info_summary_panel.cc |
index 5c5d6fe75f988b12c9fd30adb180db88b714bda2..66494f299c68039dbd3bd0302d47001cecc11731 100644 |
--- a/chrome/browser/ui/views/apps/app_info_dialog/app_info_summary_panel.cc |
+++ b/chrome/browser/ui/views/apps/app_info_dialog/app_info_summary_panel.cc |
@@ -18,6 +18,7 @@ |
#include "extensions/browser/extension_prefs.h" |
#include "extensions/browser/extension_system.h" |
#include "extensions/common/extension.h" |
+#include "extensions/common/manifest.h" |
#include "grit/generated_resources.h" |
#include "ui/base/l10n/l10n_util.h" |
#include "ui/base/models/combobox_model.h" |
@@ -127,9 +128,13 @@ AppInfoSummaryPanel::AppInfoSummaryPanel(Profile* profile, |
: AppInfoPanel(profile, app), |
description_heading_(NULL), |
description_label_(NULL), |
+ details_heading_(NULL), |
+ version_title_(NULL), |
+ version_value_(NULL), |
launch_options_combobox_(NULL) { |
// Create UI elements. |
CreateDescriptionControl(); |
+ CreateDetailsControl(); |
CreateLaunchOptionControl(); |
// Layout elements. |
@@ -140,6 +145,7 @@ AppInfoSummaryPanel::AppInfoSummaryPanel(Profile* profile, |
views::kUnrelatedControlVerticalSpacing)); |
LayoutDescriptionControl(); |
+ LayoutDetailsControl(); |
if (launch_options_combobox_) |
AddChildView(launch_options_combobox_); |
@@ -162,9 +168,19 @@ void AppInfoSummaryPanel::CreateDescriptionControl() { |
description_heading_ = CreateHeading( |
l10n_util::GetStringUTF16(IDS_APPLICATION_INFO_DESCRIPTION_TITLE)); |
- description_label_ = new views::Label(text); |
+ description_label_ = CreateLeftAlignedLabel(text); |
description_label_->SetMultiLine(true); |
- description_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
+ } |
+} |
+ |
+void AppInfoSummaryPanel::CreateDetailsControl() { |
+ if (HasVersion()) { |
+ details_heading_ = CreateHeading( |
+ l10n_util::GetStringUTF16(IDS_APPLICATION_INFO_DETAILS_TITLE)); |
+ version_title_ = CreateLeftAlignedLabel( |
+ l10n_util::GetStringUTF16(IDS_APPLICATION_INFO_VERSION_LABEL)); |
+ version_value_ = |
+ CreateLeftAlignedLabel(base::ASCIIToUTF16(app_->VersionString())); |
} |
} |
@@ -190,6 +206,26 @@ void AppInfoSummaryPanel::LayoutDescriptionControl() { |
} |
} |
+void AppInfoSummaryPanel::LayoutDetailsControl() { |
+ if (details_heading_) { |
+ views::View* details_stack = |
+ CreateVerticalStack(views::kRelatedControlSmallVerticalSpacing); |
+ |
+ if (version_title_) { |
+ DCHECK(version_value_); |
+ views::View* horizontal_stack = CreateHorizontalStack(3); |
+ horizontal_stack->AddChildView(version_title_); |
+ horizontal_stack->AddChildView(version_value_); |
+ details_stack->AddChildView(horizontal_stack); |
+ } |
Matt Giuca
2014/07/14 01:57:23
Suggestion:
} else {
DCHECK(!version_value_);
}
sashab
2014/07/14 23:19:20
Done.
|
+ |
+ views::View* vertical_stack = CreateVerticalStack(); |
+ vertical_stack->AddChildView(details_heading_); |
+ vertical_stack->AddChildView(details_stack); |
+ AddChildView(vertical_stack); |
+ } |
+} |
+ |
void AppInfoSummaryPanel::OnPerformAction(views::Combobox* combobox) { |
if (combobox == launch_options_combobox_) { |
SetLaunchType(launch_options_combobox_model_->GetLaunchTypeAtIndex( |
@@ -199,6 +235,12 @@ void AppInfoSummaryPanel::OnPerformAction(views::Combobox* combobox) { |
} |
} |
+bool AppInfoSummaryPanel::HasVersion() const { |
+ // The version number doesn't make sense for bookmark or component apps. |
+ return !app_->from_bookmark() && |
+ app_->location() != extensions::Manifest::COMPONENT; |
+} |
+ |
extensions::LaunchType AppInfoSummaryPanel::GetLaunchType() const { |
return extensions::GetLaunchType(extensions::ExtensionPrefs::Get(profile_), |
app_); |