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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 119 |
120 bool EditSearchEngineDialog::HandleKeyEvent( | 120 bool EditSearchEngineDialog::HandleKeyEvent( |
121 Textfield* sender, | 121 Textfield* sender, |
122 const views::KeyEvent& key_event) { | 122 const views::KeyEvent& key_event) { |
123 return false; | 123 return false; |
124 } | 124 } |
125 | 125 |
126 void EditSearchEngineDialog::Init() { | 126 void EditSearchEngineDialog::Init() { |
127 // Create the views we'll need. | 127 // Create the views we'll need. |
128 if (controller_->template_url()) { | 128 if (controller_->template_url()) { |
129 title_tf_ = | 129 title_tf_ = CreateTextfield(controller_->template_url()->short_name(), |
130 CreateTextfield(controller_->template_url()->short_name(), false); | 130 false); |
131 keyword_tf_ = CreateTextfield(controller_->template_url()->keyword(), true); | 131 keyword_tf_ = CreateTextfield(controller_->template_url()->keyword(), true); |
132 url_tf_ = | 132 url_tf_ = CreateTextfield(GetDisplayURL(*controller_->template_url()), |
133 CreateTextfield(GetDisplayURL(*controller_->template_url()), false); | 133 false); |
134 // We don't allow users to edit prepopulate URLs. This is done as | 134 // We don't allow users to edit prepopulate URLs. This is done as |
135 // occasionally we need to update the URL of prepopulated TemplateURLs. | 135 // occasionally we need to update the URL of prepopulated TemplateURLs. |
136 url_tf_->SetReadOnly(controller_->template_url()->prepopulate_id() != 0); | 136 url_tf_->SetReadOnly(controller_->template_url()->prepopulate_id() != 0); |
137 } else { | 137 } else { |
138 title_tf_ = CreateTextfield(string16(), false); | 138 title_tf_ = CreateTextfield(string16(), false); |
139 keyword_tf_ = CreateTextfield(string16(), true); | 139 keyword_tf_ = CreateTextfield(string16(), true); |
140 url_tf_ = CreateTextfield(string16(), false); | 140 url_tf_ = CreateTextfield(string16(), false); |
141 } | 141 } |
142 title_iv_ = new ImageView(); | 142 title_iv_ = new ImageView(); |
143 keyword_iv_ = new ImageView(); | 143 keyword_iv_ = new ImageView(); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 image_view->SetImage( | 268 image_view->SetImage( |
269 ResourceBundle::GetSharedInstance().GetBitmapNamed( | 269 ResourceBundle::GetSharedInstance().GetBitmapNamed( |
270 IDR_INPUT_GOOD)); | 270 IDR_INPUT_GOOD)); |
271 } else { | 271 } else { |
272 image_view->SetTooltipText(l10n_util::GetStringUTF16(invalid_message_id)); | 272 image_view->SetTooltipText(l10n_util::GetStringUTF16(invalid_message_id)); |
273 image_view->SetImage( | 273 image_view->SetImage( |
274 ResourceBundle::GetSharedInstance().GetBitmapNamed( | 274 ResourceBundle::GetSharedInstance().GetBitmapNamed( |
275 IDR_INPUT_ALERT)); | 275 IDR_INPUT_ALERT)); |
276 } | 276 } |
277 } | 277 } |
OLD | NEW |