OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/tabs/tab.h" | 5 #include "chrome/browser/views/tabs/tab.h" |
6 | 6 |
7 #include "base/gfx/size.h" | 7 #include "base/gfx/size.h" |
8 #include "chrome/common/gfx/chrome_canvas.h" | 8 #include "chrome/common/gfx/chrome_canvas.h" |
9 #include "chrome/common/gfx/path.h" | 9 #include "chrome/common/gfx/path.h" |
10 #include "chrome/common/l10n_util.h" | 10 #include "chrome/common/l10n_util.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 l10n_util::GetString(IDS_TAB_CXMENU_CLOSEOTHERTABS)); | 43 l10n_util::GetString(IDS_TAB_CXMENU_CLOSEOTHERTABS)); |
44 menu_->AppendMenuItemWithLabel( | 44 menu_->AppendMenuItemWithLabel( |
45 TabStripModel::CommandCloseTabsToRight, | 45 TabStripModel::CommandCloseTabsToRight, |
46 l10n_util::GetString(IDS_TAB_CXMENU_CLOSETABSTORIGHT)); | 46 l10n_util::GetString(IDS_TAB_CXMENU_CLOSETABSTORIGHT)); |
47 menu_->AppendMenuItemWithLabel( | 47 menu_->AppendMenuItemWithLabel( |
48 TabStripModel::CommandCloseTabsOpenedBy, | 48 TabStripModel::CommandCloseTabsOpenedBy, |
49 l10n_util::GetString(IDS_TAB_CXMENU_CLOSETABSOPENEDBY)); | 49 l10n_util::GetString(IDS_TAB_CXMENU_CLOSETABSOPENEDBY)); |
50 } | 50 } |
51 | 51 |
52 void RunMenuAt(int x, int y) { | 52 void RunMenuAt(int x, int y) { |
| 53 views::MenuItemView::AnchorPosition anchor = |
| 54 (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) ? |
| 55 views::MenuItemView::TOPRIGHT : views::MenuItemView::TOPLEFT; |
53 menu_->RunMenuAt(tab_->GetWidget()->GetNativeView(), gfx::Rect(x, y, 0, 0), | 56 menu_->RunMenuAt(tab_->GetWidget()->GetNativeView(), gfx::Rect(x, y, 0, 0), |
54 views::MenuItemView::TOPLEFT, true); | 57 anchor, true); |
55 if (tab_) | 58 if (tab_) |
56 tab_->ContextMenuClosed(); | 59 tab_->ContextMenuClosed(); |
57 delete this; | 60 delete this; |
58 } | 61 } |
59 | 62 |
60 void Cancel() { | 63 void Cancel() { |
61 tab_ = NULL; | 64 tab_ = NULL; |
62 menu_->Cancel(); | 65 menu_->Cancel(); |
63 } | 66 } |
64 | 67 |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 | 272 |
270 // Close out the path. | 273 // Close out the path. |
271 path->lineTo(0, h); | 274 path->lineTo(0, h); |
272 path->close(); | 275 path->close(); |
273 } | 276 } |
274 | 277 |
275 void Tab::ContextMenuClosed() { | 278 void Tab::ContextMenuClosed() { |
276 delegate()->StopAllHighlighting(); | 279 delegate()->StopAllHighlighting(); |
277 menu_controller_ = NULL; | 280 menu_controller_ = NULL; |
278 } | 281 } |
OLD | NEW |