OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/extensions/browser_action_overflow_menu_contro ller.h" | 5 #include "chrome/browser/ui/views/extensions/browser_action_overflow_menu_contro ller.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/extensions/extension_context_menu_model.h" | 9 #include "chrome/browser/extensions/extension_context_menu_model.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 // command. | 80 // command. |
81 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 81 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
82 } | 82 } |
83 return true; | 83 return true; |
84 } | 84 } |
85 | 85 |
86 void BrowserActionOverflowMenuController::CancelMenu() { | 86 void BrowserActionOverflowMenuController::CancelMenu() { |
87 menu_->Cancel(); | 87 menu_->Cancel(); |
88 } | 88 } |
89 | 89 |
90 bool BrowserActionOverflowMenuController::IsCommandEnabled(int id) const { | |
91 BrowserActionView* view = (*views_)[start_index_ + id - 1]; | |
92 return view->button()->IsEnabled(owner_->GetCurrentTabId()); | |
not at google - send to devlin
2012/07/12 01:07:29
Same comment here and in the GTK code:
ExtensionT
Yoyo Zhou
2012/07/12 01:33:27
I seem to recall this changes the appearance of me
| |
93 } | |
94 | |
90 void BrowserActionOverflowMenuController::ExecuteCommand(int id) { | 95 void BrowserActionOverflowMenuController::ExecuteCommand(int id) { |
91 BrowserActionView* view = (*views_)[start_index_ + id - 1]; | 96 BrowserActionView* view = (*views_)[start_index_ + id - 1]; |
92 owner_->OnBrowserActionExecuted(view->button()); | 97 owner_->OnBrowserActionExecuted(view->button()); |
93 } | 98 } |
94 | 99 |
95 bool BrowserActionOverflowMenuController::ShowContextMenu( | 100 bool BrowserActionOverflowMenuController::ShowContextMenu( |
96 views::MenuItemView* source, | 101 views::MenuItemView* source, |
97 int id, | 102 int id, |
98 const gfx::Point& p, | 103 const gfx::Point& p, |
99 bool is_mouse_gesture) { | 104 bool is_mouse_gesture) { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
213 | 218 |
214 BrowserActionView* BrowserActionOverflowMenuController::ViewForId( | 219 BrowserActionView* BrowserActionOverflowMenuController::ViewForId( |
215 int id, size_t* index) { | 220 int id, size_t* index) { |
216 // The index of the view being dragged (GetCommand gives a 1-based index into | 221 // The index of the view being dragged (GetCommand gives a 1-based index into |
217 // the overflow menu). | 222 // the overflow menu). |
218 size_t view_index = owner_->VisibleBrowserActions() + id - 1; | 223 size_t view_index = owner_->VisibleBrowserActions() + id - 1; |
219 if (index) | 224 if (index) |
220 *index = view_index; | 225 *index = view_index; |
221 return owner_->GetBrowserActionViewAt(view_index); | 226 return owner_->GetBrowserActionViewAt(view_index); |
222 } | 227 } |
OLD | NEW |