| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/extensions/extension_context_menu_model.h" | 8 #include "chrome/browser/extensions/extension_context_menu_model.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/browser_list.h" | 10 #include "chrome/browser/ui/browser_list.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 bool BrowserActionOverflowMenuController::RunMenu(gfx::NativeWindow window, | 57 bool BrowserActionOverflowMenuController::RunMenu(gfx::NativeWindow window, |
| 58 bool for_drop) { | 58 bool for_drop) { |
| 59 for_drop_ = for_drop; | 59 for_drop_ = for_drop; |
| 60 | 60 |
| 61 gfx::Rect bounds = menu_button_->bounds(); | 61 gfx::Rect bounds = menu_button_->bounds(); |
| 62 gfx::Point screen_loc; | 62 gfx::Point screen_loc; |
| 63 views::View::ConvertPointToScreen(menu_button_, &screen_loc); | 63 views::View::ConvertPointToScreen(menu_button_, &screen_loc); |
| 64 bounds.set_x(screen_loc.x()); | 64 bounds.set_x(screen_loc.x()); |
| 65 bounds.set_y(screen_loc.y()); | 65 bounds.set_y(screen_loc.y()); |
| 66 | 66 |
| 67 views::MenuItemView::AnchorPosition anchor = base::i18n::IsRTL() ? | 67 views::MenuItemView::AnchorPosition anchor = views::MenuItemView::TOPRIGHT; |
| 68 views::MenuItemView::TOPLEFT : views::MenuItemView::TOPRIGHT; | |
| 69 if (for_drop) { | 68 if (for_drop) { |
| 70 menu_->RunMenuForDropAt(window, bounds, anchor); | 69 menu_->RunMenuForDropAt(window, bounds, anchor); |
| 71 } else { | 70 } else { |
| 72 menu_->RunMenuAt(window, menu_button_, bounds, anchor, false); | 71 menu_->RunMenuAt(window, menu_button_, bounds, anchor, false); |
| 73 // Give the context menu (if any) a chance to execute the user-selected | 72 // Give the context menu (if any) a chance to execute the user-selected |
| 74 // command. | 73 // command. |
| 75 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 74 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
| 76 } | 75 } |
| 77 return true; | 76 return true; |
| 78 } | 77 } |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 | 202 |
| 204 BrowserActionView* BrowserActionOverflowMenuController::ViewForId( | 203 BrowserActionView* BrowserActionOverflowMenuController::ViewForId( |
| 205 int id, size_t* index) { | 204 int id, size_t* index) { |
| 206 // The index of the view being dragged (GetCommand gives a 1-based index into | 205 // The index of the view being dragged (GetCommand gives a 1-based index into |
| 207 // the overflow menu). | 206 // the overflow menu). |
| 208 size_t view_index = owner_->VisibleBrowserActions() + id - 1; | 207 size_t view_index = owner_->VisibleBrowserActions() + id - 1; |
| 209 if (index) | 208 if (index) |
| 210 *index = view_index; | 209 *index = view_index; |
| 211 return owner_->GetBrowserActionViewAt(view_index); | 210 return owner_->GetBrowserActionViewAt(view_index); |
| 212 } | 211 } |
| OLD | NEW |