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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 void BrowserActionOverflowMenuController::ExecuteCommand(int id) { | 89 void BrowserActionOverflowMenuController::ExecuteCommand(int id) { |
90 BrowserActionView* view = (*views_)[start_index_ + id - 1]; | 90 BrowserActionView* view = (*views_)[start_index_ + id - 1]; |
91 owner_->OnBrowserActionExecuted(view->button()); | 91 owner_->OnBrowserActionExecuted(view->button()); |
92 } | 92 } |
93 | 93 |
94 bool BrowserActionOverflowMenuController::ShowContextMenu( | 94 bool BrowserActionOverflowMenuController::ShowContextMenu( |
95 views::MenuItemView* source, | 95 views::MenuItemView* source, |
96 int id, | 96 int id, |
97 const gfx::Point& p, | 97 const gfx::Point& p, |
98 bool is_mouse_gesture) { | 98 bool is_mouse_gesture) { |
99 const Extension* extension = | 99 const extensions::Extension* extension = |
100 (*views_)[start_index_ + id - 1]->button()->extension(); | 100 (*views_)[start_index_ + id - 1]->button()->extension(); |
101 if (!extension->ShowConfigureContextMenus()) | 101 if (!extension->ShowConfigureContextMenus()) |
102 return false; | 102 return false; |
103 | 103 |
104 scoped_refptr<ExtensionContextMenuModel> context_menu_contents = | 104 scoped_refptr<ExtensionContextMenuModel> context_menu_contents = |
105 new ExtensionContextMenuModel(extension, owner_->browser()); | 105 new ExtensionContextMenuModel(extension, owner_->browser()); |
106 views::MenuModelAdapter context_menu_model_adapter( | 106 views::MenuModelAdapter context_menu_model_adapter( |
107 context_menu_contents.get()); | 107 context_menu_contents.get()); |
108 views::MenuRunner context_menu_runner( | 108 views::MenuRunner context_menu_runner( |
109 context_menu_model_adapter.CreateMenu()); | 109 context_menu_model_adapter.CreateMenu()); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 | 212 |
213 BrowserActionView* BrowserActionOverflowMenuController::ViewForId( | 213 BrowserActionView* BrowserActionOverflowMenuController::ViewForId( |
214 int id, size_t* index) { | 214 int id, size_t* index) { |
215 // The index of the view being dragged (GetCommand gives a 1-based index into | 215 // The index of the view being dragged (GetCommand gives a 1-based index into |
216 // the overflow menu). | 216 // the overflow menu). |
217 size_t view_index = owner_->VisibleBrowserActions() + id - 1; | 217 size_t view_index = owner_->VisibleBrowserActions() + id - 1; |
218 if (index) | 218 if (index) |
219 *index = view_index; | 219 *index = view_index; |
220 return owner_->GetBrowserActionViewAt(view_index); | 220 return owner_->GetBrowserActionViewAt(view_index); |
221 } | 221 } |
OLD | NEW |