| OLD | NEW |
| 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 "chrome/browser/ui/views/harmony/chrome_layout_provider.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 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 ChromeLayoutProvider* provider = ChromeLayoutProvider::Get(); | 42 ChromeLayoutProvider* provider = ChromeLayoutProvider::Get(); |
| 43 | 43 |
| 44 SetLayoutManager( | 44 SetLayoutManager(new views::BoxLayout( |
| 45 new views::BoxLayout(views::BoxLayout::kVertical, | 45 views::BoxLayout::kVertical, |
| 46 provider->GetDistanceMetric( | 46 provider->GetDistanceMetric( |
| 47 DISTANCE_DIALOG_BUTTON_MARGIN), | 47 views::DISTANCE_DIALOG_CONTENTS_HORIZONTAL_MARGIN), |
| 48 provider->GetDistanceMetric( | 48 provider->GetDistanceMetric( |
| 49 DISTANCE_PANEL_CONTENT_MARGIN), | 49 views::DISTANCE_DIALOG_CONTENTS_VERTICAL_MARGIN), |
| 50 0)); | 50 0)); |
| 51 | 51 |
| 52 views::StyledLabel* dialog_label = | 52 views::StyledLabel* dialog_label = |
| 53 new views::StyledLabel(controller_->GetMainText(), /*listener=*/nullptr); | 53 new views::StyledLabel(controller_->GetMainText(), /*listener=*/nullptr); |
| 54 views::StyledLabel::RangeStyleInfo url_style; | 54 views::StyledLabel::RangeStyleInfo url_style; |
| 55 url_style.weight = gfx::Font::Weight::BOLD; | 55 url_style.weight = gfx::Font::Weight::BOLD; |
| 56 dialog_label->AddStyleRange(controller_->GetMainTextUrlRange(), url_style); | 56 dialog_label->AddStyleRange(controller_->GetMainTextUrlRange(), url_style); |
| 57 AddChildView(dialog_label); | 57 AddChildView(dialog_label); |
| 58 } | 58 } |
| 59 | 59 |
| 60 SettingsResetPromptDialog::~SettingsResetPromptDialog() { | 60 SettingsResetPromptDialog::~SettingsResetPromptDialog() { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 controller_ = nullptr; | 131 controller_ = nullptr; |
| 132 } | 132 } |
| 133 return true; | 133 return true; |
| 134 } | 134 } |
| 135 | 135 |
| 136 // View overrides. | 136 // View overrides. |
| 137 | 137 |
| 138 gfx::Size SettingsResetPromptDialog::GetPreferredSize() const { | 138 gfx::Size SettingsResetPromptDialog::GetPreferredSize() const { |
| 139 return gfx::Size(kDialogWidth, GetHeightForWidth(kDialogWidth)); | 139 return gfx::Size(kDialogWidth, GetHeightForWidth(kDialogWidth)); |
| 140 } | 140 } |
| OLD | NEW |