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

Unified Diff: chrome/browser/ui/views/apps/app_info_dialog/app_info_summary_panel.cc

Issue 383953002: Moved the version number in App Info Dialog (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor changes Created 6 years, 5 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/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..4cfdc6214a8be454fa3c8b5f4b9bd4555f0ae253 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"
@@ -28,6 +29,12 @@
#include "ui/views/view.h"
#include "ui/views/widget/widget.h"
+namespace {
+
+// The spacing between the key and the value labels in the Details section.
+const int kSpacingBetweenKeyAndStartOfValue = 3;
+}
+
// A model for a combobox selecting the launch options for a hosted app.
// Displays different options depending on the host OS.
class LaunchOptionsComboboxModel : public ui::ComboboxModel {
@@ -127,9 +134,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 +151,7 @@ AppInfoSummaryPanel::AppInfoSummaryPanel(Profile* profile,
views::kUnrelatedControlVerticalSpacing));
LayoutDescriptionControl();
+ LayoutDetailsControl();
if (launch_options_combobox_)
AddChildView(launch_options_combobox_);
@@ -168,6 +180,21 @@ void AppInfoSummaryPanel::CreateDescriptionControl() {
}
}
+void AppInfoSummaryPanel::CreateDetailsControl() {
+ if (HasVersion()) {
+ details_heading_ = CreateHeading(
+ l10n_util::GetStringUTF16(IDS_APPLICATION_INFO_DETAILS_TITLE));
+
+ version_title_ = new views::Label(
+ l10n_util::GetStringUTF16(IDS_APPLICATION_INFO_VERSION_LABEL));
+ version_title_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
+
+ version_value_ =
+ new views::Label(base::ASCIIToUTF16(app_->VersionString()));
+ version_value_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
+ }
+}
+
void AppInfoSummaryPanel::CreateLaunchOptionControl() {
if (CanSetLaunchType()) {
launch_options_combobox_model_.reset(new LaunchOptionsComboboxModel());
@@ -190,6 +217,26 @@ void AppInfoSummaryPanel::LayoutDescriptionControl() {
}
}
+void AppInfoSummaryPanel::LayoutDetailsControl() {
+ if (details_heading_) {
+ views::View* details_stack =
+ CreateVerticalStack(views::kRelatedControlSmallVerticalSpacing);
+
+ if (version_title_ && version_value_) {
+ views::View* horizontal_stack =
+ CreateHorizontalStack(kSpacingBetweenKeyAndStartOfValue);
+ horizontal_stack->AddChildView(version_title_);
+ horizontal_stack->AddChildView(version_value_);
+ details_stack->AddChildView(horizontal_stack);
+ }
+
+ 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 +246,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_);

Powered by Google App Engine
This is Rietveld 408576698