OLD | NEW |
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/bookmarks/bookmark_context_menu_controller.h" | 5 #include "chrome/browser/bookmarks/bookmark_context_menu_controller.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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 case IDC_BOOKMARK_BAR_REMOVE: | 262 case IDC_BOOKMARK_BAR_REMOVE: |
263 return !selection_.empty() && !is_root_node; | 263 return !selection_.empty() && !is_root_node; |
264 | 264 |
265 case IDC_BOOKMARK_BAR_NEW_FOLDER: | 265 case IDC_BOOKMARK_BAR_NEW_FOLDER: |
266 case IDC_BOOKMARK_BAR_ADD_NEW_BOOKMARK: | 266 case IDC_BOOKMARK_BAR_ADD_NEW_BOOKMARK: |
267 return bookmark_utils::GetParentForNewNodes( | 267 return bookmark_utils::GetParentForNewNodes( |
268 parent_, selection_, NULL) != NULL; | 268 parent_, selection_, NULL) != NULL; |
269 | 269 |
270 case IDC_COPY: | 270 case IDC_COPY: |
271 case IDC_CUT: | 271 case IDC_CUT: |
272 return selection_.size() > 0 && !is_root_node; | 272 return !selection_.empty() && !is_root_node; |
273 | 273 |
274 case IDC_PASTE: | 274 case IDC_PASTE: |
275 // Paste to selection from the Bookmark Bar, to parent_ everywhere else | 275 // Paste to selection from the Bookmark Bar, to parent_ everywhere else |
276 return (!selection_.empty() && | 276 return (!selection_.empty() && |
277 bookmark_utils::CanPasteFromClipboard(selection_[0])) || | 277 bookmark_utils::CanPasteFromClipboard(selection_[0])) || |
278 bookmark_utils::CanPasteFromClipboard(parent_); | 278 bookmark_utils::CanPasteFromClipboard(parent_); |
279 } | 279 } |
280 return true; | 280 return true; |
281 } | 281 } |
282 | 282 |
283 bool BookmarkContextMenuController::GetAcceleratorForCommandId( | 283 bool BookmarkContextMenuController::GetAcceleratorForCommandId( |
284 int command_id, | 284 int command_id, |
285 ui::Accelerator* accelerator) { | 285 ui::Accelerator* accelerator) { |
286 return false; | 286 return false; |
287 } | 287 } |
288 | 288 |
289 void BookmarkContextMenuController::BookmarkModelChanged() { | 289 void BookmarkContextMenuController::BookmarkModelChanged() { |
290 if (delegate_) | 290 if (delegate_) |
291 delegate_->CloseMenu(); | 291 delegate_->CloseMenu(); |
292 } | 292 } |
293 | 293 |
294 bool BookmarkContextMenuController::HasURLs() const { | 294 bool BookmarkContextMenuController::HasURLs() const { |
295 for (size_t i = 0; i < selection_.size(); ++i) { | 295 for (size_t i = 0; i < selection_.size(); ++i) { |
296 if (bookmark_utils::NodeHasURLs(selection_[i])) | 296 if (bookmark_utils::NodeHasURLs(selection_[i])) |
297 return true; | 297 return true; |
298 } | 298 } |
299 return false; | 299 return false; |
300 } | 300 } |
OLD | NEW |