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_action.h" | 9 #include "chrome/browser/extensions/extension_action.h" |
10 #include "chrome/browser/extensions/extension_action_manager.h" | 10 #include "chrome/browser/extensions/extension_action_manager.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 bounds.set_x(screen_loc.x()); | 73 bounds.set_x(screen_loc.x()); |
74 bounds.set_y(screen_loc.y()); | 74 bounds.set_y(screen_loc.y()); |
75 | 75 |
76 views::MenuItemView::AnchorPosition anchor = views::MenuItemView::TOPRIGHT; | 76 views::MenuItemView::AnchorPosition anchor = views::MenuItemView::TOPRIGHT; |
77 // As we maintain our own lifetime we can safely ignore the result. | 77 // As we maintain our own lifetime we can safely ignore the result. |
78 ignore_result(menu_runner_->RunMenuAt(window, menu_button_, bounds, anchor, | 78 ignore_result(menu_runner_->RunMenuAt(window, menu_button_, bounds, anchor, |
79 for_drop_ ? views::MenuRunner::FOR_DROP : 0)); | 79 for_drop_ ? views::MenuRunner::FOR_DROP : 0)); |
80 if (!for_drop_) { | 80 if (!for_drop_) { |
81 // Give the context menu (if any) a chance to execute the user-selected | 81 // Give the context menu (if any) a chance to execute the user-selected |
82 // command. | 82 // command. |
83 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 83 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
84 } | 84 } |
85 return true; | 85 return true; |
86 } | 86 } |
87 | 87 |
88 void BrowserActionOverflowMenuController::CancelMenu() { | 88 void BrowserActionOverflowMenuController::CancelMenu() { |
89 menu_->Cancel(); | 89 menu_->Cancel(); |
90 } | 90 } |
91 | 91 |
92 bool BrowserActionOverflowMenuController::IsCommandEnabled(int id) const { | 92 bool BrowserActionOverflowMenuController::IsCommandEnabled(int id) const { |
93 BrowserActionView* view = (*views_)[start_index_ + id - 1]; | 93 BrowserActionView* view = (*views_)[start_index_ + id - 1]; |
(...skipping 124 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 |