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 "chrome/browser/ui/browser_navigator.h" |
7 #include "ui/base/resource/resource_bundle.h" | 8 #include "ui/base/resource/resource_bundle.h" |
8 #include "ui/views/controls/label.h" | 9 #include "ui/views/controls/label.h" |
9 #include "ui/views/layout/box_layout.h" | 10 #include "ui/views/layout/box_layout.h" |
10 #include "ui/views/layout/layout_constants.h" | 11 #include "ui/views/layout/layout_constants.h" |
11 #include "ui/views/widget/widget.h" | 12 #include "ui/views/widget/widget.h" |
| 13 #include "url/gurl.h" |
12 | 14 |
13 namespace { | 15 namespace { |
14 | 16 |
15 // The spacing between the key and the value labels in the Details section. | 17 // The spacing between the key and the value labels in the Details section. |
16 const int kSpacingBetweenKeyAndStartOfValue = 3; | 18 const int kSpacingBetweenKeyAndStartOfValue = 3; |
17 } | 19 } |
18 | 20 |
19 AppInfoPanel::AppInfoPanel(Profile* profile, const extensions::Extension* app) | 21 AppInfoPanel::AppInfoPanel(Profile* profile, const extensions::Extension* app) |
20 : profile_(profile), app_(app) { | 22 : profile_(profile), app_(app) { |
21 } | 23 } |
22 | 24 |
23 AppInfoPanel::~AppInfoPanel() { | 25 AppInfoPanel::~AppInfoPanel() { |
24 } | 26 } |
25 | 27 |
26 void AppInfoPanel::Close() { | 28 void AppInfoPanel::Close() { |
27 GetWidget()->Close(); | 29 GetWidget()->Close(); |
28 } | 30 } |
29 | 31 |
| 32 void AppInfoPanel::OpenLink(const GURL& url) { |
| 33 DCHECK(!url.is_empty()); |
| 34 chrome::NavigateParams params(profile_, url, ui::PAGE_TRANSITION_LINK); |
| 35 chrome::Navigate(¶ms); |
| 36 } |
| 37 |
30 views::Label* AppInfoPanel::CreateHeading(const base::string16& text) const { | 38 views::Label* AppInfoPanel::CreateHeading(const base::string16& text) const { |
31 views::Label* label = new views::Label(text); | 39 views::Label* label = new views::Label(text); |
32 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 40 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
33 label->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( | 41 label->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( |
34 ui::ResourceBundle::MediumFont)); | 42 ui::ResourceBundle::MediumFont)); |
35 return label; | 43 return label; |
36 } | 44 } |
37 | 45 |
38 views::View* AppInfoPanel::CreateVerticalStack(int child_spacing) const { | 46 views::View* AppInfoPanel::CreateVerticalStack(int child_spacing) const { |
39 views::View* vertically_stacked_view = new views::View(); | 47 views::View* vertically_stacked_view = new views::View(); |
(...skipping 14 matching lines...) Expand all Loading... |
54 } | 62 } |
55 | 63 |
56 views::View* AppInfoPanel::CreateKeyValueField(views::View* key, | 64 views::View* AppInfoPanel::CreateKeyValueField(views::View* key, |
57 views::View* value) const { | 65 views::View* value) const { |
58 views::View* horizontal_stack = | 66 views::View* horizontal_stack = |
59 CreateHorizontalStack(kSpacingBetweenKeyAndStartOfValue); | 67 CreateHorizontalStack(kSpacingBetweenKeyAndStartOfValue); |
60 horizontal_stack->AddChildView(key); | 68 horizontal_stack->AddChildView(key); |
61 horizontal_stack->AddChildView(value); | 69 horizontal_stack->AddChildView(value); |
62 return horizontal_stack; | 70 return horizontal_stack; |
63 } | 71 } |
OLD | NEW |