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