| 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 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "ui/gfx/font.h" | 25 #include "ui/gfx/font.h" |
| 26 #include "ui/gfx/native_widget_types.h" | 26 #include "ui/gfx/native_widget_types.h" |
| 27 #include "ui/gfx/range/range.h" | 27 #include "ui/gfx/range/range.h" |
| 28 #include "ui/views/background.h" | 28 #include "ui/views/background.h" |
| 29 #include "ui/views/border.h" | 29 #include "ui/views/border.h" |
| 30 #include "ui/views/controls/button/md_text_button.h" | 30 #include "ui/views/controls/button/md_text_button.h" |
| 31 #include "ui/views/controls/label.h" | 31 #include "ui/views/controls/label.h" |
| 32 #include "ui/views/controls/styled_label.h" | 32 #include "ui/views/controls/styled_label.h" |
| 33 #include "ui/views/layout/box_layout.h" | 33 #include "ui/views/layout/box_layout.h" |
| 34 #include "ui/views/layout/grid_layout.h" | 34 #include "ui/views/layout/grid_layout.h" |
| 35 #include "ui/views/layout/layout_provider.h" |
| 35 #include "ui/views/views_delegate.h" | 36 #include "ui/views/views_delegate.h" |
| 36 #include "ui/views/widget/widget.h" | 37 #include "ui/views/widget/widget.h" |
| 37 #include "ui/views/window/dialog_client_view.h" | 38 #include "ui/views/window/dialog_client_view.h" |
| 38 | 39 |
| 39 #if !defined(OS_MACOSX) || BUILDFLAG(MAC_VIEWS_BROWSER) | 40 #if !defined(OS_MACOSX) || BUILDFLAG(MAC_VIEWS_BROWSER) |
| 40 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h" | 41 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h" |
| 41 #endif | 42 #endif |
| 42 | 43 |
| 43 ProfileSigninConfirmationDialogViews::ProfileSigninConfirmationDialogViews( | 44 ProfileSigninConfirmationDialogViews::ProfileSigninConfirmationDialogViews( |
| 44 Browser* browser, | 45 Browser* browser, |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 IDS_ENTERPRISE_SIGNIN_EXPLANATION_WITHOUT_PROFILE_CREATION, | 188 IDS_ENTERPRISE_SIGNIN_EXPLANATION_WITHOUT_PROFILE_CREATION, |
| 188 username, learn_more_text, &offsets); | 189 username, learn_more_text, &offsets); |
| 189 views::StyledLabel* explanation_label = | 190 views::StyledLabel* explanation_label = |
| 190 new views::StyledLabel(signin_explanation_text, this); | 191 new views::StyledLabel(signin_explanation_text, this); |
| 191 explanation_label->AddStyleRange( | 192 explanation_label->AddStyleRange( |
| 192 gfx::Range(offsets[1], offsets[1] + learn_more_text.size()), | 193 gfx::Range(offsets[1], offsets[1] + learn_more_text.size()), |
| 193 views::StyledLabel::RangeStyleInfo::CreateForLink()); | 194 views::StyledLabel::RangeStyleInfo::CreateForLink()); |
| 194 | 195 |
| 195 // Layout the components. | 196 // Layout the components. |
| 196 const gfx::Insets panel_insets = | 197 const gfx::Insets panel_insets = |
| 197 views::ViewsDelegate::GetInstance()->GetInsetsMetric( | 198 views::LayoutProvider::Get()->GetInsetsMetric(views::INSETS_PANEL); |
| 198 views::InsetsMetric::PANEL); | |
| 199 // The prompt bar needs to go to the edge of the dialog, so ignore insets for | 199 // The prompt bar needs to go to the edge of the dialog, so ignore insets for |
| 200 // the outer layout. | 200 // the outer layout. |
| 201 views::GridLayout* dialog_layout = new views::GridLayout(this); | 201 views::GridLayout* dialog_layout = new views::GridLayout(this); |
| 202 dialog_layout->SetInsets(panel_insets.top(), 0, panel_insets.bottom(), 0); | 202 dialog_layout->SetInsets(panel_insets.top(), 0, panel_insets.bottom(), 0); |
| 203 SetLayoutManager(dialog_layout); | 203 SetLayoutManager(dialog_layout); |
| 204 | 204 |
| 205 // Use GridLayout inside the prompt bar because StyledLabel requires it. | 205 // Use GridLayout inside the prompt bar because StyledLabel requires it. |
| 206 views::GridLayout* prompt_layout = views::GridLayout::CreatePanel(prompt_bar); | 206 views::GridLayout* prompt_layout = views::GridLayout::CreatePanel(prompt_bar); |
| 207 constexpr int kPromptBarColumnSetId = 0; | 207 constexpr int kPromptBarColumnSetId = 0; |
| 208 prompt_layout->AddColumnSet(kPromptBarColumnSetId) | 208 prompt_layout->AddColumnSet(kPromptBarColumnSetId) |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 void ProfileSigninConfirmationDialogViews::ButtonPressed( | 256 void ProfileSigninConfirmationDialogViews::ButtonPressed( |
| 257 views::Button* sender, | 257 views::Button* sender, |
| 258 const ui::Event& event) { | 258 const ui::Event& event) { |
| 259 DCHECK(prompt_for_new_profile_); | 259 DCHECK(prompt_for_new_profile_); |
| 260 if (delegate_) { | 260 if (delegate_) { |
| 261 delegate_->OnContinueSignin(); | 261 delegate_->OnContinueSignin(); |
| 262 delegate_ = nullptr; | 262 delegate_ = nullptr; |
| 263 } | 263 } |
| 264 GetWidget()->Close(); | 264 GetWidget()->Close(); |
| 265 } | 265 } |
| OLD | NEW |