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/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/utf_string_conversions.h" | 8 #include "base/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" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/common/chrome_notification_types.h" |
12 #include "content/common/notification_service.h" | 13 #include "content/common/notification_service.h" |
13 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
14 #include "ui/base/l10n/l10n_util.h" | 15 #include "ui/base/l10n/l10n_util.h" |
15 #include "views/controls/menu/menu_item_view.h" | 16 #include "views/controls/menu/menu_item_view.h" |
16 | 17 |
17 //////////////////////////////////////////////////////////////////////////////// | 18 //////////////////////////////////////////////////////////////////////////////// |
18 // BookmarkContextMenu, public: | 19 // BookmarkContextMenu, public: |
19 | 20 |
20 BookmarkContextMenu::BookmarkContextMenu( | 21 BookmarkContextMenu::BookmarkContextMenu( |
21 gfx::NativeWindow parent_window, | 22 gfx::NativeWindow parent_window, |
(...skipping 11 matching lines...) Expand all Loading... |
33 observer_(NULL), | 34 observer_(NULL), |
34 close_on_remove_(close_on_remove) { | 35 close_on_remove_(close_on_remove) { |
35 controller_->BuildMenu(); | 36 controller_->BuildMenu(); |
36 } | 37 } |
37 | 38 |
38 BookmarkContextMenu::~BookmarkContextMenu() { | 39 BookmarkContextMenu::~BookmarkContextMenu() { |
39 } | 40 } |
40 | 41 |
41 void BookmarkContextMenu::RunMenuAt(const gfx::Point& point) { | 42 void BookmarkContextMenu::RunMenuAt(const gfx::Point& point) { |
42 NotificationService::current()->Notify( | 43 NotificationService::current()->Notify( |
43 NotificationType::BOOKMARK_CONTEXT_MENU_SHOWN, | 44 chrome::NOTIFICATION_BOOKMARK_CONTEXT_MENU_SHOWN, |
44 Source<BookmarkContextMenu>(this), | 45 Source<BookmarkContextMenu>(this), |
45 NotificationService::NoDetails()); | 46 NotificationService::NoDetails()); |
46 // width/height don't matter here. | 47 // width/height don't matter here. |
47 views::MenuItemView::AnchorPosition anchor = base::i18n::IsRTL() ? | 48 views::MenuItemView::AnchorPosition anchor = base::i18n::IsRTL() ? |
48 views::MenuItemView::TOPRIGHT : views::MenuItemView::TOPLEFT; | 49 views::MenuItemView::TOPRIGHT : views::MenuItemView::TOPLEFT; |
49 menu_->RunMenuAt(parent_window_, NULL, gfx::Rect(point.x(), point.y(), 0, 0), | 50 menu_->RunMenuAt(parent_window_, NULL, gfx::Rect(point.x(), point.y(), 0, 0), |
50 anchor, true); | 51 anchor, true); |
51 } | 52 } |
52 | 53 |
53 //////////////////////////////////////////////////////////////////////////////// | 54 //////////////////////////////////////////////////////////////////////////////// |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 void BookmarkContextMenu::WillRemoveBookmarks( | 96 void BookmarkContextMenu::WillRemoveBookmarks( |
96 const std::vector<const BookmarkNode*>& bookmarks) { | 97 const std::vector<const BookmarkNode*>& bookmarks) { |
97 if (observer_) | 98 if (observer_) |
98 observer_->WillRemoveBookmarks(bookmarks); | 99 observer_->WillRemoveBookmarks(bookmarks); |
99 } | 100 } |
100 | 101 |
101 void BookmarkContextMenu::DidRemoveBookmarks() { | 102 void BookmarkContextMenu::DidRemoveBookmarks() { |
102 if (observer_) | 103 if (observer_) |
103 observer_->DidRemoveBookmarks(); | 104 observer_->DidRemoveBookmarks(); |
104 } | 105 } |
OLD | NEW |