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

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

Issue 2891013002: Views/Harmony Remove references to ui/views/layout/layout_constants.h (Closed)
Patch Set: 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/settings_reset_prompt_dialog.h" 5 #include "chrome/browser/ui/views/settings_reset_prompt_dialog.h"
6 6
7 #include "chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prom pt_controller.h" 7 #include "chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prom pt_controller.h"
8 #include "chrome/browser/ui/browser.h" 8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/views/frame/browser_view.h" 9 #include "chrome/browser/ui/views/frame/browser_view.h"
10 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h"
10 #include "components/constrained_window/constrained_window_views.h" 11 #include "components/constrained_window/constrained_window_views.h"
11 #include "ui/gfx/font.h" 12 #include "ui/gfx/font.h"
12 #include "ui/views/controls/label.h" 13 #include "ui/views/controls/label.h"
13 #include "ui/views/controls/styled_label.h" 14 #include "ui/views/controls/styled_label.h"
14 #include "ui/views/layout/box_layout.h" 15 #include "ui/views/layout/box_layout.h"
15 #include "ui/views/layout/layout_constants.h"
16 #include "ui/views/view.h" 16 #include "ui/views/view.h"
17 #include "ui/views/widget/widget.h" 17 #include "ui/views/widget/widget.h"
18 18
19 namespace safe_browsing { 19 namespace safe_browsing {
20 20
21 // static 21 // static
22 void SettingsResetPromptController::ShowSettingsResetPrompt( 22 void SettingsResetPromptController::ShowSettingsResetPrompt(
23 Browser* browser, 23 Browser* browser,
24 SettingsResetPromptController* controller) { 24 SettingsResetPromptController* controller) {
25 SettingsResetPromptDialog* dialog = new SettingsResetPromptDialog(controller); 25 SettingsResetPromptDialog* dialog = new SettingsResetPromptDialog(controller);
26 // The dialog will delete itself, as implemented in 26 // The dialog will delete itself, as implemented in
27 // |DialogDelegateView::DeleteDelegate()|, when its widget is closed. 27 // |DialogDelegateView::DeleteDelegate()|, when its widget is closed.
28 dialog->Show(browser); 28 dialog->Show(browser);
29 } 29 }
30 30
31 } // namespace safe_browsing 31 } // namespace safe_browsing
32 32
33 namespace { 33 namespace {
34 constexpr int kDialogWidth = 448; 34 constexpr int kDialogWidth = 448;
35 } // namespace 35 } // namespace
36 36
37 SettingsResetPromptDialog::SettingsResetPromptDialog( 37 SettingsResetPromptDialog::SettingsResetPromptDialog(
38 safe_browsing::SettingsResetPromptController* controller) 38 safe_browsing::SettingsResetPromptController* controller)
39 : browser_(nullptr), controller_(controller) { 39 : browser_(nullptr), controller_(controller) {
40 DCHECK(controller_); 40 DCHECK(controller_);
41 41
42 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 42 SetLayoutManager(
43 views::kButtonHEdgeMarginNew, 43 new views::BoxLayout(views::BoxLayout::kVertical,
44 views::kPanelVertMargin, 0)); 44 provider->GetDistanceMetric(
45 DISTANCE_DIALOG_BUTTON_MARGIN),
ananta 2017/05/18 03:16:29 Wasn't sure about a simpler FillLayout here.
Peter Kasting 2017/05/18 06:10:26 Yeah, you could probably switch to a FillLayout if
46 provider->GetDistanceMetric(
47 DISTANCE_PANEL_CONTENT_MARGIN),
48 0));
45 49
46 views::StyledLabel* dialog_label = 50 views::StyledLabel* dialog_label =
47 new views::StyledLabel(controller_->GetMainText(), /*listener=*/nullptr); 51 new views::StyledLabel(controller_->GetMainText(), /*listener=*/nullptr);
48 views::StyledLabel::RangeStyleInfo url_style; 52 views::StyledLabel::RangeStyleInfo url_style;
49 url_style.weight = gfx::Font::Weight::BOLD; 53 url_style.weight = gfx::Font::Weight::BOLD;
50 dialog_label->AddStyleRange(controller_->GetMainTextUrlRange(), url_style); 54 dialog_label->AddStyleRange(controller_->GetMainTextUrlRange(), url_style);
51 AddChildView(dialog_label); 55 AddChildView(dialog_label);
52 } 56 }
53 57
54 SettingsResetPromptDialog::~SettingsResetPromptDialog() { 58 SettingsResetPromptDialog::~SettingsResetPromptDialog() {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 controller_ = nullptr; 129 controller_ = nullptr;
126 } 130 }
127 return true; 131 return true;
128 } 132 }
129 133
130 // View overrides. 134 // View overrides.
131 135
132 gfx::Size SettingsResetPromptDialog::GetPreferredSize() const { 136 gfx::Size SettingsResetPromptDialog::GetPreferredSize() const {
133 return gfx::Size(kDialogWidth, GetHeightForWidth(kDialogWidth)); 137 return gfx::Size(kDialogWidth, GetHeightForWidth(kDialogWidth));
134 } 138 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/create_application_shortcut_view.cc ('k') | chrome/browser/ui/views/tab_modal_confirm_dialog_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698