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_dialog_views.h" | 5 #include "chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_views.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 17 matching lines...) Expand all Loading... | |
28 #include "ui/gfx/geometry/size.h" | 28 #include "ui/gfx/geometry/size.h" |
29 #include "ui/views/border.h" | 29 #include "ui/views/border.h" |
30 #include "ui/views/controls/scroll_view.h" | 30 #include "ui/views/controls/scroll_view.h" |
31 #include "ui/views/layout/box_layout.h" | 31 #include "ui/views/layout/box_layout.h" |
32 #include "ui/views/layout/layout_constants.h" | 32 #include "ui/views/layout/layout_constants.h" |
33 #include "ui/views/widget/widget.h" | 33 #include "ui/views/widget/widget.h" |
34 #include "ui/views/window/dialog_delegate.h" | 34 #include "ui/views/window/dialog_delegate.h" |
35 | 35 |
36 #if defined(OS_CHROMEOS) | 36 #if defined(OS_CHROMEOS) |
37 #include "chrome/browser/chromeos/arc/arc_session_manager.h" | 37 #include "chrome/browser/chromeos/arc/arc_session_manager.h" |
38 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | |
39 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" | |
38 #include "chrome/browser/ui/views/apps/app_info_dialog/arc_app_info_links_panel. h" | 40 #include "chrome/browser/ui/views/apps/app_info_dialog/arc_app_info_links_panel. h" |
39 #endif | 41 #endif |
40 | 42 |
41 namespace { | 43 namespace { |
42 | 44 |
43 // The color of the separator used inside the dialog - should match the app | 45 // The color of the separator used inside the dialog - should match the app |
44 // list's app_list::kDialogSeparatorColor | 46 // list's app_list::kDialogSeparatorColor |
45 const SkColor kDialogSeparatorColor = SkColorSetRGB(0xD1, 0xD1, 0xD1); | 47 const SkColor kDialogSeparatorColor = SkColorSetRGB(0xD1, 0xD1, 0xD1); |
46 | 48 |
47 #if defined(OS_MACOSX) | 49 #if defined(OS_MACOSX) |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
103 } else { | 105 } else { |
104 dialog_widget = | 106 dialog_widget = |
105 constrained_window::CreateBrowserModalDialogViews(dialog, window); | 107 constrained_window::CreateBrowserModalDialogViews(dialog, window); |
106 dialog_widget->Show(); | 108 dialog_widget->Show(); |
107 } | 109 } |
108 } | 110 } |
109 | 111 |
110 AppInfoDialog::AppInfoDialog(gfx::NativeWindow parent_window, | 112 AppInfoDialog::AppInfoDialog(gfx::NativeWindow parent_window, |
111 Profile* profile, | 113 Profile* profile, |
112 const extensions::Extension* app) | 114 const extensions::Extension* app) |
113 : dialog_header_(NULL), | 115 : profile_(profile), app_id_(app->id()) { |
114 dialog_body_(NULL), | |
115 dialog_footer_(NULL), | |
116 profile_(profile), | |
117 app_id_(app->id()), | |
118 extension_registry_(NULL) { | |
119 views::BoxLayout* layout = | 116 views::BoxLayout* layout = |
120 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0); | 117 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0); |
121 SetLayoutManager(layout); | 118 SetLayoutManager(layout); |
122 | 119 |
123 const int kHorizontalSeparatorHeight = 1; | 120 const int kHorizontalSeparatorHeight = 1; |
124 dialog_header_ = new AppInfoHeaderPanel(profile, app); | 121 dialog_header_ = new AppInfoHeaderPanel(profile, app); |
125 dialog_header_->SetBorder(views::CreateSolidSidedBorder( | 122 dialog_header_->SetBorder(views::CreateSolidSidedBorder( |
126 0, 0, kHorizontalSeparatorHeight, 0, kDialogSeparatorColor)); | 123 0, 0, kHorizontalSeparatorHeight, 0, kDialogSeparatorColor)); |
127 | 124 |
128 dialog_footer_ = new AppInfoFooterPanel(parent_window, profile, app); | 125 dialog_footer_ = new AppInfoFooterPanel(parent_window, profile, app); |
(...skipping 10 matching lines...) Expand all Loading... | |
139 views::View* dialog_body_contents = new views::View(); | 136 views::View* dialog_body_contents = new views::View(); |
140 dialog_body_contents->SetLayoutManager( | 137 dialog_body_contents->SetLayoutManager( |
141 new views::BoxLayout(views::BoxLayout::kVertical, | 138 new views::BoxLayout(views::BoxLayout::kVertical, |
142 views::kButtonHEdgeMarginNew, | 139 views::kButtonHEdgeMarginNew, |
143 views::kPanelVertMargin, | 140 views::kPanelVertMargin, |
144 views::kUnrelatedControlVerticalSpacing)); | 141 views::kUnrelatedControlVerticalSpacing)); |
145 dialog_body_contents->AddChildView(new AppInfoSummaryPanel(profile, app)); | 142 dialog_body_contents->AddChildView(new AppInfoSummaryPanel(profile, app)); |
146 dialog_body_contents->AddChildView(new AppInfoPermissionsPanel(profile, app)); | 143 dialog_body_contents->AddChildView(new AppInfoPermissionsPanel(profile, app)); |
147 | 144 |
148 #if defined(OS_CHROMEOS) | 145 #if defined(OS_CHROMEOS) |
149 // When ARC is enabled, show the "Manage supported links" link for Chrome. | 146 // When ARC is enabled and Settings app is available, show the |
msw
2017/02/15 21:48:28
nit: 'the Settings app'
khmel
2017/02/16 15:47:51
Done.
| |
150 if (arc::ArcSessionManager::Get()->IsArcEnabled() && | 147 // "Manage supported links" link for Chrome. |
khmel
2017/02/15 16:38:45
Problem was we asked for IsArcEnabled but that was
msw
2017/02/15 21:48:28
Wouldn't the IsArcEnabled check here be incorrectl
khmel
2017/02/16 15:47:51
We don't allow ARC for secondary profile, so we ha
msw
2017/02/16 18:55:14
Mightn't we someday allow Arc on either profile? I
khmel
2017/02/16 20:33:29
Actually there is currently a project (probably af
| |
151 app->id() == extension_misc::kChromeAppId) | 148 if (app->id() == extension_misc::kChromeAppId && |
152 dialog_body_contents->AddChildView(new ArcAppInfoLinksPanel(profile, app)); | 149 arc::ArcSessionManager::Get()->IsArcEnabled()) { |
150 const ArcAppListPrefs* arc_app_list_prefs = ArcAppListPrefs::Get(profile); | |
151 if (arc_app_list_prefs && | |
152 arc_app_list_prefs->IsRegistered(arc::kSettingsAppId)) { | |
153 arc_app_info_links_ = new ArcAppInfoLinksPanel(profile, app); | |
msw
2017/02/15 21:48:28
optional nit: consider (1) removing this member an
khmel
2017/02/16 15:47:51
All ideas look reasonable and I don't have any pre
| |
154 dialog_body_contents->AddChildView(arc_app_info_links_); | |
155 } | |
156 } | |
153 #endif | 157 #endif |
154 | 158 |
155 // Clip the scrollable view so that the scrollbar appears. As long as this | 159 // Clip the scrollable view so that the scrollbar appears. As long as this |
156 // is larger than the height of the dialog, it will be resized to the dialog's | 160 // is larger than the height of the dialog, it will be resized to the dialog's |
157 // actual height. | 161 // actual height. |
158 // TODO(sashab): Add ClipHeight() as a parameter-less method to | 162 // TODO(sashab): Add ClipHeight() as a parameter-less method to |
159 // views::ScrollView() to mimic this behaviour. | 163 // views::ScrollView() to mimic this behaviour. |
160 const int kMaxDialogHeight = 1000; | 164 const int kMaxDialogHeight = 1000; |
161 dialog_body_ = new views::ScrollView(); | 165 dialog_body_ = new views::ScrollView(); |
162 dialog_body_->ClipHeightTo(kMaxDialogHeight, kMaxDialogHeight); | 166 dialog_body_->ClipHeightTo(kMaxDialogHeight, kMaxDialogHeight); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
203 return; | 207 return; |
204 | 208 |
205 Close(); | 209 Close(); |
206 } | 210 } |
207 | 211 |
208 void AppInfoDialog::OnShutdown(extensions::ExtensionRegistry* registry) { | 212 void AppInfoDialog::OnShutdown(extensions::ExtensionRegistry* registry) { |
209 DCHECK_EQ(extension_registry_, registry); | 213 DCHECK_EQ(extension_registry_, registry); |
210 StopObservingExtensionRegistry(); | 214 StopObservingExtensionRegistry(); |
211 Close(); | 215 Close(); |
212 } | 216 } |
OLD | NEW |