OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/gfx/canvas.h" | 7 #include "app/gfx/canvas.h" |
8 #include "app/gfx/font.h" | 8 #include "app/gfx/font.h" |
9 #include "app/gfx/path.h" | 9 #include "app/gfx/path.h" |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 // nested message loop that may not return until after we are deleted. | 44 // nested message loop that may not return until after we are deleted. |
45 Tab::TabDelegate* delegate = tab_->delegate(); | 45 Tab::TabDelegate* delegate = tab_->delegate(); |
46 menu_->RunMenuAt(point, views::Menu2::ALIGN_TOPLEFT); | 46 menu_->RunMenuAt(point, views::Menu2::ALIGN_TOPLEFT); |
47 // We could be gone now. Assume |this| is junk! | 47 // We could be gone now. Assume |this| is junk! |
48 if (delegate) | 48 if (delegate) |
49 delegate->StopAllHighlighting(); | 49 delegate->StopAllHighlighting(); |
50 } | 50 } |
51 | 51 |
52 // Overridden from menus::SimpleMenuModel::Delegate: | 52 // Overridden from menus::SimpleMenuModel::Delegate: |
53 virtual bool IsCommandIdChecked(int command_id) const { | 53 virtual bool IsCommandIdChecked(int command_id) const { |
54 if (!tab_ || command_id != TabStripModel::CommandTogglePinned) | 54 return tab_ && tab_->delegate()->IsCommandCheckedForTab( |
55 return false; | 55 static_cast<TabStripModel::ContextMenuCommand>(command_id), |
56 return tab_->delegate()->IsTabPinned(tab_); | 56 tab_); |
57 } | 57 } |
58 virtual bool IsCommandIdEnabled(int command_id) const { | 58 virtual bool IsCommandIdEnabled(int command_id) const { |
59 return tab_ && tab_->delegate()->IsCommandEnabledForTab( | 59 return tab_ && tab_->delegate()->IsCommandEnabledForTab( |
60 static_cast<TabStripModel::ContextMenuCommand>(command_id), | 60 static_cast<TabStripModel::ContextMenuCommand>(command_id), |
61 tab_); | 61 tab_); |
62 } | 62 } |
63 virtual bool GetAcceleratorForCommandId( | 63 virtual bool GetAcceleratorForCommandId( |
64 int command_id, | 64 int command_id, |
65 menus::Accelerator* accelerator) { | 65 menus::Accelerator* accelerator) { |
66 return tab_->GetWidget()->GetAccelerator(command_id, accelerator); | 66 return tab_->GetWidget()->GetAccelerator(command_id, accelerator); |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 | 240 |
241 // Right end cap. | 241 // Right end cap. |
242 path->lineTo(w - kTabCapWidth + kTabTopCurveWidth, kTabTopCurveWidth); | 242 path->lineTo(w - kTabCapWidth + kTabTopCurveWidth, kTabTopCurveWidth); |
243 path->lineTo(w - kTabBottomCurveWidth, h - kTabBottomCurveWidth); | 243 path->lineTo(w - kTabBottomCurveWidth, h - kTabBottomCurveWidth); |
244 path->lineTo(w, h); | 244 path->lineTo(w, h); |
245 | 245 |
246 // Close out the path. | 246 // Close out the path. |
247 path->lineTo(0, h); | 247 path->lineTo(0, h); |
248 path->close(); | 248 path->close(); |
249 } | 249 } |
OLD | NEW |