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

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

Issue 2928253002: Remove references to ui/views/layout/layout_constants.h (Closed)
Patch Set: Fix build errors Created 3 years, 6 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/chrome_cleaner_dialog_win.h" 5 #include "chrome/browser/ui/views/chrome_cleaner_dialog_win.h"
6 6
7 #include "base/strings/string16.h" 7 #include "base/strings/string16.h"
8 #include "chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_dialog_cont roller_win.h" 8 #include "chrome/browser/safe_browsing/chrome_cleaner/chrome_cleaner_dialog_cont roller_win.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_dialogs.h" 10 #include "chrome/browser/ui/browser_dialogs.h"
11 #include "chrome/browser/ui/browser_window.h" 11 #include "chrome/browser/ui/browser_window.h"
12 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h"
12 #include "components/constrained_window/constrained_window_views.h" 13 #include "components/constrained_window/constrained_window_views.h"
13 #include "ui/base/ui_base_types.h" 14 #include "ui/base/ui_base_types.h"
14 #include "ui/events/event.h" 15 #include "ui/events/event.h"
15 #include "ui/gfx/geometry/insets.h" 16 #include "ui/gfx/geometry/insets.h"
16 #include "ui/gfx/native_widget_types.h" 17 #include "ui/gfx/native_widget_types.h"
17 #include "ui/gfx/text_constants.h" 18 #include "ui/gfx/text_constants.h"
18 #include "ui/views/controls/button/md_text_button.h" 19 #include "ui/views/controls/button/md_text_button.h"
19 #include "ui/views/controls/label.h" 20 #include "ui/views/controls/label.h"
20 #include "ui/views/layout/box_layout.h" 21 #include "ui/views/layout/box_layout.h"
21 #include "ui/views/layout/layout_constants.h"
22 #include "ui/views/widget/widget.h" 22 #include "ui/views/widget/widget.h"
23 23
24 namespace chrome { 24 namespace chrome {
25 25
26 void ShowChromeCleanerPrompt( 26 void ShowChromeCleanerPrompt(
27 Browser* browser, 27 Browser* browser,
28 safe_browsing::ChromeCleanerDialogController* controller) { 28 safe_browsing::ChromeCleanerDialogController* controller) {
29 ChromeCleanerDialog* dialog = new ChromeCleanerDialog(controller); 29 ChromeCleanerDialog* dialog = new ChromeCleanerDialog(controller);
30 dialog->Show(browser); 30 dialog->Show(browser);
31 } 31 }
32 32
33 } // namespace chrome 33 } // namespace chrome
34 34
35 namespace { 35 namespace {
36 constexpr int kDialogWidth = 448; 36 constexpr int kDialogWidth = 448;
37 } // namespace 37 } // namespace
38 38
39 //////////////////////////////////////////////////////////////////////////////// 39 ////////////////////////////////////////////////////////////////////////////////
40 // ChromeCleanerDialog 40 // ChromeCleanerDialog
41 41
42 ChromeCleanerDialog::ChromeCleanerDialog( 42 ChromeCleanerDialog::ChromeCleanerDialog(
43 safe_browsing::ChromeCleanerDialogController* controller) 43 safe_browsing::ChromeCleanerDialogController* controller)
44 : browser_(nullptr), controller_(controller) { 44 : browser_(nullptr), controller_(controller) {
45 DCHECK(controller_); 45 DCHECK(controller_);
46 46
47 SetLayoutManager(new views::BoxLayout( 47 SetLayoutManager(
48 views::BoxLayout::kVertical, 48 new views::BoxLayout(views::BoxLayout::kVertical,
49 gfx::Insets(views::kPanelVertMargin, views::kButtonHEdgeMarginNew), 0)); 49 ChromeLayoutProvider::Get()->GetInsetsMetric(
50 views::INSETS_DIALOG_CONTENTS),
51 0));
50 views::Label* label = new views::Label(controller_->GetMainText()); 52 views::Label* label = new views::Label(controller_->GetMainText());
51 label->SetMultiLine(true); 53 label->SetMultiLine(true);
52 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 54 label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
53 AddChildView(label); 55 AddChildView(label);
54 } 56 }
55 57
56 ChromeCleanerDialog::~ChromeCleanerDialog() { 58 ChromeCleanerDialog::~ChromeCleanerDialog() {
57 // Make sure the controller is correctly notified in case the dialog widget is 59 // Make sure the controller is correctly notified in case the dialog widget is
58 // closed by some other means than the dialog buttons. 60 // closed by some other means than the dialog buttons.
59 if (controller_) 61 if (controller_)
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 DCHECK(browser_); 139 DCHECK(browser_);
138 140
139 // TODO(alito): Navigate to the webui version of the Chrome Cleaner UI when 141 // TODO(alito): Navigate to the webui version of the Chrome Cleaner UI when
140 // that is implemented. 142 // that is implemented.
141 if (controller_) { 143 if (controller_) {
142 controller_->DetailsButtonClicked(); 144 controller_->DetailsButtonClicked();
143 controller_ = nullptr; 145 controller_ = nullptr;
144 } 146 }
145 GetWidget()->Close(); 147 GetWidget()->Close();
146 } 148 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698