| 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/bookmarks/bookmark_model.h" | 10 #include "chrome/browser/bookmarks/bookmark_model.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 } | 60 } |
| 61 | 61 |
| 62 void BookmarkContextMenu::RunMenuAt(const gfx::Point& point, | 62 void BookmarkContextMenu::RunMenuAt(const gfx::Point& point, |
| 63 ui::MenuSourceType source_type) { | 63 ui::MenuSourceType source_type) { |
| 64 content::NotificationService::current()->Notify( | 64 content::NotificationService::current()->Notify( |
| 65 chrome::NOTIFICATION_BOOKMARK_CONTEXT_MENU_SHOWN, | 65 chrome::NOTIFICATION_BOOKMARK_CONTEXT_MENU_SHOWN, |
| 66 content::Source<BookmarkContextMenu>(this), | 66 content::Source<BookmarkContextMenu>(this), |
| 67 content::NotificationService::NoDetails()); | 67 content::NotificationService::NoDetails()); |
| 68 // width/height don't matter here. | 68 // width/height don't matter here. |
| 69 if (menu_runner_->RunMenuAt( | 69 if (menu_runner_->RunMenuAt( |
| 70 parent_widget_, NULL, gfx::Rect(point.x(), point.y(), 0, 0), | 70 parent_widget_, |
| 71 views::MenuItemView::TOPLEFT, source_type, | 71 NULL, |
| 72 gfx::Rect(point.x(), point.y(), 0, 0), |
| 73 ui::MENU_ANCHOR_TOPLEFT, |
| 74 source_type, |
| 72 (views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::IS_NESTED | | 75 (views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::IS_NESTED | |
| 73 views::MenuRunner::CONTEXT_MENU)) == | 76 views::MenuRunner::CONTEXT_MENU)) == |
| 74 views::MenuRunner::MENU_DELETED) | 77 views::MenuRunner::MENU_DELETED) { |
| 75 return; | 78 return; |
| 79 } |
| 76 } | 80 } |
| 77 | 81 |
| 78 void BookmarkContextMenu::SetPageNavigator(PageNavigator* navigator) { | 82 void BookmarkContextMenu::SetPageNavigator(PageNavigator* navigator) { |
| 79 controller_->set_navigator(navigator); | 83 controller_->set_navigator(navigator); |
| 80 } | 84 } |
| 81 | 85 |
| 82 //////////////////////////////////////////////////////////////////////////////// | 86 //////////////////////////////////////////////////////////////////////////////// |
| 83 // BookmarkContextMenu, views::MenuDelegate implementation: | 87 // BookmarkContextMenu, views::MenuDelegate implementation: |
| 84 | 88 |
| 85 void BookmarkContextMenu::ExecuteCommand(int command_id, int event_flags) { | 89 void BookmarkContextMenu::ExecuteCommand(int command_id, int event_flags) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 110 int command_id, | 114 int command_id, |
| 111 const std::vector<const BookmarkNode*>& bookmarks) { | 115 const std::vector<const BookmarkNode*>& bookmarks) { |
| 112 if (observer_ && IsRemoveBookmarksCommand(command_id)) | 116 if (observer_ && IsRemoveBookmarksCommand(command_id)) |
| 113 observer_->WillRemoveBookmarks(bookmarks); | 117 observer_->WillRemoveBookmarks(bookmarks); |
| 114 } | 118 } |
| 115 | 119 |
| 116 void BookmarkContextMenu::DidExecuteCommand(int command_id) { | 120 void BookmarkContextMenu::DidExecuteCommand(int command_id) { |
| 117 if (observer_ && IsRemoveBookmarksCommand(command_id)) | 121 if (observer_ && IsRemoveBookmarksCommand(command_id)) |
| 118 observer_->DidRemoveBookmarks(); | 122 observer_->DidRemoveBookmarks(); |
| 119 } | 123 } |
| OLD | NEW |