Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/app_list/arc/arc_app_dialog.h" | 5 #include "chrome/browser/ui/app_list/arc/arc_app_dialog.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/extensions/extension_util.h" | 10 #include "chrome/browser/extensions/extension_util.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" | 12 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" |
| 13 #include "chrome/browser/ui/app_list/arc/arc_app_icon_loader.h" | 13 #include "chrome/browser/ui/app_list/arc/arc_app_icon_loader.h" |
| 14 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 14 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
| 15 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" | 15 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" |
| 16 #include "chrome/browser/ui/native_window_tracker.h" | 16 #include "chrome/browser/ui/native_window_tracker.h" |
| 17 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" | 17 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" |
| 18 #include "chrome/grit/generated_resources.h" | 18 #include "chrome/grit/generated_resources.h" |
| 19 #include "components/constrained_window/constrained_window_views.h" | 19 #include "components/constrained_window/constrained_window_views.h" |
| 20 #include "components/strings/grit/components_strings.h" | 20 #include "components/strings/grit/components_strings.h" |
| 21 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
| 22 #include "ui/base/ui_base_types.h" | 22 #include "ui/base/ui_base_types.h" |
| 23 #include "ui/views/controls/image_view.h" | 23 #include "ui/views/controls/image_view.h" |
| 24 #include "ui/views/controls/label.h" | 24 #include "ui/views/controls/label.h" |
| 25 #include "ui/views/layout/box_layout.h" | 25 #include "ui/views/layout/box_layout.h" |
| 26 #include "ui/views/layout/layout_constants.h" | |
| 27 #include "ui/views/view.h" | 26 #include "ui/views/view.h" |
| 28 #include "ui/views/widget/widget.h" | 27 #include "ui/views/widget/widget.h" |
| 29 #include "ui/views/window/dialog_delegate.h" | 28 #include "ui/views/window/dialog_delegate.h" |
| 30 | 29 |
| 31 namespace arc { | 30 namespace arc { |
| 32 | 31 |
| 33 namespace { | 32 namespace { |
| 34 | 33 |
| 35 const int kRightColumnWidth = 210; | 34 const int kRightColumnWidth = 210; |
| 36 const int kIconSize = 64; | 35 const int kIconSize = 64; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 131 app_id_(app_id), | 130 app_id_(app_id), |
| 132 window_title_(window_title), | 131 window_title_(window_title), |
| 133 confirm_button_text_(confirm_button_text), | 132 confirm_button_text_(confirm_button_text), |
| 134 cancel_button_text_(cancel_button_text), | 133 cancel_button_text_(cancel_button_text), |
| 135 confirm_callback_(confirm_callback) { | 134 confirm_callback_(confirm_callback) { |
| 136 DCHECK(controller); | 135 DCHECK(controller); |
| 137 parent_ = controller_->GetAppListWindow(); | 136 parent_ = controller_->GetAppListWindow(); |
| 138 if (parent_) | 137 if (parent_) |
| 139 parent_window_tracker_ = NativeWindowTracker::Create(parent_); | 138 parent_window_tracker_ = NativeWindowTracker::Create(parent_); |
| 140 | 139 |
| 140 ChromeLayoutProvider* provider = ChromeLayoutProvider::Get(); | |
| 141 | |
| 141 SetLayoutManager(new views::BoxLayout( | 142 SetLayoutManager(new views::BoxLayout( |
| 142 views::BoxLayout::kHorizontal, views::kButtonHEdgeMarginNew, | 143 views::BoxLayout::kHorizontal, |
| 143 ChromeLayoutProvider::Get()->GetDistanceMetric( | 144 provider->GetDistanceMetric(DISTANCE_DIALOG_BUTTON_MARGIN), |
| 145 provider->GetDistanceMetric( | |
| 144 DISTANCE_PANEL_CONTENT_MARGIN), | 146 DISTANCE_PANEL_CONTENT_MARGIN), |
|
ananta
2017/05/09 02:35:42
Wondering if we should simplify this to a CreatePa
Peter Kasting
2017/05/10 22:47:42
Right now CreatePanel() is only defined on GridLay
| |
| 145 views::kRelatedControlHorizontalSpacing)); | 147 provider->GetDistanceMetric( |
| 148 views::DISTANCE_RELATED_CONTROL_HORIZONTAL))); | |
| 146 | 149 |
| 147 icon_view_ = new FixedBoundarySizeImageView(); | 150 icon_view_ = new FixedBoundarySizeImageView(); |
| 148 AddChildView(icon_view_); | 151 AddChildView(icon_view_); |
| 149 | 152 |
| 150 views::View* text_container = new views::View(); | 153 views::View* text_container = new views::View(); |
| 151 views::BoxLayout* text_container_layout = | 154 views::BoxLayout* text_container_layout = |
| 152 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0); | 155 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0); |
| 153 text_container_layout->set_main_axis_alignment( | 156 text_container_layout->set_main_axis_alignment( |
| 154 views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER); | 157 views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER); |
| 155 text_container_layout->set_cross_axis_alignment( | 158 text_container_layout->set_cross_axis_alignment( |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 291 | 294 |
| 292 bool CloseAppDialogViewAndConfirmForTest(bool confirm) { | 295 bool CloseAppDialogViewAndConfirmForTest(bool confirm) { |
| 293 if (!g_current_arc_app_dialog_view) | 296 if (!g_current_arc_app_dialog_view) |
| 294 return false; | 297 return false; |
| 295 | 298 |
| 296 g_current_arc_app_dialog_view->ConfirmOrCancelForTest(confirm); | 299 g_current_arc_app_dialog_view->ConfirmOrCancelForTest(confirm); |
| 297 return true; | 300 return true; |
| 298 } | 301 } |
| 299 | 302 |
| 300 } // namespace arc | 303 } // namespace arc |
| OLD | NEW |