OLD | NEW |
1 // Copyright (c) 2009 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 "chrome/browser/gtk/options/passwords_page_gtk.h" | 5 #include "chrome/browser/gtk/options/passwords_page_gtk.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "app/gtk_util.h" | 9 #include "app/gtk_util.h" |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
11 #include "app/resource_bundle.h" | 11 #include "app/resource_bundle.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 153 |
154 void PasswordsPageGtk::SetPasswordList( | 154 void PasswordsPageGtk::SetPasswordList( |
155 const std::vector<webkit_glue::PasswordForm*>& result) { | 155 const std::vector<webkit_glue::PasswordForm*>& result) { |
156 std::wstring languages = | 156 std::wstring languages = |
157 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages); | 157 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages); |
158 gtk_list_store_clear(password_list_store_); | 158 gtk_list_store_clear(password_list_store_); |
159 password_list_.resize(result.size()); | 159 password_list_.resize(result.size()); |
160 for (size_t i = 0; i < result.size(); ++i) { | 160 for (size_t i = 0; i < result.size(); ++i) { |
161 password_list_[i] = *result[i]; | 161 password_list_[i] = *result[i]; |
162 std::wstring formatted = net::FormatUrl(result[i]->origin, languages, | 162 std::wstring formatted = net::FormatUrl(result[i]->origin, languages, |
163 false, UnescapeRule::NONE, NULL, NULL, NULL); | 163 net::kFormatUrlOmitAll, UnescapeRule::NONE, NULL, NULL, NULL); |
164 std::string site = WideToUTF8(formatted); | 164 std::string site = WideToUTF8(formatted); |
165 std::string user = UTF16ToUTF8(result[i]->username_value); | 165 std::string user = UTF16ToUTF8(result[i]->username_value); |
166 GtkTreeIter iter; | 166 GtkTreeIter iter; |
167 gtk_list_store_insert_with_values(password_list_store_, &iter, (gint) i, | 167 gtk_list_store_insert_with_values(password_list_store_, &iter, (gint) i, |
168 COL_SITE, site.c_str(), | 168 COL_SITE, site.c_str(), |
169 COL_USERNAME, user.c_str(), -1); | 169 COL_USERNAME, user.c_str(), -1); |
170 } | 170 } |
171 gtk_widget_set_sensitive(remove_all_button_, result.size() > 0); | 171 gtk_widget_set_sensitive(remove_all_button_, result.size() > 0); |
172 } | 172 } |
173 | 173 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 PasswordStore* store = page_->GetPasswordStore(); | 312 PasswordStore* store = page_->GetPasswordStore(); |
313 pending_login_query_ = store->GetAutofillableLogins(this); | 313 pending_login_query_ = store->GetAutofillableLogins(this); |
314 } | 314 } |
315 | 315 |
316 void PasswordsPageGtk::PasswordListPopulater::OnPasswordStoreRequestDone( | 316 void PasswordsPageGtk::PasswordListPopulater::OnPasswordStoreRequestDone( |
317 int handle, const std::vector<webkit_glue::PasswordForm*>& result) { | 317 int handle, const std::vector<webkit_glue::PasswordForm*>& result) { |
318 DCHECK_EQ(pending_login_query_, handle); | 318 DCHECK_EQ(pending_login_query_, handle); |
319 pending_login_query_ = 0; | 319 pending_login_query_ = 0; |
320 page_->SetPasswordList(result); | 320 page_->SetPasswordList(result); |
321 } | 321 } |
OLD | NEW |