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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 views::MenuItemView* source, | 96 views::MenuItemView* source, |
97 int id, | 97 int id, |
98 const gfx::Point& p, | 98 const gfx::Point& p, |
99 bool is_mouse_gesture) { | 99 bool is_mouse_gesture) { |
100 const extensions::Extension* extension = | 100 const extensions::Extension* extension = |
101 (*views_)[start_index_ + id - 1]->button()->extension(); | 101 (*views_)[start_index_ + id - 1]->button()->extension(); |
102 if (!extension->ShowConfigureContextMenus()) | 102 if (!extension->ShowConfigureContextMenus()) |
103 return false; | 103 return false; |
104 | 104 |
105 scoped_refptr<ExtensionContextMenuModel> context_menu_contents = | 105 scoped_refptr<ExtensionContextMenuModel> context_menu_contents = |
106 new ExtensionContextMenuModel(extension, owner_->browser()); | 106 new ExtensionContextMenuModel(extension, owner_->GetBrowser()); |
107 views::MenuModelAdapter context_menu_model_adapter( | 107 views::MenuModelAdapter context_menu_model_adapter( |
108 context_menu_contents.get()); | 108 context_menu_contents.get()); |
109 views::MenuRunner context_menu_runner( | 109 views::MenuRunner context_menu_runner( |
110 context_menu_model_adapter.CreateMenu()); | 110 context_menu_model_adapter.CreateMenu()); |
111 | 111 |
112 // We can ignore the result as we delete ourself. | 112 // We can ignore the result as we delete ourself. |
113 // This blocks until the user choses something or dismisses the menu. | 113 // This blocks until the user choses something or dismisses the menu. |
114 ignore_result(context_menu_runner.RunMenuAt(menu_button_->GetWidget(), | 114 ignore_result(context_menu_runner.RunMenuAt(menu_button_->GetWidget(), |
115 NULL, gfx::Rect(p, gfx::Size()), views::MenuItemView::TOPLEFT, | 115 NULL, gfx::Rect(p, gfx::Size()), views::MenuItemView::TOPLEFT, |
116 views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::IS_NESTED)); | 116 views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::IS_NESTED)); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 | 213 |
214 BrowserActionView* BrowserActionOverflowMenuController::ViewForId( | 214 BrowserActionView* BrowserActionOverflowMenuController::ViewForId( |
215 int id, size_t* index) { | 215 int id, size_t* index) { |
216 // The index of the view being dragged (GetCommand gives a 1-based index into | 216 // The index of the view being dragged (GetCommand gives a 1-based index into |
217 // the overflow menu). | 217 // the overflow menu). |
218 size_t view_index = owner_->VisibleBrowserActions() + id - 1; | 218 size_t view_index = owner_->VisibleBrowserActions() + id - 1; |
219 if (index) | 219 if (index) |
220 *index = view_index; | 220 *index = view_index; |
221 return owner_->GetBrowserActionViewAt(view_index); | 221 return owner_->GetBrowserActionViewAt(view_index); |
222 } | 222 } |
OLD | NEW |