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

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_views.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/views/bookmarks/bookmark_context_menu_controller_vie ws.h" 5 #include "chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_vie ws.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "chrome/app/chrome_command_ids.h" 8 #include "chrome/app/chrome_command_ids.h"
9 #include "chrome/browser/bookmarks/bookmark_editor.h" 9 #include "chrome/browser/bookmarks/bookmark_editor.h"
10 #include "chrome/browser/bookmarks/bookmark_folder_editor_controller.h" 10 #include "chrome/browser/bookmarks/bookmark_folder_editor_controller.h"
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 case IDC_BOOKMARK_BAR_REMOVE: 249 case IDC_BOOKMARK_BAR_REMOVE:
250 return !selection_.empty() && !is_root_node; 250 return !selection_.empty() && !is_root_node;
251 251
252 case IDC_BOOKMARK_BAR_NEW_FOLDER: 252 case IDC_BOOKMARK_BAR_NEW_FOLDER:
253 case IDC_BOOKMARK_BAR_ADD_NEW_BOOKMARK: 253 case IDC_BOOKMARK_BAR_ADD_NEW_BOOKMARK:
254 return bookmark_utils::GetParentForNewNodes( 254 return bookmark_utils::GetParentForNewNodes(
255 parent_, selection_, NULL) != NULL; 255 parent_, selection_, NULL) != NULL;
256 256
257 case IDC_COPY: 257 case IDC_COPY:
258 case IDC_CUT: 258 case IDC_CUT:
259 return selection_.size() > 0 && !is_root_node; 259 return !selection_.empty() && !is_root_node;
260 260
261 case IDC_PASTE: 261 case IDC_PASTE:
262 // Paste to selection from the Bookmark Bar, to parent_ everywhere else 262 // Paste to selection from the Bookmark Bar, to parent_ everywhere else
263 return (!selection_.empty() && 263 return (!selection_.empty() &&
264 bookmark_utils::CanPasteFromClipboard(selection_[0])) || 264 bookmark_utils::CanPasteFromClipboard(selection_[0])) ||
265 bookmark_utils::CanPasteFromClipboard(parent_); 265 bookmark_utils::CanPasteFromClipboard(parent_);
266 } 266 }
267 return true; 267 return true;
268 } 268 }
269 269
270 void BookmarkContextMenuControllerViews::BookmarkModelChanged() { 270 void BookmarkContextMenuControllerViews::BookmarkModelChanged() {
271 delegate_->CloseMenu(); 271 delegate_->CloseMenu();
272 } 272 }
273 273
274 BookmarkModel* BookmarkContextMenuControllerViews::RemoveModelObserver() { 274 BookmarkModel* BookmarkContextMenuControllerViews::RemoveModelObserver() {
275 BookmarkModel* model = model_; 275 BookmarkModel* model = model_;
276 model_->RemoveObserver(this); 276 model_->RemoveObserver(this);
277 model_ = NULL; 277 model_ = NULL;
278 return model; 278 return model;
279 } 279 }
280 280
281 bool BookmarkContextMenuControllerViews::HasURLs() const { 281 bool BookmarkContextMenuControllerViews::HasURLs() const {
282 for (size_t i = 0; i < selection_.size(); ++i) { 282 for (size_t i = 0; i < selection_.size(); ++i) {
283 if (bookmark_utils::NodeHasURLs(selection_[i])) 283 if (bookmark_utils::NodeHasURLs(selection_[i]))
284 return true; 284 return true;
285 } 285 }
286 return false; 286 return false;
287 } 287 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/encoding_menu_controller_unittest.cc ('k') | chrome/browser/ui/views/download_shelf_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698