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

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

Issue 2758323002: Broke out layout metric information from ViewsDelegate to LayoutProvider (Closed)
Patch Set: Final feedback addressed Created 3 years, 8 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/browser/ui/views/harmony/chrome_layout_provider.h"
12 #include "chrome/grit/generated_resources.h" 12 #include "chrome/grit/generated_resources.h"
13 #include "components/constrained_window/constrained_window_views.h" 13 #include "components/constrained_window/constrained_window_views.h"
14 #include "components/strings/grit/components_strings.h" 14 #include "components/strings/grit/components_strings.h"
15 #include "content/public/browser/web_contents.h" 15 #include "content/public/browser/web_contents.h"
16 #include "extensions/common/constants.h" 16 #include "extensions/common/constants.h"
17 #include "ui/accessibility/ax_node_data.h" 17 #include "ui/accessibility/ax_node_data.h"
18 #include "ui/base/l10n/l10n_util.h" 18 #include "ui/base/l10n/l10n_util.h"
19 #include "ui/base/resource/resource_bundle.h" 19 #include "ui/base/resource/resource_bundle.h"
20 #include "ui/gfx/image/image_skia.h" 20 #include "ui/gfx/image/image_skia.h"
21 #include "ui/gfx/image/image_skia_source.h" 21 #include "ui/gfx/image/image_skia_source.h"
(...skipping 45 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 LayoutDelegate* layout_delegate = LayoutDelegate::Get(); 77 ChromeLayoutProvider* provider = ChromeLayoutProvider::Get();
78 // Align the contents with the dialog buttons. 78 // Align the contents with the dialog buttons.
79 views::BoxLayout* layout = new views::BoxLayout( 79 views::BoxLayout* layout = new views::BoxLayout(
80 views::BoxLayout::kHorizontal, 80 views::BoxLayout::kHorizontal,
81 layout_delegate->GetMetric(LayoutDelegate::Metric::DIALOG_BUTTON_MARGIN), 81 provider->GetDistanceMetric(DISTANCE_DIALOG_BUTTON_MARGIN),
82 layout_delegate->GetMetric(LayoutDelegate::Metric::PANEL_CONTENT_MARGIN), 82 provider->GetDistanceMetric(DISTANCE_PANEL_CONTENT_MARGIN),
83 layout_delegate->GetMetric( 83 provider->GetDistanceMetric(DISTANCE_UNRELATED_CONTROL_HORIZONTAL_LARGE));
84 LayoutDelegate::Metric::UNRELATED_CONTROL_HORIZONTAL_SPACING_LARGE));
85 layout->set_cross_axis_alignment( 84 layout->set_cross_axis_alignment(
86 views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER); 85 views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER);
87 SetLayoutManager(layout); 86 SetLayoutManager(layout);
88 87
89 views::ImageView* icon_image_view = new views::ImageView(); 88 views::ImageView* icon_image_view = new views::ImageView();
90 gfx::Size image_size(kIconSize, kIconSize); 89 gfx::Size image_size(kIconSize, kIconSize);
91 gfx::ImageSkia image(new WebAppInfoImageSource(kIconSize, web_app_info_), 90 gfx::ImageSkia image(new WebAppInfoImageSource(kIconSize, web_app_info_),
92 image_size); 91 image_size);
93 icon_image_view->SetImageSize(image_size); 92 icon_image_view->SetImageSize(image_size);
94 icon_image_view->SetImage(image); 93 icon_image_view->SetImage(image);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 const base::string16& new_contents) { 167 const base::string16& new_contents) {
169 DCHECK_EQ(title_tf_, sender); 168 DCHECK_EQ(title_tf_, sender);
170 GetDialogClientView()->UpdateDialogButtons(); 169 GetDialogClientView()->UpdateDialogButtons();
171 } 170 }
172 171
173 base::string16 BookmarkAppConfirmationView::GetTrimmedTitle() const { 172 base::string16 BookmarkAppConfirmationView::GetTrimmedTitle() const {
174 base::string16 title(title_tf_->text()); 173 base::string16 title(title_tf_->text());
175 base::TrimWhitespace(title, base::TRIM_ALL, &title); 174 base::TrimWhitespace(title, base::TRIM_ALL, &title);
176 return title; 175 return title;
177 } 176 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/device_chooser_content_view.cc ('k') | chrome/browser/ui/views/extensions/chooser_dialog_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698