Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(256)

Side by Side Diff: chrome/browser/gtk/edit_search_engine_dialog.cc

Issue 6322001: Remove wstring from TemplateURL and friends.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 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/gtk/edit_search_engine_dialog.h" 5 #include "chrome/browser/gtk/edit_search_engine_dialog.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "app/resource_bundle.h" 10 #include "app/resource_bundle.h"
11 #include "base/i18n/rtl.h" 11 #include "base/i18n/rtl.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "chrome/browser/gtk/accessible_widget_helper_gtk.h" 14 #include "chrome/browser/gtk/accessible_widget_helper_gtk.h"
15 #include "chrome/browser/gtk/gtk_util.h" 15 #include "chrome/browser/gtk/gtk_util.h"
16 #include "chrome/browser/net/url_fixer_upper.h" 16 #include "chrome/browser/net/url_fixer_upper.h"
17 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/search_engines/edit_search_engine_controller.h" 18 #include "chrome/browser/search_engines/edit_search_engine_controller.h"
19 #include "chrome/browser/search_engines/template_url.h" 19 #include "chrome/browser/search_engines/template_url.h"
20 #include "chrome/browser/search_engines/template_url_model.h" 20 #include "chrome/browser/search_engines/template_url_model.h"
21 #include "googleurl/src/gurl.h" 21 #include "googleurl/src/gurl.h"
22 #include "grit/app_resources.h" 22 #include "grit/app_resources.h"
23 #include "grit/generated_resources.h" 23 #include "grit/generated_resources.h"
24 #include "grit/theme_resources.h" 24 #include "grit/theme_resources.h"
25 25
26 namespace { 26 namespace {
27 27
28 std::string GetDisplayURL(const TemplateURL& turl) { 28 std::string GetDisplayURL(const TemplateURL& turl) {
29 return turl.url() ? WideToUTF8(turl.url()->DisplayURL()) : std::string(); 29 return turl.url() ? UTF16ToUTF8(turl.url()->DisplayURL()) : std::string();
30 } 30 }
31 31
32 // Forces text to lowercase when connected to an editable's "insert-text" 32 // Forces text to lowercase when connected to an editable's "insert-text"
33 // signal. (Like views Textfield::STYLE_LOWERCASE.) 33 // signal. (Like views Textfield::STYLE_LOWERCASE.)
34 void LowercaseInsertTextHandler(GtkEditable *editable, const gchar *text, 34 void LowercaseInsertTextHandler(GtkEditable *editable, const gchar *text,
35 gint length, gint *position, gpointer data) { 35 gint length, gint *position, gpointer data) {
36 string16 original_text = UTF8ToUTF16(text); 36 string16 original_text = UTF8ToUTF16(text);
37 string16 lower_text = l10n_util::ToLower(original_text); 37 string16 lower_text = l10n_util::ToLower(original_text);
38 if (lower_text != original_text) { 38 if (lower_text != original_text) {
39 std::string result = UTF16ToUTF8(lower_text); 39 std::string result = UTF16ToUTF8(lower_text);
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 url_entry_, 151 url_entry_,
152 IDS_SEARCH_ENGINES_EDITOR_URL_LABEL); 152 IDS_SEARCH_ENGINES_EDITOR_URL_LABEL);
153 153
154 title_image_ = gtk_image_new_from_pixbuf(NULL); 154 title_image_ = gtk_image_new_from_pixbuf(NULL);
155 keyword_image_ = gtk_image_new_from_pixbuf(NULL); 155 keyword_image_ = gtk_image_new_from_pixbuf(NULL);
156 url_image_ = gtk_image_new_from_pixbuf(NULL); 156 url_image_ = gtk_image_new_from_pixbuf(NULL);
157 157
158 if (controller_->template_url()) { 158 if (controller_->template_url()) {
159 gtk_entry_set_text( 159 gtk_entry_set_text(
160 GTK_ENTRY(title_entry_), 160 GTK_ENTRY(title_entry_),
161 WideToUTF8(controller_->template_url()->short_name()).c_str()); 161 UTF16ToUTF8(controller_->template_url()->short_name()).c_str());
162 gtk_entry_set_text( 162 gtk_entry_set_text(
163 GTK_ENTRY(keyword_entry_), 163 GTK_ENTRY(keyword_entry_),
164 WideToUTF8(controller_->template_url()->keyword()).c_str()); 164 UTF16ToUTF8(controller_->template_url()->keyword()).c_str());
165 gtk_entry_set_text( 165 gtk_entry_set_text(
166 GTK_ENTRY(url_entry_), 166 GTK_ENTRY(url_entry_),
167 GetDisplayURL(*controller_->template_url()).c_str()); 167 GetDisplayURL(*controller_->template_url()).c_str());
168 // We don't allow users to edit prepopulated URLs. 168 // We don't allow users to edit prepopulated URLs.
169 gtk_editable_set_editable( 169 gtk_editable_set_editable(
170 GTK_EDITABLE(url_entry_), 170 GTK_EDITABLE(url_entry_),
171 controller_->template_url()->prepopulate_id() == 0); 171 controller_->template_url()->prepopulate_id() == 0);
172 172
173 if (controller_->template_url()->prepopulate_id() != 0) { 173 if (controller_->template_url()->prepopulate_id() != 0) {
174 GtkWidget* fake_label = gtk_label_new("Fake label"); 174 GtkWidget* fake_label = gtk_label_new("Fake label");
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 GetURLInput()); 282 GetURLInput());
283 } else { 283 } else {
284 controller_->CleanUpCancelledAdd(); 284 controller_->CleanUpCancelledAdd();
285 } 285 }
286 gtk_widget_destroy(dialog_); 286 gtk_widget_destroy(dialog_);
287 } 287 }
288 288
289 void EditSearchEngineDialog::OnWindowDestroy(GtkWidget* widget) { 289 void EditSearchEngineDialog::OnWindowDestroy(GtkWidget* widget) {
290 MessageLoop::current()->DeleteSoon(FROM_HERE, this); 290 MessageLoop::current()->DeleteSoon(FROM_HERE, this);
291 } 291 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_omnibox_apitest.cc ('k') | chrome/browser/gtk/first_run_dialog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698