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

Side by Side Diff: chrome/browser/ui/views/extensions/bookmark_app_confirmation_view.cc

Issue 2753243002: Views/Harmony: Replace layout constants in chrome/browser/ui/views/extensions. (Closed)
Patch Set: Clean up includes. Created 3 years, 9 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 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/extensions/bookmark_app_confirmation_view.h" 5 #include "chrome/browser/ui/views/extensions/bookmark_app_confirmation_view.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/strings/string16.h" 8 #include "base/strings/string16.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
11 #include "chrome/browser/ui/views/harmony/layout_delegate.h"
11 #include "chrome/grit/generated_resources.h" 12 #include "chrome/grit/generated_resources.h"
12 #include "components/constrained_window/constrained_window_views.h" 13 #include "components/constrained_window/constrained_window_views.h"
13 #include "components/strings/grit/components_strings.h" 14 #include "components/strings/grit/components_strings.h"
14 #include "content/public/browser/web_contents.h" 15 #include "content/public/browser/web_contents.h"
15 #include "extensions/common/constants.h" 16 #include "extensions/common/constants.h"
16 #include "ui/accessibility/ax_node_data.h" 17 #include "ui/accessibility/ax_node_data.h"
17 #include "ui/base/l10n/l10n_util.h" 18 #include "ui/base/l10n/l10n_util.h"
18 #include "ui/base/resource/resource_bundle.h" 19 #include "ui/base/resource/resource_bundle.h"
19 #include "ui/gfx/image/image_skia.h" 20 #include "ui/gfx/image/image_skia.h"
20 #include "ui/gfx/image/image_skia_source.h" 21 #include "ui/gfx/image/image_skia_source.h"
21 #include "ui/views/controls/button/checkbox.h" 22 #include "ui/views/controls/button/checkbox.h"
22 #include "ui/views/controls/image_view.h" 23 #include "ui/views/controls/image_view.h"
23 #include "ui/views/controls/textfield/textfield.h" 24 #include "ui/views/controls/textfield/textfield.h"
24 #include "ui/views/layout/box_layout.h" 25 #include "ui/views/layout/box_layout.h"
25 #include "ui/views/layout/layout_constants.h"
26 #include "ui/views/widget/widget.h" 26 #include "ui/views/widget/widget.h"
27 #include "ui/views/window/dialog_client_view.h" 27 #include "ui/views/window/dialog_client_view.h"
28 28
29 namespace { 29 namespace {
30 30
31 // Minimum width of the the bubble. 31 // Minimum width of the the bubble.
32 const int kMinBubbleWidth = 300; 32 const int kMinBubbleWidth = 300;
33 // Size of the icon. 33 // Size of the icon.
34 const int kIconSize = extension_misc::EXTENSION_ICON_MEDIUM; 34 const int kIconSize = extension_misc::EXTENSION_ICON_MEDIUM;
35 35
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 ->Show(); 67 ->Show();
68 } 68 }
69 69
70 BookmarkAppConfirmationView::BookmarkAppConfirmationView( 70 BookmarkAppConfirmationView::BookmarkAppConfirmationView(
71 const WebApplicationInfo& web_app_info, 71 const WebApplicationInfo& web_app_info,
72 const BrowserWindow::ShowBookmarkAppBubbleCallback& callback) 72 const BrowserWindow::ShowBookmarkAppBubbleCallback& callback)
73 : web_app_info_(web_app_info), 73 : web_app_info_(web_app_info),
74 callback_(callback), 74 callback_(callback),
75 open_as_window_checkbox_(nullptr), 75 open_as_window_checkbox_(nullptr),
76 title_tf_(nullptr) { 76 title_tf_(nullptr) {
77 views::BoxLayout* layout = new views::BoxLayout( 77 const int button_margin = LayoutDelegate::Get()->GetMetric(
78 views::BoxLayout::kHorizontal, views::kButtonHEdgeMarginNew, 78 LayoutDelegate::Metric::DIALOG_BUTTON_MARGIN);
79 views::kButtonHEdgeMarginNew, views::kButtonHEdgeMarginNew); 79 views::BoxLayout* layout =
80 new views::BoxLayout(views::BoxLayout::kHorizontal, button_margin,
81 button_margin, button_margin);
tapted 2017/03/20 03:41:52 The children here are not buttons :/, but I suppos
Patti Lor 2017/03/21 06:24:29 Done.
80 layout->set_cross_axis_alignment( 82 layout->set_cross_axis_alignment(
81 views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER); 83 views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER);
82 SetLayoutManager(layout); 84 SetLayoutManager(layout);
83 85
84 views::ImageView* icon_image_view = new views::ImageView(); 86 views::ImageView* icon_image_view = new views::ImageView();
85 gfx::Size image_size(kIconSize, kIconSize); 87 gfx::Size image_size(kIconSize, kIconSize);
86 gfx::ImageSkia image(new WebAppInfoImageSource(kIconSize, web_app_info_), 88 gfx::ImageSkia image(new WebAppInfoImageSource(kIconSize, web_app_info_),
87 image_size); 89 image_size);
88 icon_image_view->SetImageSize(image_size); 90 icon_image_view->SetImageSize(image_size);
89 icon_image_view->SetImage(image); 91 icon_image_view->SetImage(image);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 const base::string16& new_contents) { 165 const base::string16& new_contents) {
164 DCHECK_EQ(title_tf_, sender); 166 DCHECK_EQ(title_tf_, sender);
165 GetDialogClientView()->UpdateDialogButtons(); 167 GetDialogClientView()->UpdateDialogButtons();
166 } 168 }
167 169
168 base::string16 BookmarkAppConfirmationView::GetTrimmedTitle() const { 170 base::string16 BookmarkAppConfirmationView::GetTrimmedTitle() const {
169 base::string16 title(title_tf_->text()); 171 base::string16 title(title_tf_->text());
170 base::TrimWhitespace(title, base::TRIM_ALL, &title); 172 base::TrimWhitespace(title, base::TRIM_ALL, &title);
171 return title; 173 return title;
172 } 174 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698