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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 std::vector<size_t> offsets; | 187 std::vector<size_t> offsets; |
188 const string16 learn_more_text = | 188 const string16 learn_more_text = |
189 l10n_util::GetStringUTF16( | 189 l10n_util::GetStringUTF16( |
190 IDS_ENTERPRISE_SIGNIN_PROFILE_LINK_LEARN_MORE); | 190 IDS_ENTERPRISE_SIGNIN_PROFILE_LINK_LEARN_MORE); |
191 const string16 signin_explanation_text = | 191 const string16 signin_explanation_text = |
192 l10n_util::GetStringFUTF16(prompt_for_new_profile_ ? | 192 l10n_util::GetStringFUTF16(prompt_for_new_profile_ ? |
193 IDS_ENTERPRISE_SIGNIN_EXPLANATION_WITH_PROFILE_CREATION_NEW_STYLE : | 193 IDS_ENTERPRISE_SIGNIN_EXPLANATION_WITH_PROFILE_CREATION_NEW_STYLE : |
194 IDS_ENTERPRISE_SIGNIN_EXPLANATION_WITHOUT_PROFILE_CREATION_NEW_STYLE, | 194 IDS_ENTERPRISE_SIGNIN_EXPLANATION_WITHOUT_PROFILE_CREATION_NEW_STYLE, |
195 username, learn_more_text, &offsets); | 195 username, learn_more_text, &offsets); |
196 explanation_label_ = new views::StyledLabel(signin_explanation_text, this); | 196 explanation_label_ = new views::StyledLabel(signin_explanation_text, this); |
197 views::StyledLabel::RangeStyleInfo link_style = | |
198 views::StyledLabel::RangeStyleInfo::CreateForLink(); | |
199 link_style.font_style = gfx::Font::NORMAL; | |
200 explanation_label_->AddStyleRange( | 197 explanation_label_->AddStyleRange( |
201 ui::Range(offsets[1], offsets[1] + learn_more_text.size()), | 198 ui::Range(offsets[1], offsets[1] + learn_more_text.size()), |
202 link_style); | 199 views::StyledLabel::RangeStyleInfo::CreateForLink()); |
203 | 200 |
204 // Layout the components. | 201 // Layout the components. |
205 views::GridLayout* dialog_layout = new views::GridLayout(this); | 202 views::GridLayout* dialog_layout = new views::GridLayout(this); |
206 SetLayoutManager(dialog_layout); | 203 SetLayoutManager(dialog_layout); |
207 | 204 |
208 // Use GridLayout inside the prompt bar because StyledLabel requires it. | 205 // Use GridLayout inside the prompt bar because StyledLabel requires it. |
209 views::GridLayout* prompt_layout = views::GridLayout::CreatePanel(prompt_bar); | 206 views::GridLayout* prompt_layout = views::GridLayout::CreatePanel(prompt_bar); |
210 prompt_bar->SetLayoutManager(prompt_layout); | 207 prompt_bar->SetLayoutManager(prompt_layout); |
211 prompt_layout->AddColumnSet(0)->AddColumn( | 208 prompt_layout->AddColumnSet(0)->AddColumn( |
212 views::GridLayout::FILL, views::GridLayout::CENTER, 100, | 209 views::GridLayout::FILL, views::GridLayout::CENTER, 100, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 views::Button* sender, | 251 views::Button* sender, |
255 const ui::Event& event) { | 252 const ui::Event& event) { |
256 DCHECK(prompt_for_new_profile_); | 253 DCHECK(prompt_for_new_profile_); |
257 DCHECK_EQ(continue_signin_button_, sender); | 254 DCHECK_EQ(continue_signin_button_, sender); |
258 if (delegate_) { | 255 if (delegate_) { |
259 delegate_->OnContinueSignin(); | 256 delegate_->OnContinueSignin(); |
260 delegate_ = NULL; | 257 delegate_ = NULL; |
261 } | 258 } |
262 GetWidget()->Close(); | 259 GetWidget()->Close(); |
263 } | 260 } |
OLD | NEW |