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

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

Issue 2800773003: Settings reset prompt: add more UI metrics. (Closed)
Patch Set: Rebase 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 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 "components/constrained_window/constrained_window_views.h" 10 #include "components/constrained_window/constrained_window_views.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 new views::StyledLabel(controller_->GetMainText(), /*listener=*/nullptr); 47 new views::StyledLabel(controller_->GetMainText(), /*listener=*/nullptr);
48 views::StyledLabel::RangeStyleInfo url_style; 48 views::StyledLabel::RangeStyleInfo url_style;
49 url_style.weight = gfx::Font::Weight::BOLD; 49 url_style.weight = gfx::Font::Weight::BOLD;
50 dialog_label->AddStyleRange(controller_->GetMainTextUrlRange(), url_style); 50 dialog_label->AddStyleRange(controller_->GetMainTextUrlRange(), url_style);
51 AddChildView(dialog_label); 51 AddChildView(dialog_label);
52 } 52 }
53 53
54 SettingsResetPromptDialog::~SettingsResetPromptDialog() { 54 SettingsResetPromptDialog::~SettingsResetPromptDialog() {
55 // Make sure the controller is correctly notified in case the dialog widget is 55 // Make sure the controller is correctly notified in case the dialog widget is
56 // closed by some other means than the dialog buttons. 56 // closed by some other means than the dialog buttons.
57 Close(); 57 Close();
sky 2017/04/07 23:20:06 The destructor has no need to close as by the time
alito 2017/04/07 23:50:43 Done.
58 } 58 }
59 59
60 void SettingsResetPromptDialog::Show(Browser* browser) { 60 void SettingsResetPromptDialog::Show(Browser* browser) {
61 DCHECK(browser); 61 DCHECK(browser);
62 browser_ = browser; 62 browser_ = browser;
63 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser); 63 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser);
64 constrained_window::CreateBrowserModalDialogViews( 64 constrained_window::CreateBrowserModalDialogViews(
65 this, browser_view->GetNativeWindow()) 65 this, browser_view->GetNativeWindow())
66 ->Show(); 66 ->Show();
67 controller_->DialogShown(); 67 controller_->DialogShown();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 } 107 }
108 108
109 bool SettingsResetPromptDialog::Cancel() { 109 bool SettingsResetPromptDialog::Cancel() {
110 if (!interaction_done_) { 110 if (!interaction_done_) {
111 interaction_done_ = true; 111 interaction_done_ = true;
112 controller_->Cancel(); 112 controller_->Cancel();
113 } 113 }
114 return true; 114 return true;
115 } 115 }
116 116
117 bool SettingsResetPromptDialog::Close() {
118 if (!interaction_done_) {
119 interaction_done_ = true;
120 controller_->Close();
121 }
122 return true;
123 }
124
117 // View overrides. 125 // View overrides.
118 126
119 gfx::Size SettingsResetPromptDialog::GetPreferredSize() const { 127 gfx::Size SettingsResetPromptDialog::GetPreferredSize() const {
120 return gfx::Size(kDialogWidth, GetHeightForWidth(kDialogWidth)); 128 return gfx::Size(kDialogWidth, GetHeightForWidth(kDialogWidth));
121 } 129 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/settings_reset_prompt_dialog.h ('k') | tools/metrics/actions/actions.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698