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

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc

Issue 2899523002: Views/Harmony Remove references to ui/views/layout/layout_constants.h (Closed)
Patch Set: Fix compile failures 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/bookmarks/bookmark_bubble_view.h" 5 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/metrics/user_metrics.h" 10 #include "base/metrics/user_metrics.h"
(...skipping 19 matching lines...) Expand all
30 #include "ui/base/l10n/l10n_util.h" 30 #include "ui/base/l10n/l10n_util.h"
31 #include "ui/events/keycodes/keyboard_codes.h" 31 #include "ui/events/keycodes/keyboard_codes.h"
32 #include "ui/views/bubble/bubble_frame_view.h" 32 #include "ui/views/bubble/bubble_frame_view.h"
33 #include "ui/views/controls/button/md_text_button.h" 33 #include "ui/views/controls/button/md_text_button.h"
34 #include "ui/views/controls/combobox/combobox.h" 34 #include "ui/views/controls/combobox/combobox.h"
35 #include "ui/views/controls/label.h" 35 #include "ui/views/controls/label.h"
36 #include "ui/views/controls/link.h" 36 #include "ui/views/controls/link.h"
37 #include "ui/views/controls/textfield/textfield.h" 37 #include "ui/views/controls/textfield/textfield.h"
38 #include "ui/views/layout/fill_layout.h" 38 #include "ui/views/layout/fill_layout.h"
39 #include "ui/views/layout/grid_layout.h" 39 #include "ui/views/layout/grid_layout.h"
40 #include "ui/views/layout/layout_constants.h"
41 #include "ui/views/widget/widget.h" 40 #include "ui/views/widget/widget.h"
42 41
43 #if defined(OS_WIN) 42 #if defined(OS_WIN)
44 #include "chrome/browser/sync/profile_sync_service_factory.h" 43 #include "chrome/browser/sync/profile_sync_service_factory.h"
45 #include "chrome/browser/ui/views/desktop_ios_promotion/desktop_ios_promotion_bu bble_view.h" 44 #include "chrome/browser/ui/views/desktop_ios_promotion/desktop_ios_promotion_bu bble_view.h"
46 #include "components/browser_sync/profile_sync_service.h" 45 #include "components/browser_sync/profile_sync_service.h"
47 #endif 46 #endif
48 47
49 using base::UserMetricsAction; 48 using base::UserMetricsAction;
50 using bookmarks::BookmarkModel; 49 using bookmarks::BookmarkModel;
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 179
181 SetLayoutManager(new views::FillLayout); 180 SetLayoutManager(new views::FillLayout);
182 bookmark_details_view_ = base::MakeUnique<View>(); 181 bookmark_details_view_ = base::MakeUnique<View>();
183 GridLayout* layout = new GridLayout(bookmark_details_view_.get()); 182 GridLayout* layout = new GridLayout(bookmark_details_view_.get());
184 bookmark_details_view_->SetLayoutManager(layout); 183 bookmark_details_view_->SetLayoutManager(layout);
185 184
186 // This column set is used for the labels and textfields as well as the 185 // This column set is used for the labels and textfields as well as the
187 // buttons at the bottom. 186 // buttons at the bottom.
188 const int cs_id = 0; 187 const int cs_id = 0;
189 ColumnSet* cs = layout->AddColumnSet(cs_id); 188 ColumnSet* cs = layout->AddColumnSet(cs_id);
190 cs->AddColumn(ChromeLayoutProvider::Get()->GetControlLabelGridAlignment(), 189 ChromeLayoutProvider* provider = ChromeLayoutProvider::Get();
191 GridLayout::CENTER, 0, GridLayout::USE_PREF, 0, 0); 190
192 cs->AddPaddingColumn(0, views::kUnrelatedControlHorizontalSpacing); 191 cs->AddColumn(provider->GetControlLabelGridAlignment(), GridLayout::CENTER, 0,
192 GridLayout::USE_PREF, 0, 0);
193 cs->AddPaddingColumn(
194 0, provider->GetDistanceMetric(DISTANCE_UNRELATED_CONTROL_HORIZONTAL));
193 195
194 cs->AddColumn(GridLayout::FILL, GridLayout::CENTER, 0, 196 cs->AddColumn(GridLayout::FILL, GridLayout::CENTER, 0,
195 GridLayout::USE_PREF, 0, 0); 197 GridLayout::USE_PREF, 0, 0);
196 cs->AddPaddingColumn(1, views::kUnrelatedControlLargeHorizontalSpacing); 198 cs->AddPaddingColumn(1, provider->GetDistanceMetric(
199 DISTANCE_UNRELATED_CONTROL_HORIZONTAL_LARGE));
197 200
198 cs->AddColumn(GridLayout::LEADING, GridLayout::TRAILING, 0, 201 cs->AddColumn(GridLayout::LEADING, GridLayout::TRAILING, 0,
199 GridLayout::USE_PREF, 0, 0); 202 GridLayout::USE_PREF, 0, 0);
200 cs->AddPaddingColumn(0, views::kRelatedButtonHSpacing); 203 cs->AddPaddingColumn(0, provider->GetDistanceMetric(
204 views::DISTANCE_RELATED_BUTTON_HORIZONTAL));
201 cs->AddColumn(GridLayout::LEADING, GridLayout::TRAILING, 0, 205 cs->AddColumn(GridLayout::LEADING, GridLayout::TRAILING, 0,
202 GridLayout::USE_PREF, 0, 0); 206 GridLayout::USE_PREF, 0, 0);
203 207
204 layout->StartRow(0, cs_id); 208 layout->StartRow(0, cs_id);
205 views::Label* label = new views::Label( 209 views::Label* label = new views::Label(
206 l10n_util::GetStringUTF16(IDS_BOOKMARK_BUBBLE_TITLE_TEXT)); 210 l10n_util::GetStringUTF16(IDS_BOOKMARK_BUBBLE_TITLE_TEXT));
207 layout->AddView(label); 211 layout->AddView(label);
208 title_tf_ = new views::Textfield(); 212 title_tf_ = new views::Textfield();
209 title_tf_->SetText(GetTitle()); 213 title_tf_->SetText(GetTitle());
210 title_tf_->SetAccessibleName( 214 title_tf_->SetAccessibleName(
211 l10n_util::GetStringUTF16(IDS_BOOKMARK_AX_BUBBLE_TITLE_TEXT)); 215 l10n_util::GetStringUTF16(IDS_BOOKMARK_AX_BUBBLE_TITLE_TEXT));
212 216
213 layout->AddView(title_tf_, 5, 1); 217 layout->AddView(title_tf_, 5, 1);
214 218
215 layout->AddPaddingRow(0, views::kUnrelatedControlHorizontalSpacing); 219 layout->AddPaddingRow(
220 0, provider->GetDistanceMetric(DISTANCE_UNRELATED_CONTROL_HORIZONTAL));
Peter Kasting 2017/05/19 23:45:44 This passes a horizontal metric value to a call us
ananta 2017/05/20 00:02:02 Thanks done.
216 221
217 layout->StartRow(0, cs_id); 222 layout->StartRow(0, cs_id);
218 layout->AddView(combobox_label); 223 layout->AddView(combobox_label);
219 layout->AddView(parent_combobox_, 5, 1); 224 layout->AddView(parent_combobox_, 5, 1);
220 225
221 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 226 layout->AddPaddingRow(
227 0, provider->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_VERTICAL));
222 228
223 layout->StartRow(0, cs_id); 229 layout->StartRow(0, cs_id);
224 layout->SkipColumns(2); 230 layout->SkipColumns(2);
225 layout->AddView(remove_button_); 231 layout->AddView(remove_button_);
226 layout->AddView(edit_button_); 232 layout->AddView(edit_button_);
227 layout->AddView(close_button_); 233 layout->AddView(close_button_);
228 234
229 AddAccelerator(ui::Accelerator(ui::VKEY_RETURN, ui::EF_NONE)); 235 AddAccelerator(ui::Accelerator(ui::VKEY_RETURN, ui::EF_NONE));
230 AddAccelerator(ui::Accelerator(ui::VKEY_E, ui::EF_ALT_DOWN)); 236 AddAccelerator(ui::Accelerator(ui::VKEY_E, ui::EF_ALT_DOWN));
231 AddAccelerator(ui::Accelerator(ui::VKEY_R, ui::EF_ALT_DOWN)); 237 AddAccelerator(ui::Accelerator(ui::VKEY_R, ui::EF_ALT_DOWN));
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 is_showing_ios_promotion_ = true; 416 is_showing_ios_promotion_ = true;
411 ios_promo_view_ = new DesktopIOSPromotionBubbleView( 417 ios_promo_view_ = new DesktopIOSPromotionBubbleView(
412 profile_, desktop_ios_promotion::PromotionEntryPoint::BOOKMARKS_BUBBLE); 418 profile_, desktop_ios_promotion::PromotionEntryPoint::BOOKMARKS_BUBBLE);
413 AddChildView(ios_promo_view_); 419 AddChildView(ios_promo_view_);
414 GetWidget()->UpdateWindowIcon(); 420 GetWidget()->UpdateWindowIcon();
415 GetWidget()->UpdateWindowTitle(); 421 GetWidget()->UpdateWindowTitle();
416 // Resize the bubble so it has the same width as the parent bubble. 422 // Resize the bubble so it has the same width as the parent bubble.
417 ios_promo_view_->UpdateBubbleHeight(); 423 ios_promo_view_->UpdateBubbleHeight();
418 } 424 }
419 #endif 425 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698