| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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.h" | 5 #include "chrome/browser/ui/views/bookmarks/bookmark_context_menu.h" |
| 6 | 6 |
| 7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| 11 #include "components/bookmarks/browser/bookmark_model.h" | 11 #include "components/bookmarks/browser/bookmark_model.h" |
| 12 #include "content/public/browser/notification_service.h" | 12 #include "content/public/browser/notification_service.h" |
| 13 #include "ui/views/controls/menu/menu_item_view.h" | 13 #include "ui/views/controls/menu/menu_item_view.h" |
| 14 #include "ui/views/controls/menu/menu_model_adapter.h" | 14 #include "ui/views/controls/menu/menu_model_adapter.h" |
| 15 #include "ui/views/controls/menu/menu_runner.h" | 15 #include "ui/views/controls/menu/menu_runner.h" |
| 16 #include "ui/views/widget/widget.h" | 16 #include "ui/views/widget/widget.h" |
| 17 | 17 |
| 18 using bookmarks::BookmarkNode; |
| 18 using content::PageNavigator; | 19 using content::PageNavigator; |
| 19 | 20 |
| 20 namespace { | 21 namespace { |
| 21 | 22 |
| 22 // Returns true if |command_id| corresponds to a command that causes one or more | 23 // Returns true if |command_id| corresponds to a command that causes one or more |
| 23 // bookmarks to be removed. | 24 // bookmarks to be removed. |
| 24 bool IsRemoveBookmarksCommand(int command_id) { | 25 bool IsRemoveBookmarksCommand(int command_id) { |
| 25 return command_id == IDC_CUT || command_id == IDC_BOOKMARK_BAR_REMOVE; | 26 return command_id == IDC_CUT || command_id == IDC_BOOKMARK_BAR_REMOVE; |
| 26 } | 27 } |
| 27 | 28 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 int command_id, | 115 int command_id, |
| 115 const std::vector<const BookmarkNode*>& bookmarks) { | 116 const std::vector<const BookmarkNode*>& bookmarks) { |
| 116 if (observer_ && IsRemoveBookmarksCommand(command_id)) | 117 if (observer_ && IsRemoveBookmarksCommand(command_id)) |
| 117 observer_->WillRemoveBookmarks(bookmarks); | 118 observer_->WillRemoveBookmarks(bookmarks); |
| 118 } | 119 } |
| 119 | 120 |
| 120 void BookmarkContextMenu::DidExecuteCommand(int command_id) { | 121 void BookmarkContextMenu::DidExecuteCommand(int command_id) { |
| 121 if (observer_ && IsRemoveBookmarksCommand(command_id)) | 122 if (observer_ && IsRemoveBookmarksCommand(command_id)) |
| 122 observer_->DidRemoveBookmarks(); | 123 observer_->DidRemoveBookmarks(); |
| 123 } | 124 } |
| OLD | NEW |