| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/edit_search_engine_dialog.h" | 5 #include "chrome/browser/ui/views/edit_search_engine_dialog.h" |
| 6 | 6 |
| 7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/search_engines/template_url.h" | 10 #include "chrome/browser/search_engines/template_url.h" |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 views::Label* EditSearchEngineDialog::CreateLabel(int message_id) { | 222 views::Label* EditSearchEngineDialog::CreateLabel(int message_id) { |
| 223 views::Label* label = | 223 views::Label* label = |
| 224 new views::Label(l10n_util::GetStringUTF16(message_id)); | 224 new views::Label(l10n_util::GetStringUTF16(message_id)); |
| 225 label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 225 label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
| 226 return label; | 226 return label; |
| 227 } | 227 } |
| 228 | 228 |
| 229 Textfield* EditSearchEngineDialog::CreateTextfield(const string16& text, | 229 Textfield* EditSearchEngineDialog::CreateTextfield(const string16& text, |
| 230 bool lowercase) { | 230 bool lowercase) { |
| 231 Textfield* text_field = new Textfield( | 231 Textfield* text_field = new Textfield( |
| 232 #if defined(USE_AURA) | |
| 233 Textfield::STYLE_DEFAULT); | |
| 234 NOTIMPLEMENTED(); // TODO(beng): support lowercase mode in | |
| 235 // NativeTextfieldViews. | |
| 236 // http://crbug.com/109308 | |
| 237 #else | |
| 238 lowercase ? Textfield::STYLE_LOWERCASE : Textfield::STYLE_DEFAULT); | 232 lowercase ? Textfield::STYLE_LOWERCASE : Textfield::STYLE_DEFAULT); |
| 239 #endif | |
| 240 text_field->SetText(text); | 233 text_field->SetText(text); |
| 241 text_field->SetController(this); | 234 text_field->SetController(this); |
| 242 return text_field; | 235 return text_field; |
| 243 } | 236 } |
| 244 | 237 |
| 245 void EditSearchEngineDialog::UpdateImageViews() { | 238 void EditSearchEngineDialog::UpdateImageViews() { |
| 246 UpdateImageView(keyword_iv_, controller_->IsKeywordValid(keyword_tf_->text()), | 239 UpdateImageView(keyword_iv_, controller_->IsKeywordValid(keyword_tf_->text()), |
| 247 IDS_SEARCH_ENGINES_INVALID_KEYWORD_TT); | 240 IDS_SEARCH_ENGINES_INVALID_KEYWORD_TT); |
| 248 UpdateImageView(url_iv_, | 241 UpdateImageView(url_iv_, |
| 249 controller_->IsURLValid(UTF16ToUTF8(url_tf_->text())), | 242 controller_->IsURLValid(UTF16ToUTF8(url_tf_->text())), |
| 250 IDS_SEARCH_ENGINES_INVALID_URL_TT); | 243 IDS_SEARCH_ENGINES_INVALID_URL_TT); |
| 251 UpdateImageView(title_iv_, controller_->IsTitleValid(title_tf_->text()), | 244 UpdateImageView(title_iv_, controller_->IsTitleValid(title_tf_->text()), |
| 252 IDS_SEARCH_ENGINES_INVALID_TITLE_TT); | 245 IDS_SEARCH_ENGINES_INVALID_TITLE_TT); |
| 253 } | 246 } |
| 254 | 247 |
| 255 void EditSearchEngineDialog::UpdateImageView(ImageView* image_view, | 248 void EditSearchEngineDialog::UpdateImageView(ImageView* image_view, |
| 256 bool is_valid, | 249 bool is_valid, |
| 257 int invalid_message_id) { | 250 int invalid_message_id) { |
| 258 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 251 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 259 if (is_valid) { | 252 if (is_valid) { |
| 260 image_view->SetTooltipText(string16()); | 253 image_view->SetTooltipText(string16()); |
| 261 image_view->SetImage(rb.GetBitmapNamed(IDR_INPUT_GOOD)); | 254 image_view->SetImage(rb.GetBitmapNamed(IDR_INPUT_GOOD)); |
| 262 } else { | 255 } else { |
| 263 image_view->SetTooltipText(l10n_util::GetStringUTF16(invalid_message_id)); | 256 image_view->SetTooltipText(l10n_util::GetStringUTF16(invalid_message_id)); |
| 264 image_view->SetImage(rb.GetBitmapNamed(IDR_INPUT_ALERT)); | 257 image_view->SetImage(rb.GetBitmapNamed(IDR_INPUT_ALERT)); |
| 265 } | 258 } |
| 266 } | 259 } |
| OLD | NEW |