| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/views/wrench_menu.h" | 5 #include "chrome/browser/views/wrench_menu.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 PopulateMenu(root_.get(), model, &next_id); | 556 PopulateMenu(root_.get(), model, &next_id); |
| 557 } | 557 } |
| 558 | 558 |
| 559 void WrenchMenu::RunMenu(views::MenuButton* host) { | 559 void WrenchMenu::RunMenu(views::MenuButton* host) { |
| 560 gfx::Point screen_loc; | 560 gfx::Point screen_loc; |
| 561 views::View::ConvertPointToScreen(host, &screen_loc); | 561 views::View::ConvertPointToScreen(host, &screen_loc); |
| 562 // Subtract 1 from the height to make the popup flush with the button border. | 562 // Subtract 1 from the height to make the popup flush with the button border. |
| 563 gfx::Rect bounds(screen_loc.x(), screen_loc.y(), host->width(), | 563 gfx::Rect bounds(screen_loc.x(), screen_loc.y(), host->width(), |
| 564 host->height() - 1); | 564 host->height() - 1); |
| 565 root_->RunMenuAt(host->GetWindow()->GetNativeWindow(), host, bounds, | 565 root_->RunMenuAt(host->GetWindow()->GetNativeWindow(), host, bounds, |
| 566 MenuItemView::TOPRIGHT, true); | 566 base::i18n::IsRTL() ? MenuItemView::TOPLEFT : MenuItemView::TOPRIGHT, |
| 567 true); |
| 567 if (selected_menu_model_) | 568 if (selected_menu_model_) |
| 568 selected_menu_model_->ActivatedAt(selected_index_); | 569 selected_menu_model_->ActivatedAt(selected_index_); |
| 569 } | 570 } |
| 570 | 571 |
| 571 bool WrenchMenu::IsItemChecked(int id) const { | 572 bool WrenchMenu::IsItemChecked(int id) const { |
| 572 const Entry& entry = id_to_entry_.find(id)->second; | 573 const Entry& entry = id_to_entry_.find(id)->second; |
| 573 return entry.first->IsItemCheckedAt(entry.second); | 574 return entry.first->IsItemCheckedAt(entry.second); |
| 574 } | 575 } |
| 575 | 576 |
| 576 bool WrenchMenu::IsCommandEnabled(int id) const { | 577 bool WrenchMenu::IsCommandEnabled(int id) const { |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 } | 700 } |
| 700 | 701 |
| 701 return menu_item; | 702 return menu_item; |
| 702 } | 703 } |
| 703 | 704 |
| 704 void WrenchMenu::CancelAndEvaluate(MenuModel* model, int index) { | 705 void WrenchMenu::CancelAndEvaluate(MenuModel* model, int index) { |
| 705 selected_menu_model_ = model; | 706 selected_menu_model_ = model; |
| 706 selected_index_ = index; | 707 selected_index_ = index; |
| 707 root_->Cancel(); | 708 root_->Cancel(); |
| 708 } | 709 } |
| OLD | NEW |