| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 | 146 |
| 147 ui::ModalType ProfileSigninConfirmationDialogViews::GetModalType() const { | 147 ui::ModalType ProfileSigninConfirmationDialogViews::GetModalType() const { |
| 148 return ui::MODAL_TYPE_WINDOW; | 148 return ui::MODAL_TYPE_WINDOW; |
| 149 } | 149 } |
| 150 | 150 |
| 151 void ProfileSigninConfirmationDialogViews::ViewHierarchyChanged( | 151 void ProfileSigninConfirmationDialogViews::ViewHierarchyChanged( |
| 152 const ViewHierarchyChangedDetails& details) { | 152 const ViewHierarchyChangedDetails& details) { |
| 153 if (!details.is_add || details.child != this) | 153 if (!details.is_add || details.child != this) |
| 154 return; | 154 return; |
| 155 | 155 |
| 156 const SkColor kPromptBarBackgroundColor = |
| 157 ui::GetSigninConfirmationPromptBarColor( |
| 158 ui::kSigninConfirmationPromptBarBackgroundAlpha); |
| 159 |
| 156 // Create the prompt label. | 160 // Create the prompt label. |
| 157 size_t offset; | 161 size_t offset; |
| 158 const string16 domain = ASCIIToUTF16(gaia::ExtractDomainName(username_)); | 162 const string16 domain = ASCIIToUTF16(gaia::ExtractDomainName(username_)); |
| 159 const string16 username = ASCIIToUTF16(username_); | 163 const string16 username = ASCIIToUTF16(username_); |
| 160 const string16 prompt_text = | 164 const string16 prompt_text = |
| 161 l10n_util::GetStringFUTF16( | 165 l10n_util::GetStringFUTF16( |
| 162 IDS_ENTERPRISE_SIGNIN_ALERT_NEW_STYLE, | 166 IDS_ENTERPRISE_SIGNIN_ALERT_NEW_STYLE, |
| 163 domain, &offset); | 167 domain, &offset); |
| 164 views::StyledLabel* prompt_label = new views::StyledLabel(prompt_text, this); | 168 views::StyledLabel* prompt_label = new views::StyledLabel(prompt_text, this); |
| 169 prompt_label->SetDisplayedOnBackgroundColor(kPromptBarBackgroundColor); |
| 170 |
| 165 views::StyledLabel::RangeStyleInfo bold_style; | 171 views::StyledLabel::RangeStyleInfo bold_style; |
| 166 bold_style.font_style = gfx::Font::BOLD; | 172 bold_style.font_style = gfx::Font::BOLD; |
| 167 prompt_label->AddStyleRange( | 173 prompt_label->AddStyleRange( |
| 168 ui::Range(offset, offset + domain.size()), bold_style); | 174 ui::Range(offset, offset + domain.size()), bold_style); |
| 169 | 175 |
| 170 // Create the prompt bar. | 176 // Create the prompt bar. |
| 171 views::View* prompt_bar = new views::View; | 177 views::View* prompt_bar = new views::View; |
| 172 prompt_bar->set_border( | 178 prompt_bar->set_border( |
| 173 views::Border::CreateSolidSidedBorder( | 179 views::Border::CreateSolidSidedBorder( |
| 174 1, 0, 1, 0, | 180 1, 0, 1, 0, |
| 175 ui::GetSigninConfirmationPromptBarColor( | 181 ui::GetSigninConfirmationPromptBarColor( |
| 176 ui::kSigninConfirmationPromptBarBorderAlpha))); | 182 ui::kSigninConfirmationPromptBarBorderAlpha))); |
| 177 // TODO(dconnelly): set the background color on the label (crbug.com/244630) | 183 prompt_bar->set_background(views::Background::CreateSolidBackground( |
| 178 prompt_bar->set_background( | 184 kPromptBarBackgroundColor)); |
| 179 views::Background::CreateSolidBackground( | |
| 180 ui::GetSigninConfirmationPromptBarColor( | |
| 181 ui::kSigninConfirmationPromptBarBackgroundAlpha))); | |
| 182 | 185 |
| 183 // Create the explanation label. | 186 // Create the explanation label. |
| 184 std::vector<size_t> offsets; | 187 std::vector<size_t> offsets; |
| 185 const string16 learn_more_text = | 188 const string16 learn_more_text = |
| 186 l10n_util::GetStringUTF16( | 189 l10n_util::GetStringUTF16( |
| 187 IDS_ENTERPRISE_SIGNIN_PROFILE_LINK_LEARN_MORE); | 190 IDS_ENTERPRISE_SIGNIN_PROFILE_LINK_LEARN_MORE); |
| 188 const string16 signin_explanation_text = | 191 const string16 signin_explanation_text = |
| 189 l10n_util::GetStringFUTF16(prompt_for_new_profile_ ? | 192 l10n_util::GetStringFUTF16(prompt_for_new_profile_ ? |
| 190 IDS_ENTERPRISE_SIGNIN_EXPLANATION_WITH_PROFILE_CREATION_NEW_STYLE : | 193 IDS_ENTERPRISE_SIGNIN_EXPLANATION_WITH_PROFILE_CREATION_NEW_STYLE : |
| 191 IDS_ENTERPRISE_SIGNIN_EXPLANATION_WITHOUT_PROFILE_CREATION_NEW_STYLE, | 194 IDS_ENTERPRISE_SIGNIN_EXPLANATION_WITHOUT_PROFILE_CREATION_NEW_STYLE, |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 views::Button* sender, | 254 views::Button* sender, |
| 252 const ui::Event& event) { | 255 const ui::Event& event) { |
| 253 DCHECK(prompt_for_new_profile_); | 256 DCHECK(prompt_for_new_profile_); |
| 254 DCHECK_EQ(continue_signin_button_, sender); | 257 DCHECK_EQ(continue_signin_button_, sender); |
| 255 if (delegate_) { | 258 if (delegate_) { |
| 256 delegate_->OnContinueSignin(); | 259 delegate_->OnContinueSignin(); |
| 257 delegate_ = NULL; | 260 delegate_ = NULL; |
| 258 } | 261 } |
| 259 GetWidget()->Close(); | 262 GetWidget()->Close(); |
| 260 } | 263 } |
| OLD | NEW |