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

Side by Side Diff: chrome/browser/ui/gtk/options/passwords_page_gtk.cc

Issue 6609008: Change other usages of .size() to .empty() when applicable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Peter nits Created 9 years, 9 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) 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/options/passwords_page_gtk.h" 5 #include "chrome/browser/ui/gtk/options/passwords_page_gtk.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/stl_util-inl.h" 9 #include "base/stl_util-inl.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 gtk_list_store_clear(password_list_store_); 158 gtk_list_store_clear(password_list_store_);
159 STLDeleteElements(&password_list_); 159 STLDeleteElements(&password_list_);
160 password_list_ = result; 160 password_list_ = result;
161 for (size_t i = 0; i < result.size(); ++i) { 161 for (size_t i = 0; i < result.size(); ++i) {
162 GtkTreeIter iter; 162 GtkTreeIter iter;
163 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,
164 COL_SITE, 164 COL_SITE,
165 UTF16ToUTF8(net::FormatUrl(result[i]->origin, languages)).c_str(), 165 UTF16ToUTF8(net::FormatUrl(result[i]->origin, languages)).c_str(),
166 COL_USERNAME, UTF16ToUTF8(result[i]->username_value).c_str(), -1); 166 COL_USERNAME, UTF16ToUTF8(result[i]->username_value).c_str(), -1);
167 } 167 }
168 gtk_widget_set_sensitive(remove_all_button_, result.size() > 0); 168 gtk_widget_set_sensitive(remove_all_button_, !result.empty());
169 } 169 }
170 170
171 void PasswordsPageGtk::HidePassword() { 171 void PasswordsPageGtk::HidePassword() {
172 password_showing_ = false; 172 password_showing_ = false;
173 gtk_label_set_text(GTK_LABEL(password_), ""); 173 gtk_label_set_text(GTK_LABEL(password_), "");
174 gtk_button_set_label(GTK_BUTTON(show_password_button_), 174 gtk_button_set_label(GTK_BUTTON(show_password_button_),
175 l10n_util::GetStringUTF8(IDS_PASSWORDS_PAGE_VIEW_SHOW_BUTTON).c_str()); 175 l10n_util::GetStringUTF8(IDS_PASSWORDS_PAGE_VIEW_SHOW_BUTTON).c_str());
176 } 176 }
177 177
178 void PasswordsPageGtk::Observe(NotificationType type, 178 void PasswordsPageGtk::Observe(NotificationType type,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 GtkTreeIter child_iter; 215 GtkTreeIter child_iter;
216 gtk_tree_model_sort_convert_iter_to_child_iter( 216 gtk_tree_model_sort_convert_iter_to_child_iter(
217 GTK_TREE_MODEL_SORT(password_list_sort_), &child_iter, &iter); 217 GTK_TREE_MODEL_SORT(password_list_sort_), &child_iter, &iter);
218 218
219 // Remove from GTK list, DB, and vector. 219 // Remove from GTK list, DB, and vector.
220 gtk_list_store_remove(password_list_store_, &child_iter); 220 gtk_list_store_remove(password_list_store_, &child_iter);
221 GetPasswordStore()->RemoveLogin(*password_list_[index]); 221 GetPasswordStore()->RemoveLogin(*password_list_[index]);
222 delete password_list_[index]; 222 delete password_list_[index];
223 password_list_.erase(password_list_.begin() + index); 223 password_list_.erase(password_list_.begin() + index);
224 224
225 gtk_widget_set_sensitive(remove_all_button_, password_list_.size() > 0); 225 gtk_widget_set_sensitive(remove_all_button_, !password_list_.empty());
226 } 226 }
227 227
228 void PasswordsPageGtk::OnRemoveAllButtonClicked(GtkWidget* widget) { 228 void PasswordsPageGtk::OnRemoveAllButtonClicked(GtkWidget* widget) {
229 GtkWindow* window = GTK_WINDOW(gtk_widget_get_toplevel(page_)); 229 GtkWindow* window = GTK_WINDOW(gtk_widget_get_toplevel(page_));
230 GtkWidget* confirm = gtk_message_dialog_new( 230 GtkWidget* confirm = gtk_message_dialog_new(
231 window, 231 window,
232 static_cast<GtkDialogFlags>( 232 static_cast<GtkDialogFlags>(
233 GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT), 233 GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
234 GTK_MESSAGE_QUESTION, 234 GTK_MESSAGE_QUESTION,
235 GTK_BUTTONS_YES_NO, 235 GTK_BUTTONS_YES_NO,
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 else 358 else
359 LOG(ERROR) << "No password store! Cannot display passwords."; 359 LOG(ERROR) << "No password store! Cannot display passwords.";
360 } 360 }
361 361
362 void PasswordsPageGtk::PasswordListPopulater::OnPasswordStoreRequestDone( 362 void PasswordsPageGtk::PasswordListPopulater::OnPasswordStoreRequestDone(
363 int handle, const std::vector<webkit_glue::PasswordForm*>& result) { 363 int handle, const std::vector<webkit_glue::PasswordForm*>& result) {
364 DCHECK_EQ(pending_login_query_, handle); 364 DCHECK_EQ(pending_login_query_, handle);
365 pending_login_query_ = 0; 365 pending_login_query_ = 0;
366 page_->SetPasswordList(result); 366 page_->SetPasswordList(result);
367 } 367 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/options/passwords_exceptions_page_gtk.cc ('k') | chrome/browser/ui/gtk/rounded_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698