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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 } | 141 } |
142 | 142 |
143 void ProfileSigninConfirmationDialogViews::ViewHierarchyChanged( | 143 void ProfileSigninConfirmationDialogViews::ViewHierarchyChanged( |
144 const ViewHierarchyChangedDetails& details) { | 144 const ViewHierarchyChangedDetails& details) { |
145 views::DialogDelegateView::ViewHierarchyChanged(details); | 145 views::DialogDelegateView::ViewHierarchyChanged(details); |
146 if (!details.is_add || details.child != this) | 146 if (!details.is_add || details.child != this) |
147 return; | 147 return; |
148 | 148 |
149 const SkColor kPromptBarBackgroundColor = | 149 const SkColor kPromptBarBackgroundColor = |
150 ui::GetSigninConfirmationPromptBarColor( | 150 ui::GetSigninConfirmationPromptBarColor( |
151 ui::kSigninConfirmationPromptBarBackgroundAlpha); | 151 GetNativeTheme(), ui::kSigninConfirmationPromptBarBackgroundAlpha); |
152 | 152 |
153 // Create the prompt label. | 153 // Create the prompt label. |
154 size_t offset; | 154 size_t offset; |
155 const base::string16 domain = | 155 const base::string16 domain = |
156 base::ASCIIToUTF16(gaia::ExtractDomainName(username_)); | 156 base::ASCIIToUTF16(gaia::ExtractDomainName(username_)); |
157 const base::string16 username = base::ASCIIToUTF16(username_); | 157 const base::string16 username = base::ASCIIToUTF16(username_); |
158 const base::string16 prompt_text = | 158 const base::string16 prompt_text = |
159 l10n_util::GetStringFUTF16( | 159 l10n_util::GetStringFUTF16( |
160 IDS_ENTERPRISE_SIGNIN_ALERT_NEW_STYLE, | 160 IDS_ENTERPRISE_SIGNIN_ALERT_NEW_STYLE, |
161 domain, &offset); | 161 domain, &offset); |
162 views::StyledLabel* prompt_label = new views::StyledLabel(prompt_text, this); | 162 views::StyledLabel* prompt_label = new views::StyledLabel(prompt_text, this); |
163 prompt_label->SetDisplayedOnBackgroundColor(kPromptBarBackgroundColor); | 163 prompt_label->SetDisplayedOnBackgroundColor(kPromptBarBackgroundColor); |
164 | 164 |
165 views::StyledLabel::RangeStyleInfo bold_style; | 165 views::StyledLabel::RangeStyleInfo bold_style; |
166 bold_style.font_style = gfx::Font::BOLD; | 166 bold_style.font_style = gfx::Font::BOLD; |
167 prompt_label->AddStyleRange( | 167 prompt_label->AddStyleRange( |
168 gfx::Range(offset, offset + domain.size()), bold_style); | 168 gfx::Range(offset, offset + domain.size()), bold_style); |
169 | 169 |
170 // Create the prompt bar. | 170 // Create the prompt bar. |
171 views::View* prompt_bar = new views::View; | 171 views::View* prompt_bar = new views::View; |
172 prompt_bar->SetBorder(views::Border::CreateSolidSidedBorder( | 172 prompt_bar->SetBorder(views::Border::CreateSolidSidedBorder( |
173 1, | 173 1, 0, 1, 0, |
174 0, | |
175 1, | |
176 0, | |
177 ui::GetSigninConfirmationPromptBarColor( | 174 ui::GetSigninConfirmationPromptBarColor( |
178 ui::kSigninConfirmationPromptBarBorderAlpha))); | 175 GetNativeTheme(), ui::kSigninConfirmationPromptBarBorderAlpha))); |
179 prompt_bar->set_background(views::Background::CreateSolidBackground( | 176 prompt_bar->set_background(views::Background::CreateSolidBackground( |
180 kPromptBarBackgroundColor)); | 177 kPromptBarBackgroundColor)); |
181 | 178 |
182 // Create the explanation label. | 179 // Create the explanation label. |
183 std::vector<size_t> offsets; | 180 std::vector<size_t> offsets; |
184 const base::string16 learn_more_text = | 181 const base::string16 learn_more_text = |
185 l10n_util::GetStringUTF16( | 182 l10n_util::GetStringUTF16( |
186 IDS_ENTERPRISE_SIGNIN_PROFILE_LINK_LEARN_MORE); | 183 IDS_ENTERPRISE_SIGNIN_PROFILE_LINK_LEARN_MORE); |
187 const base::string16 signin_explanation_text = | 184 const base::string16 signin_explanation_text = |
188 l10n_util::GetStringFUTF16(prompt_for_new_profile_ ? | 185 l10n_util::GetStringFUTF16(prompt_for_new_profile_ ? |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 views::Button* sender, | 245 views::Button* sender, |
249 const ui::Event& event) { | 246 const ui::Event& event) { |
250 DCHECK(prompt_for_new_profile_); | 247 DCHECK(prompt_for_new_profile_); |
251 DCHECK_EQ(continue_signin_button_, sender); | 248 DCHECK_EQ(continue_signin_button_, sender); |
252 if (delegate_) { | 249 if (delegate_) { |
253 delegate_->OnContinueSignin(); | 250 delegate_->OnContinueSignin(); |
254 delegate_ = NULL; | 251 delegate_ = NULL; |
255 } | 252 } |
256 GetWidget()->Close(); | 253 GetWidget()->Close(); |
257 } | 254 } |
OLD | NEW |