| 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" |
| 23 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
| 24 #include "ui/base/resource/resource_bundle.h" | 25 #include "ui/base/resource/resource_bundle.h" |
| 25 #include "ui/gfx/image/image.h" | 26 #include "ui/gfx/image/image.h" |
| 26 | 27 |
| 27 namespace { | 28 namespace { |
| 28 | 29 |
| 29 std::string GetDisplayURL(const TemplateURL& turl) { | 30 std::string GetDisplayURL(const TemplateURL& turl) { |
| 30 return turl.url() ? UTF16ToUTF8(turl.url()->DisplayURL()) : std::string(); | 31 return turl.url() ? UTF16ToUTF8(turl.url()->DisplayURL()) : std::string(); |
| 31 } | 32 } |
| 32 | 33 |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 reversed_percent.length(), | 201 reversed_percent.length(), |
| 201 reversed_percent); | 202 reversed_percent); |
| 202 } | 203 } |
| 203 } | 204 } |
| 204 | 205 |
| 205 GtkWidget* description_label = gtk_label_new(description.c_str()); | 206 GtkWidget* description_label = gtk_label_new(description.c_str()); |
| 206 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog_)->vbox), description_label, | 207 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog_)->vbox), description_label, |
| 207 FALSE, FALSE, 0); | 208 FALSE, FALSE, 0); |
| 208 | 209 |
| 209 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog_)->vbox), | 210 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog_)->vbox), |
| 210 gtk_util::kContentAreaSpacing); | 211 ui::kContentAreaSpacing); |
| 211 | 212 |
| 212 EnableControls(); | 213 EnableControls(); |
| 213 | 214 |
| 214 gtk_util::ShowDialog(dialog_); | 215 gtk_util::ShowDialog(dialog_); |
| 215 | 216 |
| 216 g_signal_connect(dialog_, "response", G_CALLBACK(OnResponseThunk), this); | 217 g_signal_connect(dialog_, "response", G_CALLBACK(OnResponseThunk), this); |
| 217 g_signal_connect(dialog_, "destroy", G_CALLBACK(OnWindowDestroyThunk), this); | 218 g_signal_connect(dialog_, "destroy", G_CALLBACK(OnWindowDestroyThunk), this); |
| 218 } | 219 } |
| 219 | 220 |
| 220 string16 EditSearchEngineDialog::GetTitleInput() const { | 221 string16 EditSearchEngineDialog::GetTitleInput() const { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 GetURLInput()); | 271 GetURLInput()); |
| 271 } else { | 272 } else { |
| 272 controller_->CleanUpCancelledAdd(); | 273 controller_->CleanUpCancelledAdd(); |
| 273 } | 274 } |
| 274 gtk_widget_destroy(dialog_); | 275 gtk_widget_destroy(dialog_); |
| 275 } | 276 } |
| 276 | 277 |
| 277 void EditSearchEngineDialog::OnWindowDestroy(GtkWidget* widget) { | 278 void EditSearchEngineDialog::OnWindowDestroy(GtkWidget* widget) { |
| 278 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 279 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
| 279 } | 280 } |
| OLD | NEW |