| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/sync/profile_signin_confirmation_dialog_views.
h" | 5 #include "chrome/browser/ui/views/sync/profile_signin_confirmation_dialog_views.
h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/browser_navigator.h" | 13 #include "chrome/browser/ui/browser_navigator.h" |
| 14 #include "chrome/browser/ui/browser_navigator_params.h" | 14 #include "chrome/browser/ui/browser_navigator_params.h" |
| 15 #include "chrome/browser/ui/browser_window.h" | 15 #include "chrome/browser/ui/browser_window.h" |
| 16 #include "chrome/browser/ui/views/harmony/layout_delegate.h" | 16 #include "chrome/browser/ui/views/harmony/chrome_layout_delegate.h" |
| 17 #include "chrome/grit/chromium_strings.h" | 17 #include "chrome/grit/chromium_strings.h" |
| 18 #include "chrome/grit/generated_resources.h" | 18 #include "chrome/grit/generated_resources.h" |
| 19 #include "components/constrained_window/constrained_window_views.h" | 19 #include "components/constrained_window/constrained_window_views.h" |
| 20 #include "components/signin/core/common/profile_management_switches.h" | 20 #include "components/signin/core/common/profile_management_switches.h" |
| 21 #include "content/public/browser/web_contents.h" | 21 #include "content/public/browser/web_contents.h" |
| 22 #include "google_apis/gaia/gaia_auth_util.h" | 22 #include "google_apis/gaia/gaia_auth_util.h" |
| 23 #include "third_party/skia/include/core/SkColor.h" | 23 #include "third_party/skia/include/core/SkColor.h" |
| 24 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
| 25 #include "ui/base/ui_features.h" | 25 #include "ui/base/ui_features.h" |
| 26 #include "ui/gfx/font.h" | 26 #include "ui/gfx/font.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 IDS_ENTERPRISE_SIGNIN_EXPLANATION_WITH_PROFILE_CREATION : | 187 IDS_ENTERPRISE_SIGNIN_EXPLANATION_WITH_PROFILE_CREATION : |
| 188 IDS_ENTERPRISE_SIGNIN_EXPLANATION_WITHOUT_PROFILE_CREATION, | 188 IDS_ENTERPRISE_SIGNIN_EXPLANATION_WITHOUT_PROFILE_CREATION, |
| 189 username, learn_more_text, &offsets); | 189 username, learn_more_text, &offsets); |
| 190 views::StyledLabel* explanation_label = | 190 views::StyledLabel* explanation_label = |
| 191 new views::StyledLabel(signin_explanation_text, this); | 191 new views::StyledLabel(signin_explanation_text, this); |
| 192 explanation_label->AddStyleRange( | 192 explanation_label->AddStyleRange( |
| 193 gfx::Range(offsets[1], offsets[1] + learn_more_text.size()), | 193 gfx::Range(offsets[1], offsets[1] + learn_more_text.size()), |
| 194 views::StyledLabel::RangeStyleInfo::CreateForLink()); | 194 views::StyledLabel::RangeStyleInfo::CreateForLink()); |
| 195 | 195 |
| 196 // Layout the components. | 196 // Layout the components. |
| 197 const int panel_margin = LayoutDelegate::Get()->GetMetric( | 197 const int panel_margin = ChromeLayoutDelegate::Get()->GetDistanceMetric( |
| 198 LayoutDelegate::Metric::PANEL_CONTENT_MARGIN); | 198 ChromeDistanceMetric::PANEL_CONTENT_MARGIN); |
| 199 views::GridLayout* dialog_layout = new views::GridLayout(this); | 199 views::GridLayout* dialog_layout = new views::GridLayout(this); |
| 200 dialog_layout->SetInsets(panel_margin, 0, 0, 0); | 200 dialog_layout->SetInsets(panel_margin, 0, 0, 0); |
| 201 SetLayoutManager(dialog_layout); | 201 SetLayoutManager(dialog_layout); |
| 202 | 202 |
| 203 // Use GridLayout inside the prompt bar because StyledLabel requires it. | 203 // Use GridLayout inside the prompt bar because StyledLabel requires it. |
| 204 views::GridLayout* prompt_layout = views::GridLayout::CreatePanel(prompt_bar); | 204 views::GridLayout* prompt_layout = views::GridLayout::CreatePanel(prompt_bar); |
| 205 prompt_layout->AddColumnSet(0)->AddColumn( | 205 prompt_layout->AddColumnSet(0)->AddColumn( |
| 206 views::GridLayout::FILL, views::GridLayout::CENTER, 100, | 206 views::GridLayout::FILL, views::GridLayout::CENTER, 100, |
| 207 views::GridLayout::USE_PREF, 0, 0); | 207 views::GridLayout::USE_PREF, 0, 0); |
| 208 prompt_layout->StartRow(0, 0); | 208 prompt_layout->StartRow(0, 0); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 void ProfileSigninConfirmationDialogViews::ButtonPressed( | 251 void ProfileSigninConfirmationDialogViews::ButtonPressed( |
| 252 views::Button* sender, | 252 views::Button* sender, |
| 253 const ui::Event& event) { | 253 const ui::Event& event) { |
| 254 DCHECK(prompt_for_new_profile_); | 254 DCHECK(prompt_for_new_profile_); |
| 255 if (delegate_) { | 255 if (delegate_) { |
| 256 delegate_->OnContinueSignin(); | 256 delegate_->OnContinueSignin(); |
| 257 delegate_ = nullptr; | 257 delegate_ = nullptr; |
| 258 } | 258 } |
| 259 GetWidget()->Close(); | 259 GetWidget()->Close(); |
| 260 } | 260 } |
| OLD | NEW |