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 "chrome/browser/profile.h" | 9 #include "chrome/browser/profile.h" |
9 #include "grit/generated_resources.h" | 10 #include "grit/generated_resources.h" |
10 #include "views/controls/menu/menu_item_view.h" | 11 #include "views/controls/menu/menu_item_view.h" |
11 | 12 |
12 //////////////////////////////////////////////////////////////////////////////// | 13 //////////////////////////////////////////////////////////////////////////////// |
13 // BookmarkContextMenu, public: | 14 // BookmarkContextMenu, public: |
14 | 15 |
15 BookmarkContextMenu::BookmarkContextMenu( | 16 BookmarkContextMenu::BookmarkContextMenu( |
16 gfx::NativeWindow parent_window, | 17 gfx::NativeWindow parent_window, |
17 Profile* profile, | 18 Profile* profile, |
(...skipping 10 matching lines...) Expand all Loading... |
28 ALLOW_THIS_IN_INITIALIZER_LIST(menu_(new views::MenuItemView(this))), | 29 ALLOW_THIS_IN_INITIALIZER_LIST(menu_(new views::MenuItemView(this))), |
29 observer_(NULL) { | 30 observer_(NULL) { |
30 controller_->BuildMenu(); | 31 controller_->BuildMenu(); |
31 } | 32 } |
32 | 33 |
33 BookmarkContextMenu::~BookmarkContextMenu() { | 34 BookmarkContextMenu::~BookmarkContextMenu() { |
34 } | 35 } |
35 | 36 |
36 void BookmarkContextMenu::RunMenuAt(const gfx::Point& point) { | 37 void BookmarkContextMenu::RunMenuAt(const gfx::Point& point) { |
37 // width/height don't matter here. | 38 // width/height don't matter here. |
38 views::MenuItemView::AnchorPosition anchor = | 39 views::MenuItemView::AnchorPosition anchor = base::i18n::IsRTL() ? |
39 (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) ? | |
40 views::MenuItemView::TOPRIGHT : views::MenuItemView::TOPLEFT; | 40 views::MenuItemView::TOPRIGHT : views::MenuItemView::TOPLEFT; |
41 menu_->RunMenuAt(parent_window_, NULL, gfx::Rect(point.x(), point.y(), 0, 0), | 41 menu_->RunMenuAt(parent_window_, NULL, gfx::Rect(point.x(), point.y(), 0, 0), |
42 anchor, true); | 42 anchor, true); |
43 } | 43 } |
44 | 44 |
45 //////////////////////////////////////////////////////////////////////////////// | 45 //////////////////////////////////////////////////////////////////////////////// |
46 // BookmarkContextMenu, views::MenuDelegate implementation: | 46 // BookmarkContextMenu, views::MenuDelegate implementation: |
47 | 47 |
48 void BookmarkContextMenu::ExecuteCommand(int command_id) { | 48 void BookmarkContextMenu::ExecuteCommand(int command_id) { |
49 controller_->ExecuteCommand(command_id); | 49 controller_->ExecuteCommand(command_id); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 void BookmarkContextMenu::WillRemoveBookmarks( | 89 void BookmarkContextMenu::WillRemoveBookmarks( |
90 const std::vector<const BookmarkNode*>& bookmarks) { | 90 const std::vector<const BookmarkNode*>& bookmarks) { |
91 if (observer_) | 91 if (observer_) |
92 observer_->WillRemoveBookmarks(bookmarks); | 92 observer_->WillRemoveBookmarks(bookmarks); |
93 } | 93 } |
94 | 94 |
95 void BookmarkContextMenu::DidRemoveBookmarks() { | 95 void BookmarkContextMenu::DidRemoveBookmarks() { |
96 if (observer_) | 96 if (observer_) |
97 observer_->DidRemoveBookmarks(); | 97 observer_->DidRemoveBookmarks(); |
98 } | 98 } |
OLD | NEW |