| 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 "chrome/browser/ui/views/constrained_window_views.h" |
| 12 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
| 13 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
| 14 #include "grit/theme_resources.h" | 15 #include "grit/theme_resources.h" |
| 15 #include "grit/ui_resources.h" | 16 #include "grit/ui_resources.h" |
| 16 #include "ui/base/events/event.h" | 17 #include "ui/base/events/event.h" |
| 17 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
| 18 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
| 19 #include "ui/views/controls/image_view.h" | 20 #include "ui/views/controls/image_view.h" |
| 20 #include "ui/views/controls/label.h" | 21 #include "ui/views/controls/label.h" |
| 21 #include "ui/views/controls/textfield/textfield.h" | 22 #include "ui/views/controls/textfield/textfield.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 54 |
| 54 // static | 55 // static |
| 55 void EditSearchEngineDialog::Show(gfx::NativeWindow parent, | 56 void EditSearchEngineDialog::Show(gfx::NativeWindow parent, |
| 56 TemplateURL* template_url, | 57 TemplateURL* template_url, |
| 57 EditSearchEngineControllerDelegate* delegate, | 58 EditSearchEngineControllerDelegate* delegate, |
| 58 Profile* profile) { | 59 Profile* profile) { |
| 59 EditSearchEngineDialog* contents = | 60 EditSearchEngineDialog* contents = |
| 60 new EditSearchEngineDialog(template_url, delegate, profile); | 61 new EditSearchEngineDialog(template_url, delegate, profile); |
| 61 // Window interprets an empty rectangle as needing to query the content for | 62 // Window interprets an empty rectangle as needing to query the content for |
| 62 // the size as well as centering relative to the parent. | 63 // the size as well as centering relative to the parent. |
| 63 views::DialogDelegate::CreateDialogWidget(contents, NULL, parent); | 64 CreateBrowserModalDialogViews(contents, parent); |
| 64 contents->GetWidget()->Show(); | 65 contents->GetWidget()->Show(); |
| 65 contents->GetDialogClientView()->UpdateDialogButtons(); | 66 contents->GetDialogClientView()->UpdateDialogButtons(); |
| 66 contents->title_tf_->SelectAll(true); | 67 contents->title_tf_->SelectAll(true); |
| 67 contents->title_tf_->RequestFocus(); | 68 contents->title_tf_->RequestFocus(); |
| 68 } | 69 } |
| 69 | 70 |
| 70 ui::ModalType EditSearchEngineDialog::GetModalType() const { | 71 ui::ModalType EditSearchEngineDialog::GetModalType() const { |
| 71 return ui::MODAL_TYPE_WINDOW; | 72 return ui::MODAL_TYPE_WINDOW; |
| 72 } | 73 } |
| 73 | 74 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 int invalid_message_id) { | 246 int invalid_message_id) { |
| 246 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 247 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 247 if (is_valid) { | 248 if (is_valid) { |
| 248 image_view->SetTooltipText(string16()); | 249 image_view->SetTooltipText(string16()); |
| 249 image_view->SetImage(rb.GetImageSkiaNamed(IDR_INPUT_GOOD)); | 250 image_view->SetImage(rb.GetImageSkiaNamed(IDR_INPUT_GOOD)); |
| 250 } else { | 251 } else { |
| 251 image_view->SetTooltipText(l10n_util::GetStringUTF16(invalid_message_id)); | 252 image_view->SetTooltipText(l10n_util::GetStringUTF16(invalid_message_id)); |
| 252 image_view->SetImage(rb.GetImageSkiaNamed(IDR_INPUT_ALERT)); | 253 image_view->SetImage(rb.GetImageSkiaNamed(IDR_INPUT_ALERT)); |
| 253 } | 254 } |
| 254 } | 255 } |
| OLD | NEW |