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

Side by Side Diff: chrome/browser/ui/views/arc_app_dialog_view.cc

Issue 2889623002: Apply View::set_preferred_size in some more places. (Closed)
Patch Set: fix SystemMenuButton Created 3 years, 7 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 unified diff | Download patch
OLDNEW
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"
(...skipping 21 matching lines...) Expand all
32 namespace { 32 namespace {
33 33
34 const int kRightColumnWidth = 210; 34 const int kRightColumnWidth = 210;
35 const int kIconSize = 64; 35 const int kIconSize = 64;
36 // Currenty ARC apps only support 48*48 native icon. 36 // Currenty ARC apps only support 48*48 native icon.
37 const int kIconSourceSize = 48; 37 const int kIconSourceSize = 48;
38 38
39 using ArcAppConfirmCallback = 39 using ArcAppConfirmCallback =
40 base::Callback<void(const std::string& app_id, Profile* profile)>; 40 base::Callback<void(const std::string& app_id, Profile* profile)>;
41 41
42 // Helper class to hold a smaller icon in a fixed-size view.
43 class FixedBoundarySizeImageView : public views::ImageView {
44 public:
45 FixedBoundarySizeImageView() {}
46 ~FixedBoundarySizeImageView() override {}
47 // Overriden from View:
48 gfx::Size GetPreferredSize() const override {
49 return gfx::Size(kIconSize, kIconSize);
50 }
51
52 private:
53 DISALLOW_COPY_AND_ASSIGN(FixedBoundarySizeImageView);
54 };
55
56 class ArcAppDialogView : public views::DialogDelegateView, 42 class ArcAppDialogView : public views::DialogDelegateView,
57 public AppIconLoaderDelegate { 43 public AppIconLoaderDelegate {
58 public: 44 public:
59 ArcAppDialogView(Profile* profile, 45 ArcAppDialogView(Profile* profile,
60 AppListControllerDelegate* controller, 46 AppListControllerDelegate* controller,
61 const std::string& app_id, 47 const std::string& app_id,
62 const base::string16& window_title, 48 const base::string16& window_title,
63 const base::string16& heading_text, 49 const base::string16& heading_text,
64 const base::string16& subheading_text, 50 const base::string16& subheading_text,
65 const base::string16& confirm_button_text, 51 const base::string16& confirm_button_text,
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 ChromeLayoutProvider* provider = ChromeLayoutProvider::Get(); 126 ChromeLayoutProvider* provider = ChromeLayoutProvider::Get();
141 127
142 SetLayoutManager(new views::BoxLayout( 128 SetLayoutManager(new views::BoxLayout(
143 views::BoxLayout::kHorizontal, 129 views::BoxLayout::kHorizontal,
144 provider->GetDistanceMetric(DISTANCE_DIALOG_BUTTON_MARGIN), 130 provider->GetDistanceMetric(DISTANCE_DIALOG_BUTTON_MARGIN),
145 provider->GetDistanceMetric( 131 provider->GetDistanceMetric(
146 DISTANCE_PANEL_CONTENT_MARGIN), 132 DISTANCE_PANEL_CONTENT_MARGIN),
147 provider->GetDistanceMetric( 133 provider->GetDistanceMetric(
148 views::DISTANCE_RELATED_CONTROL_HORIZONTAL))); 134 views::DISTANCE_RELATED_CONTROL_HORIZONTAL)));
149 135
150 icon_view_ = new FixedBoundarySizeImageView(); 136 icon_view_ = new views::ImageView();
137 icon_view_->set_preferred_size(gfx::Size(kIconSize, kIconSize));
151 AddChildView(icon_view_); 138 AddChildView(icon_view_);
152 139
153 views::View* text_container = new views::View(); 140 views::View* text_container = new views::View();
154 views::BoxLayout* text_container_layout = 141 views::BoxLayout* text_container_layout =
155 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0); 142 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0);
156 text_container_layout->set_main_axis_alignment( 143 text_container_layout->set_main_axis_alignment(
157 views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER); 144 views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER);
158 text_container_layout->set_cross_axis_alignment( 145 text_container_layout->set_cross_axis_alignment(
159 views::BoxLayout::CROSS_AXIS_ALIGNMENT_START); 146 views::BoxLayout::CROSS_AXIS_ALIGNMENT_START);
160 text_container->SetLayoutManager(text_container_layout); 147 text_container->SetLayoutManager(text_container_layout);
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 281
295 bool CloseAppDialogViewAndConfirmForTest(bool confirm) { 282 bool CloseAppDialogViewAndConfirmForTest(bool confirm) {
296 if (!g_current_arc_app_dialog_view) 283 if (!g_current_arc_app_dialog_view)
297 return false; 284 return false;
298 285
299 g_current_arc_app_dialog_view->ConfirmOrCancelForTest(confirm); 286 g_current_arc_app_dialog_view->ConfirmOrCancelForTest(confirm);
300 return true; 287 return true;
301 } 288 }
302 289
303 } // namespace arc 290 } // namespace arc
OLDNEW
« no previous file with comments | « ash/system/tray/tray_constants.cc ('k') | chrome/browser/ui/views/frame/browser_view_layout_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698