OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/views/bookmark_context_menu.h" | 5 #include "chrome/browser/views/bookmark_context_menu.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/i18n/rtl.h" | 8 #include "base/i18n/rtl.h" |
9 #include "chrome/browser/profile.h" | 9 #include "chrome/browser/profile.h" |
| 10 #include "chrome/common/notification_service.h" |
10 #include "grit/generated_resources.h" | 11 #include "grit/generated_resources.h" |
11 #include "views/controls/menu/menu_item_view.h" | 12 #include "views/controls/menu/menu_item_view.h" |
12 | 13 |
13 //////////////////////////////////////////////////////////////////////////////// | 14 //////////////////////////////////////////////////////////////////////////////// |
14 // BookmarkContextMenu, public: | 15 // BookmarkContextMenu, public: |
15 | 16 |
16 BookmarkContextMenu::BookmarkContextMenu( | 17 BookmarkContextMenu::BookmarkContextMenu( |
17 gfx::NativeWindow parent_window, | 18 gfx::NativeWindow parent_window, |
18 Profile* profile, | 19 Profile* profile, |
19 PageNavigator* page_navigator, | 20 PageNavigator* page_navigator, |
20 const BookmarkNode* parent, | 21 const BookmarkNode* parent, |
21 const std::vector<const BookmarkNode*>& selection, | 22 const std::vector<const BookmarkNode*>& selection, |
22 BookmarkContextMenuControllerViews::ConfigurationType configuration) | 23 BookmarkContextMenuControllerViews::ConfigurationType configuration) |
23 : ALLOW_THIS_IN_INITIALIZER_LIST( | 24 : ALLOW_THIS_IN_INITIALIZER_LIST( |
24 controller_(new BookmarkContextMenuControllerViews(parent_window, this
, | 25 controller_(new BookmarkContextMenuControllerViews(parent_window, this
, |
25 profile, page_navigator, | 26 profile, page_navigator, |
26 parent, selection, | 27 parent, selection, |
27 configuration))), | 28 configuration))), |
28 parent_window_(parent_window), | 29 parent_window_(parent_window), |
29 ALLOW_THIS_IN_INITIALIZER_LIST(menu_(new views::MenuItemView(this))), | 30 ALLOW_THIS_IN_INITIALIZER_LIST(menu_(new views::MenuItemView(this))), |
30 observer_(NULL) { | 31 observer_(NULL) { |
31 controller_->BuildMenu(); | 32 controller_->BuildMenu(); |
32 } | 33 } |
33 | 34 |
34 BookmarkContextMenu::~BookmarkContextMenu() { | 35 BookmarkContextMenu::~BookmarkContextMenu() { |
35 } | 36 } |
36 | 37 |
37 void BookmarkContextMenu::RunMenuAt(const gfx::Point& point) { | 38 void BookmarkContextMenu::RunMenuAt(const gfx::Point& point) { |
| 39 NotificationService::current()->Notify( |
| 40 NotificationType::BOOKMARK_CONTEXT_MENU_SHOWN, |
| 41 Source<BookmarkContextMenu>(this), |
| 42 NotificationService::NoDetails()); |
38 // width/height don't matter here. | 43 // width/height don't matter here. |
39 views::MenuItemView::AnchorPosition anchor = base::i18n::IsRTL() ? | 44 views::MenuItemView::AnchorPosition anchor = base::i18n::IsRTL() ? |
40 views::MenuItemView::TOPRIGHT : views::MenuItemView::TOPLEFT; | 45 views::MenuItemView::TOPRIGHT : views::MenuItemView::TOPLEFT; |
41 menu_->RunMenuAt(parent_window_, NULL, gfx::Rect(point.x(), point.y(), 0, 0), | 46 menu_->RunMenuAt(parent_window_, NULL, gfx::Rect(point.x(), point.y(), 0, 0), |
42 anchor, true); | 47 anchor, true); |
43 } | 48 } |
44 | 49 |
45 //////////////////////////////////////////////////////////////////////////////// | 50 //////////////////////////////////////////////////////////////////////////////// |
46 // BookmarkContextMenu, views::MenuDelegate implementation: | 51 // BookmarkContextMenu, views::MenuDelegate implementation: |
47 | 52 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 void BookmarkContextMenu::WillRemoveBookmarks( | 94 void BookmarkContextMenu::WillRemoveBookmarks( |
90 const std::vector<const BookmarkNode*>& bookmarks) { | 95 const std::vector<const BookmarkNode*>& bookmarks) { |
91 if (observer_) | 96 if (observer_) |
92 observer_->WillRemoveBookmarks(bookmarks); | 97 observer_->WillRemoveBookmarks(bookmarks); |
93 } | 98 } |
94 | 99 |
95 void BookmarkContextMenu::DidRemoveBookmarks() { | 100 void BookmarkContextMenu::DidRemoveBookmarks() { |
96 if (observer_) | 101 if (observer_) |
97 observer_->DidRemoveBookmarks(); | 102 observer_->DidRemoveBookmarks(); |
98 } | 103 } |
OLD | NEW |