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

Side by Side Diff: chrome/browser/ui/views/profiles/forced_reauthentication_dialog.cc

Issue 2928253002: Remove references to ui/views/layout/layout_constants.h (Closed)
Patch Set: git cl format 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/profiles/forced_reauthentication_dialog.h" 5 #include "chrome/browser/ui/views/profiles/forced_reauthentication_dialog.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/i18n/message_formatter.h" 11 #include "base/i18n/message_formatter.h"
12 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/browser_list.h" 16 #include "chrome/browser/ui/browser_list.h"
17 #include "chrome/browser/ui/browser_window.h" 17 #include "chrome/browser/ui/browser_window.h"
18 #include "chrome/browser/ui/sync/profile_signin_confirmation_helper.h" 18 #include "chrome/browser/ui/sync/profile_signin_confirmation_helper.h"
19 #include "chrome/browser/ui/tabs/tab_strip_model.h" 19 #include "chrome/browser/ui/tabs/tab_strip_model.h"
20 #include "chrome/browser/ui/views/frame/browser_view.h" 20 #include "chrome/browser/ui/views/frame/browser_view.h"
21 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h"
21 #include "chrome/grit/chromium_strings.h" 22 #include "chrome/grit/chromium_strings.h"
22 #include "chrome/grit/generated_resources.h" 23 #include "chrome/grit/generated_resources.h"
23 #include "components/constrained_window/constrained_window_views.h" 24 #include "components/constrained_window/constrained_window_views.h"
24 #include "components/signin/core/browser/signin_manager.h" 25 #include "components/signin/core/browser/signin_manager.h"
25 #include "ui/base/l10n/l10n_util.h" 26 #include "ui/base/l10n/l10n_util.h"
26 #include "ui/views/background.h" 27 #include "ui/views/background.h"
27 #include "ui/views/border.h" 28 #include "ui/views/border.h"
28 #include "ui/views/controls/styled_label.h" 29 #include "ui/views/controls/styled_label.h"
29 #include "ui/views/layout/grid_layout.h" 30 #include "ui/views/layout/grid_layout.h"
30 #include "ui/views/layout/layout_constants.h"
31 #include "ui/views/layout/layout_provider.h"
32 #include "ui/views/view.h" 31 #include "ui/views/view.h"
33 #include "ui/views/window/dialog_client_view.h" 32 #include "ui/views/window/dialog_client_view.h"
34 33
35 namespace { 34 namespace {
36 35
37 // Refresh title of the dialog every second. 36 // Refresh title of the dialog every second.
38 constexpr int kRefreshTitleTimer = 1; 37 constexpr int kRefreshTitleTimer = 1;
39 38
40 // If browser windows are going to be closed soon, close browser window before 39 // If browser windows are going to be closed soon, close browser window before
41 // showing sign in dialog because there might not be enough time for user to 40 // showing sign in dialog because there might not be enough time for user to
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 SetLayoutManager(dialog_layout); 208 SetLayoutManager(dialog_layout);
210 209
211 // Use a column set with no padding. 210 // Use a column set with no padding.
212 dialog_layout->AddColumnSet(0)->AddColumn(views::GridLayout::FILL, 211 dialog_layout->AddColumnSet(0)->AddColumn(views::GridLayout::FILL,
213 views::GridLayout::FILL, 100, 212 views::GridLayout::FILL, 100,
214 views::GridLayout::USE_PREF, 0, 0); 213 views::GridLayout::USE_PREF, 0, 0);
215 dialog_layout->StartRow(0, 0); 214 dialog_layout->StartRow(0, 0);
216 dialog_layout->AddView(prompt_label, 1, 1, views::GridLayout::FILL, 215 dialog_layout->AddView(prompt_label, 1, 1, views::GridLayout::FILL,
217 views::GridLayout::FILL, 0, 0); 216 views::GridLayout::FILL, 0, 0);
218 217
218 ChromeLayoutProvider* provider = ChromeLayoutProvider::Get();
219
219 // Use a new column set for the explanation label so we can add padding. 220 // Use a new column set for the explanation label so we can add padding.
220 dialog_layout->AddPaddingRow(0.0, views::kPanelVertMargin); 221 dialog_layout->AddPaddingRow(0.0, provider->GetDistanceMetric(
222 views::DISTANCE_DIALOG_CONTENTS_VERTICAL_MARGIN)));
Peter Kasting 2017/06/10 01:41:37 This doesn't look like the right constant. AFAICT
ananta 2017/06/10 03:36:44 Sent you an email with the image comparing the two
221 views::ColumnSet* explanation_columns = dialog_layout->AddColumnSet(1); 223 views::ColumnSet* explanation_columns = dialog_layout->AddColumnSet(1);
222 explanation_columns->AddPaddingColumn(0.0, views::kButtonHEdgeMarginNew); 224
225 const int padding_column_width = provider->GetDistanceMetric(
226 views::DISTANCE_DIALOG_CONTENTS_HORIZONTAL_MARGIN);
Peter Kasting 2017/06/10 01:41:37 It looks to me like these are the left() and right
ananta 2017/06/10 03:36:44 Thanks done.
227 explanation_columns->AddPaddingColumn(0.0, padding_column_width);
223 explanation_columns->AddColumn(views::GridLayout::FILL, 228 explanation_columns->AddColumn(views::GridLayout::FILL,
224 views::GridLayout::FILL, 100, 229 views::GridLayout::FILL, 100,
225 views::GridLayout::USE_PREF, 0, 0); 230 views::GridLayout::USE_PREF, 0, 0);
226 explanation_columns->AddPaddingColumn(0.0, views::kButtonHEdgeMarginNew); 231 explanation_columns->AddPaddingColumn(0.0, padding_column_width);
227 dialog_layout->StartRow(0, 1); 232 dialog_layout->StartRow(0, 1);
228 const int kPreferredWidth = 440; 233 const int kPreferredWidth = 440;
229 dialog_layout->AddView(explanation_label, 1, 1, views::GridLayout::FILL, 234 dialog_layout->AddView(explanation_label, 1, 1, views::GridLayout::FILL,
230 views::GridLayout::FILL, kPreferredWidth, 235 views::GridLayout::FILL, kPreferredWidth,
231 explanation_label->GetHeightForWidth(kPreferredWidth)); 236 explanation_label->GetHeightForWidth(kPreferredWidth));
232 refresh_timer_.Start(FROM_HERE, 237 refresh_timer_.Start(FROM_HERE,
233 base::TimeDelta::FromSeconds(kRefreshTitleTimer), this, 238 base::TimeDelta::FromSeconds(kRefreshTitleTimer), this,
234 &ForcedReauthenticationDialog::OnCountDown); 239 &ForcedReauthenticationDialog::OnCountDown);
235 } 240 }
236 241
237 void ForcedReauthenticationDialog::OnCountDown() { 242 void ForcedReauthenticationDialog::OnCountDown() {
238 if (desired_close_time_ <= base::TimeTicks::Now()) { 243 if (desired_close_time_ <= base::TimeTicks::Now()) {
239 Cancel(); 244 Cancel();
240 GetWidget()->Close(); 245 GetWidget()->Close();
241 } 246 }
242 GetWidget()->UpdateWindowTitle(); 247 GetWidget()->UpdateWindowTitle();
243 } 248 }
244 249
245 base::TimeDelta ForcedReauthenticationDialog::GetTimeRemaining() const { 250 base::TimeDelta ForcedReauthenticationDialog::GetTimeRemaining() const {
246 base::TimeTicks now = base::TimeTicks::Now(); 251 base::TimeTicks now = base::TimeTicks::Now();
247 if (desired_close_time_ <= now) 252 if (desired_close_time_ <= now)
248 return base::TimeDelta(); 253 return base::TimeDelta();
249 return desired_close_time_ - now; 254 return desired_close_time_ - now;
250 } 255 }
OLDNEW
« chrome/browser/ui/ash/DEPS ('K') | « chrome/browser/ui/views/chrome_cleaner_dialog_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698