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" |
11 #include "chrome/browser/ui/search_engines/edit_search_engine_controller.h" | 11 #include "chrome/browser/ui/search_engines/edit_search_engine_controller.h" |
12 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
13 #include "grit/generated_resources.h" | 13 #include "grit/generated_resources.h" |
14 #include "grit/theme_resources.h" | 14 #include "grit/theme_resources.h" |
15 #include "grit/ui_resources.h" | 15 #include "grit/ui_resources.h" |
| 16 #include "ui/base/event.h" |
16 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
17 #include "ui/base/resource/resource_bundle.h" | 18 #include "ui/base/resource/resource_bundle.h" |
18 #include "ui/views/controls/image_view.h" | 19 #include "ui/views/controls/image_view.h" |
19 #include "ui/views/controls/label.h" | 20 #include "ui/views/controls/label.h" |
20 #include "ui/views/controls/table/table_view.h" | 21 #include "ui/views/controls/table/table_view.h" |
21 #include "ui/views/controls/textfield/textfield.h" | 22 #include "ui/views/controls/textfield/textfield.h" |
22 #include "ui/views/layout/grid_layout.h" | 23 #include "ui/views/layout/grid_layout.h" |
23 #include "ui/views/layout/layout_constants.h" | 24 #include "ui/views/layout/layout_constants.h" |
24 #include "ui/views/widget/widget.h" | 25 #include "ui/views/widget/widget.h" |
25 | 26 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 } | 103 } |
103 | 104 |
104 void EditSearchEngineDialog::ContentsChanged(Textfield* sender, | 105 void EditSearchEngineDialog::ContentsChanged(Textfield* sender, |
105 const string16& new_contents) { | 106 const string16& new_contents) { |
106 GetDialogClientView()->UpdateDialogButtons(); | 107 GetDialogClientView()->UpdateDialogButtons(); |
107 UpdateImageViews(); | 108 UpdateImageViews(); |
108 } | 109 } |
109 | 110 |
110 bool EditSearchEngineDialog::HandleKeyEvent( | 111 bool EditSearchEngineDialog::HandleKeyEvent( |
111 Textfield* sender, | 112 Textfield* sender, |
112 const views::KeyEvent& key_event) { | 113 const ui::KeyEvent& key_event) { |
113 return false; | 114 return false; |
114 } | 115 } |
115 | 116 |
116 void EditSearchEngineDialog::Init() { | 117 void EditSearchEngineDialog::Init() { |
117 // Create the views we'll need. | 118 // Create the views we'll need. |
118 if (controller_->template_url()) { | 119 if (controller_->template_url()) { |
119 title_tf_ = CreateTextfield(controller_->template_url()->short_name(), | 120 title_tf_ = CreateTextfield(controller_->template_url()->short_name(), |
120 false); | 121 false); |
121 keyword_tf_ = CreateTextfield(controller_->template_url()->keyword(), true); | 122 keyword_tf_ = CreateTextfield(controller_->template_url()->keyword(), true); |
122 url_tf_ = CreateTextfield( | 123 url_tf_ = CreateTextfield( |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 int invalid_message_id) { | 249 int invalid_message_id) { |
249 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 250 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
250 if (is_valid) { | 251 if (is_valid) { |
251 image_view->SetTooltipText(string16()); | 252 image_view->SetTooltipText(string16()); |
252 image_view->SetImage(rb.GetImageSkiaNamed(IDR_INPUT_GOOD)); | 253 image_view->SetImage(rb.GetImageSkiaNamed(IDR_INPUT_GOOD)); |
253 } else { | 254 } else { |
254 image_view->SetTooltipText(l10n_util::GetStringUTF16(invalid_message_id)); | 255 image_view->SetTooltipText(l10n_util::GetStringUTF16(invalid_message_id)); |
255 image_view->SetImage(rb.GetImageSkiaNamed(IDR_INPUT_ALERT)); | 256 image_view->SetImage(rb.GetImageSkiaNamed(IDR_INPUT_ALERT)); |
256 } | 257 } |
257 } | 258 } |
OLD | NEW |