| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "chrome/browser/ui/views/apps/app_info_dialog/app_info_panel.h" | 5 #include "chrome/browser/ui/views/apps/app_info_dialog/app_info_panel.h" |
| 6 | 6 |
| 7 #include "ui/base/resource/resource_bundle.h" | 7 #include "ui/base/resource/resource_bundle.h" |
| 8 #include "ui/views/controls/label.h" | 8 #include "ui/views/controls/label.h" |
| 9 #include "ui/views/layout/box_layout.h" | 9 #include "ui/views/layout/box_layout.h" |
| 10 #include "ui/views/layout/layout_constants.h" | 10 #include "ui/views/layout/layout_constants.h" |
| 11 #include "ui/views/widget/widget.h" |
| 11 | 12 |
| 12 namespace { | 13 namespace { |
| 13 | 14 |
| 14 // The spacing between the key and the value labels in the Details section. | 15 // The spacing between the key and the value labels in the Details section. |
| 15 const int kSpacingBetweenKeyAndStartOfValue = 3; | 16 const int kSpacingBetweenKeyAndStartOfValue = 3; |
| 16 } | 17 } |
| 17 | 18 |
| 18 AppInfoPanel::AppInfoPanel(Profile* profile, const extensions::Extension* app) | 19 AppInfoPanel::AppInfoPanel(Profile* profile, const extensions::Extension* app) |
| 19 : profile_(profile), app_(app) { | 20 : profile_(profile), app_(app) { |
| 20 } | 21 } |
| 21 | 22 |
| 22 AppInfoPanel::~AppInfoPanel() { | 23 AppInfoPanel::~AppInfoPanel() { |
| 23 } | 24 } |
| 24 | 25 |
| 26 void AppInfoPanel::Close() { |
| 27 GetWidget()->Close(); |
| 28 } |
| 29 |
| 25 views::Label* AppInfoPanel::CreateHeading(const base::string16& text) const { | 30 views::Label* AppInfoPanel::CreateHeading(const base::string16& text) const { |
| 26 views::Label* label = new views::Label(text); | 31 views::Label* label = new views::Label(text); |
| 27 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 32 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 28 label->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( | 33 label->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( |
| 29 ui::ResourceBundle::MediumFont)); | 34 ui::ResourceBundle::MediumFont)); |
| 30 return label; | 35 return label; |
| 31 } | 36 } |
| 32 | 37 |
| 33 views::View* AppInfoPanel::CreateVerticalStack(int child_spacing) const { | 38 views::View* AppInfoPanel::CreateVerticalStack(int child_spacing) const { |
| 34 views::View* vertically_stacked_view = new views::View(); | 39 views::View* vertically_stacked_view = new views::View(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 53 } | 58 } |
| 54 | 59 |
| 55 views::View* AppInfoPanel::CreateKeyValueField(views::View* key, | 60 views::View* AppInfoPanel::CreateKeyValueField(views::View* key, |
| 56 views::View* value) const { | 61 views::View* value) const { |
| 57 views::View* horizontal_stack = | 62 views::View* horizontal_stack = |
| 58 CreateHorizontalStack(kSpacingBetweenKeyAndStartOfValue); | 63 CreateHorizontalStack(kSpacingBetweenKeyAndStartOfValue); |
| 59 horizontal_stack->AddChildView(key); | 64 horizontal_stack->AddChildView(key); |
| 60 horizontal_stack->AddChildView(value); | 65 horizontal_stack->AddChildView(value); |
| 61 return horizontal_stack; | 66 return horizontal_stack; |
| 62 } | 67 } |
| OLD | NEW |