OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "app/gfx/gtk_util.h" | 7 #include "app/gfx/gtk_util.h" |
8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
10 #include "chrome/common/gtk_tree.h" | 10 #include "chrome/common/gtk_tree.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 | 149 |
150 void PasswordsPageGtk::SetPasswordList( | 150 void PasswordsPageGtk::SetPasswordList( |
151 const std::vector<webkit_glue::PasswordForm*>& result) { | 151 const std::vector<webkit_glue::PasswordForm*>& result) { |
152 std::wstring languages = | 152 std::wstring languages = |
153 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages); | 153 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages); |
154 gtk_list_store_clear(password_list_store_); | 154 gtk_list_store_clear(password_list_store_); |
155 password_list_.resize(result.size()); | 155 password_list_.resize(result.size()); |
156 for (size_t i = 0; i < result.size(); ++i) { | 156 for (size_t i = 0; i < result.size(); ++i) { |
157 password_list_[i] = *result[i]; | 157 password_list_[i] = *result[i]; |
158 std::wstring formatted = net::FormatUrl(result[i]->origin, languages, | 158 std::wstring formatted = net::FormatUrl(result[i]->origin, languages, |
159 false, UnescapeRule::NONE, | 159 false, UnescapeRule::NONE, NULL, NULL, NULL); |
160 NULL, NULL); | |
161 std::string site = WideToUTF8(formatted); | 160 std::string site = WideToUTF8(formatted); |
162 std::string user = UTF16ToUTF8(result[i]->username_value); | 161 std::string user = UTF16ToUTF8(result[i]->username_value); |
163 GtkTreeIter iter; | 162 GtkTreeIter iter; |
164 gtk_list_store_insert_with_values(password_list_store_, &iter, (gint) i, | 163 gtk_list_store_insert_with_values(password_list_store_, &iter, (gint) i, |
165 COL_SITE, site.c_str(), | 164 COL_SITE, site.c_str(), |
166 COL_USERNAME, user.c_str(), -1); | 165 COL_USERNAME, user.c_str(), -1); |
167 } | 166 } |
168 gtk_widget_set_sensitive(remove_all_button_, result.size() > 0); | 167 gtk_widget_set_sensitive(remove_all_button_, result.size() > 0); |
169 } | 168 } |
170 | 169 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 PasswordStore* store = page_->GetPasswordStore(); | 316 PasswordStore* store = page_->GetPasswordStore(); |
318 pending_login_query_ = store->GetAutofillableLogins(this); | 317 pending_login_query_ = store->GetAutofillableLogins(this); |
319 } | 318 } |
320 | 319 |
321 void PasswordsPageGtk::PasswordListPopulater::OnPasswordStoreRequestDone( | 320 void PasswordsPageGtk::PasswordListPopulater::OnPasswordStoreRequestDone( |
322 int handle, const std::vector<webkit_glue::PasswordForm*>& result) { | 321 int handle, const std::vector<webkit_glue::PasswordForm*>& result) { |
323 DCHECK_EQ(pending_login_query_, handle); | 322 DCHECK_EQ(pending_login_query_, handle); |
324 pending_login_query_ = 0; | 323 pending_login_query_ = 0; |
325 page_->SetPasswordList(result); | 324 page_->SetPasswordList(result); |
326 } | 325 } |
OLD | NEW |