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 "chrome/common/chrome_notification_types.h" |
13 #include "content/common/notification_service.h" | 13 #include "content/public/browser/notification_service.h" |
14 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
15 #include "ui/base/l10n/l10n_util.h" | 15 #include "ui/base/l10n/l10n_util.h" |
16 #include "views/controls/menu/menu_item_view.h" | 16 #include "views/controls/menu/menu_item_view.h" |
17 #include "views/controls/menu/menu_runner.h" | 17 #include "views/controls/menu/menu_runner.h" |
18 #include "views/widget/widget.h" | 18 #include "views/widget/widget.h" |
19 | 19 |
20 //////////////////////////////////////////////////////////////////////////////// | 20 //////////////////////////////////////////////////////////////////////////////// |
21 // BookmarkContextMenu, public: | 21 // BookmarkContextMenu, public: |
22 | 22 |
23 BookmarkContextMenu::BookmarkContextMenu( | 23 BookmarkContextMenu::BookmarkContextMenu( |
(...skipping 12 matching lines...) Expand all Loading... |
36 parent_node_(parent), | 36 parent_node_(parent), |
37 observer_(NULL), | 37 observer_(NULL), |
38 close_on_remove_(close_on_remove) { | 38 close_on_remove_(close_on_remove) { |
39 controller_->BuildMenu(); | 39 controller_->BuildMenu(); |
40 } | 40 } |
41 | 41 |
42 BookmarkContextMenu::~BookmarkContextMenu() { | 42 BookmarkContextMenu::~BookmarkContextMenu() { |
43 } | 43 } |
44 | 44 |
45 void BookmarkContextMenu::RunMenuAt(const gfx::Point& point) { | 45 void BookmarkContextMenu::RunMenuAt(const gfx::Point& point) { |
46 NotificationService::current()->Notify( | 46 content::NotificationService::current()->Notify( |
47 chrome::NOTIFICATION_BOOKMARK_CONTEXT_MENU_SHOWN, | 47 chrome::NOTIFICATION_BOOKMARK_CONTEXT_MENU_SHOWN, |
48 content::Source<BookmarkContextMenu>(this), | 48 content::Source<BookmarkContextMenu>(this), |
49 NotificationService::NoDetails()); | 49 content::NotificationService::NoDetails()); |
50 // width/height don't matter here. | 50 // width/height don't matter here. |
51 if (menu_runner_->RunMenuAt( | 51 if (menu_runner_->RunMenuAt( |
52 parent_widget_, NULL, gfx::Rect(point.x(), point.y(), 0, 0), | 52 parent_widget_, NULL, gfx::Rect(point.x(), point.y(), 0, 0), |
53 views::MenuItemView::TOPLEFT, | 53 views::MenuItemView::TOPLEFT, |
54 (views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::IS_NESTED)) == | 54 (views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::IS_NESTED)) == |
55 views::MenuRunner::MENU_DELETED) | 55 views::MenuRunner::MENU_DELETED) |
56 return; | 56 return; |
57 } | 57 } |
58 | 58 |
59 void BookmarkContextMenu::SetPageNavigator(PageNavigator* navigator) { | 59 void BookmarkContextMenu::SetPageNavigator(PageNavigator* navigator) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 void BookmarkContextMenu::WillRemoveBookmarks( | 105 void BookmarkContextMenu::WillRemoveBookmarks( |
106 const std::vector<const BookmarkNode*>& bookmarks) { | 106 const std::vector<const BookmarkNode*>& bookmarks) { |
107 if (observer_) | 107 if (observer_) |
108 observer_->WillRemoveBookmarks(bookmarks); | 108 observer_->WillRemoveBookmarks(bookmarks); |
109 } | 109 } |
110 | 110 |
111 void BookmarkContextMenu::DidRemoveBookmarks() { | 111 void BookmarkContextMenu::DidRemoveBookmarks() { |
112 if (observer_) | 112 if (observer_) |
113 observer_->DidRemoveBookmarks(); | 113 observer_->DidRemoveBookmarks(); |
114 } | 114 } |
OLD | NEW |