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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 case IDC_BOOKMARK_BAR_REMOVE: | 270 case IDC_BOOKMARK_BAR_REMOVE: |
271 return !selection_.empty() && !is_root_node && can_edit; | 271 return !selection_.empty() && !is_root_node && can_edit; |
272 | 272 |
273 case IDC_BOOKMARK_BAR_NEW_FOLDER: | 273 case IDC_BOOKMARK_BAR_NEW_FOLDER: |
274 case IDC_BOOKMARK_BAR_ADD_NEW_BOOKMARK: | 274 case IDC_BOOKMARK_BAR_ADD_NEW_BOOKMARK: |
275 return can_edit && bookmark_utils::GetParentForNewNodes( | 275 return can_edit && bookmark_utils::GetParentForNewNodes( |
276 parent_, selection_, NULL) != NULL; | 276 parent_, selection_, NULL) != NULL; |
277 | 277 |
278 case IDC_BOOKMARK_BAR_ALWAYS_SHOW: | 278 case IDC_BOOKMARK_BAR_ALWAYS_SHOW: |
279 return !profile_->GetPrefs()->IsManagedPreference( | 279 return !profile_->GetPrefs()->IsManagedPreference( |
280 prefs::kEnableBookmarkBar); | 280 prefs::kShowBookmarkBar); |
281 | 281 |
282 case IDC_COPY: | 282 case IDC_COPY: |
283 case IDC_CUT: | 283 case IDC_CUT: |
284 return !selection_.empty() && !is_root_node && | 284 return !selection_.empty() && !is_root_node && |
285 (command_id == IDC_COPY || can_edit); | 285 (command_id == IDC_COPY || can_edit); |
286 | 286 |
287 case IDC_PASTE: | 287 case IDC_PASTE: |
288 // Paste to selection from the Bookmark Bar, to parent_ everywhere else | 288 // Paste to selection from the Bookmark Bar, to parent_ everywhere else |
289 return can_edit && | 289 return can_edit && |
290 ((!selection_.empty() && | 290 ((!selection_.empty() && |
(...skipping 14 matching lines...) Expand all Loading... |
305 delegate_->CloseMenu(); | 305 delegate_->CloseMenu(); |
306 } | 306 } |
307 | 307 |
308 bool BookmarkContextMenuController::HasURLs() const { | 308 bool BookmarkContextMenuController::HasURLs() const { |
309 for (size_t i = 0; i < selection_.size(); ++i) { | 309 for (size_t i = 0; i < selection_.size(); ++i) { |
310 if (bookmark_utils::NodeHasURLs(selection_[i])) | 310 if (bookmark_utils::NodeHasURLs(selection_[i])) |
311 return true; | 311 return true; |
312 } | 312 } |
313 return false; | 313 return false; |
314 } | 314 } |
OLD | NEW |