| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/chromeos/login/captcha_view.h" | 5 #include "chrome/browser/chromeos/login/captcha_view.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/chromeos/login/helper.h" | 9 #include "chrome/browser/chromeos/login/helper.h" |
| 10 #include "chrome/browser/chromeos/login/image_downloader.h" | 10 #include "chrome/browser/chromeos/login/image_downloader.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 163 |
| 164 views::GridLayout* layout = views::GridLayout::CreatePanel(this); | 164 views::GridLayout* layout = views::GridLayout::CreatePanel(this); |
| 165 SetLayoutManager(layout); | 165 SetLayoutManager(layout); |
| 166 | 166 |
| 167 int column_view_set_id = 0; | 167 int column_view_set_id = 0; |
| 168 views::ColumnSet* column_set = layout->AddColumnSet(column_view_set_id); | 168 views::ColumnSet* column_set = layout->AddColumnSet(column_view_set_id); |
| 169 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, | 169 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, |
| 170 views::GridLayout::USE_PREF, 0, 0); | 170 views::GridLayout::USE_PREF, 0, 0); |
| 171 layout->StartRow(0, column_view_set_id); | 171 layout->StartRow(0, column_view_set_id); |
| 172 Label* label = new views::Label( | 172 Label* label = new views::Label( |
| 173 l10n_util::GetStringUTF16(IDS_LOGIN_CAPTCHA_INSTRUCTIONS)); | 173 UTF16ToWide(l10n_util::GetStringUTF16(IDS_LOGIN_CAPTCHA_INSTRUCTIONS))); |
| 174 label->SetMultiLine(true); | 174 label->SetMultiLine(true); |
| 175 layout->AddView(label); | 175 layout->AddView(label); |
| 176 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 176 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| 177 | 177 |
| 178 layout->StartRow(0, column_view_set_id); | 178 layout->StartRow(0, column_view_set_id); |
| 179 captcha_image_ = new views::ImageView(); | 179 captcha_image_ = new views::ImageView(); |
| 180 layout->AddView(captcha_image_); | 180 layout->AddView(captcha_image_); |
| 181 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 181 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| 182 | 182 |
| 183 layout->StartRow(0, column_view_set_id); | 183 layout->StartRow(0, column_view_set_id); |
| 184 captcha_textfield_ = new CaptchaField(); | 184 captcha_textfield_ = new CaptchaField(); |
| 185 captcha_textfield_->SetController(this); | 185 captcha_textfield_->SetController(this); |
| 186 if (is_standalone_) | 186 if (is_standalone_) |
| 187 captcha_textfield_->set_background(new CopyBackground(this)); | 187 captcha_textfield_->set_background(new CopyBackground(this)); |
| 188 layout->AddView(captcha_textfield_); | 188 layout->AddView(captcha_textfield_); |
| 189 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 189 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| 190 | 190 |
| 191 layout->StartRow(0, column_view_set_id); | 191 layout->StartRow(0, column_view_set_id); |
| 192 label = new views::Label( | 192 label = new views::Label(UTF16ToWide( |
| 193 l10n_util::GetStringUTF16(IDS_SYNC_GAIA_CAPTCHA_CASE_INSENSITIVE_TIP)); | 193 l10n_util::GetStringUTF16(IDS_SYNC_GAIA_CAPTCHA_CASE_INSENSITIVE_TIP))); |
| 194 label->SetMultiLine(true); | 194 label->SetMultiLine(true); |
| 195 layout->AddView(label); | 195 layout->AddView(label); |
| 196 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 196 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| 197 | 197 |
| 198 if (is_standalone_) { | 198 if (is_standalone_) { |
| 199 layout->StartRow(0, column_view_set_id); | 199 layout->StartRow(0, column_view_set_id); |
| 200 ok_button_ = new WideTextButton( | 200 ok_button_ = new WideTextButton( |
| 201 this, UTF16ToWide(l10n_util::GetStringUTF16(IDS_OK))); | 201 this, UTF16ToWide(l10n_util::GetStringUTF16(IDS_OK))); |
| 202 ok_button_->set_alignment(views::TextButton::ALIGN_CENTER); | 202 ok_button_->set_alignment(views::TextButton::ALIGN_CENTER); |
| 203 ok_button_->set_focusable(true); | 203 ok_button_->set_focusable(true); |
| 204 static_cast<views::TextButtonBorder*>(ok_button_->border())-> | 204 static_cast<views::TextButtonBorder*>(ok_button_->border())-> |
| 205 copy_normal_set_to_hot_set(); | 205 copy_normal_set_to_hot_set(); |
| 206 ok_button_->set_animate_on_state_change(false); | 206 ok_button_->set_animate_on_state_change(false); |
| 207 ok_button_->SetEnabledColor(SK_ColorBLACK); | 207 ok_button_->SetEnabledColor(SK_ColorBLACK); |
| 208 ok_button_->SetHighlightColor(SK_ColorBLACK); | 208 ok_button_->SetHighlightColor(SK_ColorBLACK); |
| 209 ok_button_->SetHoverColor(SK_ColorBLACK); | 209 ok_button_->SetHoverColor(SK_ColorBLACK); |
| 210 layout->AddView(ok_button_, 1, 1, | 210 layout->AddView(ok_button_, 1, 1, |
| 211 views::GridLayout::CENTER, views::GridLayout::CENTER); | 211 views::GridLayout::CENTER, views::GridLayout::CENTER); |
| 212 } | 212 } |
| 213 | 213 |
| 214 // ImageDownloader will delete itself once URL is fetched. | 214 // ImageDownloader will delete itself once URL is fetched. |
| 215 // TODO(nkostylev): Make sure that it works after view is deleted. | 215 // TODO(nkostylev): Make sure that it works after view is deleted. |
| 216 new ImageDownloader(this, GURL(captcha_url_), std::string()); | 216 new ImageDownloader(this, GURL(captcha_url_), std::string()); |
| 217 } | 217 } |
| 218 | 218 |
| 219 } // namespace chromeos | 219 } // namespace chromeos |
| OLD | NEW |