OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <gtk/gtk.h> | 5 #include <gtk/gtk.h> |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/gtk/accessible_widget_helper_gtk.h" | 10 #include "chrome/browser/gtk/accessible_widget_helper_gtk.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 // trailing slash, and unescape most characters, but we need to not drop any | 201 // trailing slash, and unescape most characters, but we need to not drop any |
202 // username/password, or unescape anything that changes the meaning. | 202 // username/password, or unescape anything that changes the meaning. |
203 return UTF16ToUTF8(net::FormatUrl(url_table_model_->GetURL(row), | 203 return UTF16ToUTF8(net::FormatUrl(url_table_model_->GetURL(row), |
204 languages, net::kFormatUrlOmitAll & ~net::kFormatUrlOmitUsernamePassword, | 204 languages, net::kFormatUrlOmitAll & ~net::kFormatUrlOmitUsernamePassword, |
205 UnescapeRule::SPACES, NULL, NULL, NULL)); | 205 UnescapeRule::SPACES, NULL, NULL, NULL)); |
206 } | 206 } |
207 | 207 |
208 void UrlPickerDialogGtk::SetColumnValues(int row, GtkTreeIter* iter) { | 208 void UrlPickerDialogGtk::SetColumnValues(int row, GtkTreeIter* iter) { |
209 SkBitmap bitmap = url_table_model_->GetIcon(row); | 209 SkBitmap bitmap = url_table_model_->GetIcon(row); |
210 GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(&bitmap); | 210 GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(&bitmap); |
211 std::wstring title = url_table_model_->GetText(row, IDS_ASI_PAGE_COLUMN); | 211 string16 title = url_table_model_->GetText(row, IDS_ASI_PAGE_COLUMN); |
212 std::wstring url = url_table_model_->GetText(row, IDS_ASI_URL_COLUMN); | 212 string16 url = url_table_model_->GetText(row, IDS_ASI_URL_COLUMN); |
213 gtk_list_store_set(history_list_store_, iter, | 213 gtk_list_store_set(history_list_store_, iter, |
214 COL_FAVICON, pixbuf, | 214 COL_FAVICON, pixbuf, |
215 COL_TITLE, WideToUTF8(title).c_str(), | 215 COL_TITLE, UTF16ToUTF8(title).c_str(), |
216 COL_DISPLAY_URL, WideToUTF8(url).c_str(), | 216 COL_DISPLAY_URL, UTF16ToUTF8(url).c_str(), |
217 -1); | 217 -1); |
218 g_object_unref(pixbuf); | 218 g_object_unref(pixbuf); |
219 } | 219 } |
220 | 220 |
221 // static | 221 // static |
222 gint UrlPickerDialogGtk::CompareTitle(GtkTreeModel* model, | 222 gint UrlPickerDialogGtk::CompareTitle(GtkTreeModel* model, |
223 GtkTreeIter* a, | 223 GtkTreeIter* a, |
224 GtkTreeIter* b, | 224 GtkTreeIter* b, |
225 gpointer window) { | 225 gpointer window) { |
226 int row1 = gtk_tree::GetRowNumForIter(model, a); | 226 int row1 = gtk_tree::GetRowNumForIter(model, a); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 | 267 |
268 void UrlPickerDialogGtk::OnResponse(GtkWidget* dialog, int response_id) { | 268 void UrlPickerDialogGtk::OnResponse(GtkWidget* dialog, int response_id) { |
269 if (response_id == GTK_RESPONSE_OK) | 269 if (response_id == GTK_RESPONSE_OK) |
270 AddURL(); | 270 AddURL(); |
271 gtk_widget_destroy(dialog_); | 271 gtk_widget_destroy(dialog_); |
272 } | 272 } |
273 | 273 |
274 void UrlPickerDialogGtk::OnWindowDestroy(GtkWidget* widget) { | 274 void UrlPickerDialogGtk::OnWindowDestroy(GtkWidget* widget) { |
275 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 275 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
276 } | 276 } |
OLD | NEW |