| 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/ui/gtk/edit_search_engine_dialog.h" | 5 #include "chrome/browser/ui/gtk/edit_search_engine_dialog.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include "base/i18n/case_conversion.h" | 9 #include "base/i18n/case_conversion.h" |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| 11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| 12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 13 #include "chrome/browser/net/url_fixer_upper.h" | 13 #include "chrome/browser/net/url_fixer_upper.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/search_engines/template_url.h" | 15 #include "chrome/browser/search_engines/template_url.h" |
| 16 #include "chrome/browser/search_engines/template_url_service.h" | 16 #include "chrome/browser/search_engines/template_url_service.h" |
| 17 #include "chrome/browser/ui/gtk/gtk_util.h" | 17 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 18 #include "chrome/browser/ui/search_engines/edit_search_engine_controller.h" | 18 #include "chrome/browser/ui/search_engines/edit_search_engine_controller.h" |
| 19 #include "googleurl/src/gurl.h" | 19 #include "googleurl/src/gurl.h" |
| 20 #include "grit/generated_resources.h" | 20 #include "grit/generated_resources.h" |
| 21 #include "grit/theme_resources.h" | 21 #include "grit/theme_resources.h" |
| 22 #include "grit/ui_resources.h" | 22 #include "grit/ui_resources.h" |
| 23 #include "ui/base/gtk/gtk_hig_constants.h" | |
| 24 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
| 25 #include "ui/base/resource/resource_bundle.h" | 24 #include "ui/base/resource/resource_bundle.h" |
| 26 #include "ui/gfx/image/image.h" | 25 #include "ui/gfx/image/image.h" |
| 27 | 26 |
| 28 namespace { | 27 namespace { |
| 29 | 28 |
| 30 std::string GetDisplayURL(const TemplateURL& turl) { | 29 std::string GetDisplayURL(const TemplateURL& turl) { |
| 31 return turl.url() ? UTF16ToUTF8(turl.url()->DisplayURL()) : std::string(); | 30 return turl.url() ? UTF16ToUTF8(turl.url()->DisplayURL()) : std::string(); |
| 32 } | 31 } |
| 33 | 32 |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 reversed_percent.length(), | 200 reversed_percent.length(), |
| 202 reversed_percent); | 201 reversed_percent); |
| 203 } | 202 } |
| 204 } | 203 } |
| 205 | 204 |
| 206 GtkWidget* description_label = gtk_label_new(description.c_str()); | 205 GtkWidget* description_label = gtk_label_new(description.c_str()); |
| 207 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog_)->vbox), description_label, | 206 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog_)->vbox), description_label, |
| 208 FALSE, FALSE, 0); | 207 FALSE, FALSE, 0); |
| 209 | 208 |
| 210 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog_)->vbox), | 209 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog_)->vbox), |
| 211 ui::kContentAreaSpacing); | 210 gtk_util::kContentAreaSpacing); |
| 212 | 211 |
| 213 EnableControls(); | 212 EnableControls(); |
| 214 | 213 |
| 215 gtk_util::ShowDialog(dialog_); | 214 gtk_util::ShowDialog(dialog_); |
| 216 | 215 |
| 217 g_signal_connect(dialog_, "response", G_CALLBACK(OnResponseThunk), this); | 216 g_signal_connect(dialog_, "response", G_CALLBACK(OnResponseThunk), this); |
| 218 g_signal_connect(dialog_, "destroy", G_CALLBACK(OnWindowDestroyThunk), this); | 217 g_signal_connect(dialog_, "destroy", G_CALLBACK(OnWindowDestroyThunk), this); |
| 219 } | 218 } |
| 220 | 219 |
| 221 string16 EditSearchEngineDialog::GetTitleInput() const { | 220 string16 EditSearchEngineDialog::GetTitleInput() const { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 GetURLInput()); | 270 GetURLInput()); |
| 272 } else { | 271 } else { |
| 273 controller_->CleanUpCancelledAdd(); | 272 controller_->CleanUpCancelledAdd(); |
| 274 } | 273 } |
| 275 gtk_widget_destroy(dialog_); | 274 gtk_widget_destroy(dialog_); |
| 276 } | 275 } |
| 277 | 276 |
| 278 void EditSearchEngineDialog::OnWindowDestroy(GtkWidget* widget) { | 277 void EditSearchEngineDialog::OnWindowDestroy(GtkWidget* widget) { |
| 279 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 278 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
| 280 } | 279 } |
| OLD | NEW |