| 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/browser_list.h" | 8 #include "chrome/browser/browser_list.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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 BrowserActionOverflowMenuController::~BrowserActionOverflowMenuController() { | 52 BrowserActionOverflowMenuController::~BrowserActionOverflowMenuController() { |
| 53 if (observer_) | 53 if (observer_) |
| 54 observer_->NotifyMenuDeleted(this); | 54 observer_->NotifyMenuDeleted(this); |
| 55 } | 55 } |
| 56 | 56 |
| 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_->GetBounds( | 61 gfx::Rect bounds = menu_button_->bounds(); |
| 62 views::View::IGNORE_MIRRORING_TRANSFORMATION); | |
| 63 gfx::Point screen_loc; | 62 gfx::Point screen_loc; |
| 64 views::View::ConvertPointToScreen(menu_button_, &screen_loc); | 63 views::View::ConvertPointToScreen(menu_button_, &screen_loc); |
| 65 bounds.set_x(screen_loc.x()); | 64 bounds.set_x(screen_loc.x()); |
| 66 bounds.set_y(screen_loc.y()); | 65 bounds.set_y(screen_loc.y()); |
| 67 | 66 |
| 68 views::MenuItemView::AnchorPosition anchor = base::i18n::IsRTL() ? | 67 views::MenuItemView::AnchorPosition anchor = base::i18n::IsRTL() ? |
| 69 views::MenuItemView::TOPLEFT : views::MenuItemView::TOPRIGHT; | 68 views::MenuItemView::TOPLEFT : views::MenuItemView::TOPRIGHT; |
| 70 if (for_drop) { | 69 if (for_drop) { |
| 71 menu_->RunMenuForDropAt(window, bounds, anchor); | 70 menu_->RunMenuForDropAt(window, bounds, anchor); |
| 72 } else { | 71 } else { |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 203 |
| 205 BrowserActionView* BrowserActionOverflowMenuController::ViewForId( | 204 BrowserActionView* BrowserActionOverflowMenuController::ViewForId( |
| 206 int id, size_t* index) { | 205 int id, size_t* index) { |
| 207 // The index of the view being dragged (GetCommand gives a 1-based index into | 206 // The index of the view being dragged (GetCommand gives a 1-based index into |
| 208 // the overflow menu). | 207 // the overflow menu). |
| 209 size_t view_index = owner_->VisibleBrowserActions() + id - 1; | 208 size_t view_index = owner_->VisibleBrowserActions() + id - 1; |
| 210 if (index) | 209 if (index) |
| 211 *index = view_index; | 210 *index = view_index; |
| 212 return owner_->GetBrowserActionViewAt(view_index); | 211 return owner_->GetBrowserActionViewAt(view_index); |
| 213 } | 212 } |
| OLD | NEW |