diff options
author | altimofeev@chromium.org <altimofeev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-04 13:20:40 +0000 |
---|---|---|
committer | altimofeev@chromium.org <altimofeev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-04 13:20:40 +0000 |
commit | 3e3dbcfeb9d3c543aef1ccff57bd73b5ed5b9e30 (patch) | |
tree | 2ef238d9207841b6d9cb0ac97d3a9b65108a4aeb /chrome | |
parent | be7e5cb8d07fcae04a4ee8cfbab214a1f297a78f (diff) | |
download | chromium_src-3e3dbcfeb9d3c543aef1ccff57bd73b5ed5b9e30.zip chromium_src-3e3dbcfeb9d3c543aef1ccff57bd73b5ed5b9e30.tar.gz chromium_src-3e3dbcfeb9d3c543aef1ccff57bd73b5ed5b9e30.tar.bz2 |
Avoids double menu offset usage.
Menu position offset was implemented for menu button and language menu.
So 2 magic number were used to position the menu. This CL removes offset
handling from the language menu class, since this is not common for
menu.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3610005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61360 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/chromeos/login/language_switch_menu.cc | 8 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/language_switch_menu.h | 7 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/network_selection_view.cc | 19 |
3 files changed, 8 insertions, 26 deletions
diff --git a/chrome/browser/chromeos/login/language_switch_menu.cc b/chrome/browser/chromeos/login/language_switch_menu.cc index 5f5d8c6..92e4750 100644 --- a/chrome/browser/chromeos/login/language_switch_menu.cc +++ b/chrome/browser/chromeos/login/language_switch_menu.cc @@ -30,9 +30,7 @@ namespace chromeos { LanguageSwitchMenu::LanguageSwitchMenu() : ALLOW_THIS_IN_INITIALIZER_LIST(menu_model_(this)), - ALLOW_THIS_IN_INITIALIZER_LIST(menu_model_submenu_(this)), - delta_x_(0), - delta_y_(0) { + ALLOW_THIS_IN_INITIALIZER_LIST(menu_model_submenu_(this)) { } void LanguageSwitchMenu::InitLanguageMenu() { @@ -108,9 +106,7 @@ void LanguageSwitchMenu::SwitchLanguage(const std::string& locale) { void LanguageSwitchMenu::RunMenu(views::View* source, const gfx::Point& pt) { DCHECK(menu_ != NULL); - gfx::Point point(pt); - point.Offset(delta_x_, delta_y_); - menu_->RunMenuAt(point, views::Menu2::ALIGN_TOPRIGHT); + menu_->RunMenuAt(pt, views::Menu2::ALIGN_TOPRIGHT); } //////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/chromeos/login/language_switch_menu.h b/chrome/browser/chromeos/login/language_switch_menu.h index a3db06e..33d34af 100644 --- a/chrome/browser/chromeos/login/language_switch_menu.h +++ b/chrome/browser/chromeos/login/language_switch_menu.h @@ -36,11 +36,6 @@ class LanguageSwitchMenu : public views::ViewMenuDelegate, // Sets the minimum width of the first level menu to be shown. void SetFirstLevelMenuWidth(int width); - void set_menu_offset(int delta_x, int delta_y) { - delta_x_ = delta_x; - delta_y_ = delta_y; - } - // Switches the current locale, saves the new locale in preferences. static void SwitchLanguage(const std::string& locale); @@ -63,8 +58,6 @@ class LanguageSwitchMenu : public views::ViewMenuDelegate, // Language locale name storage. scoped_ptr<LanguageList> language_list_; - int delta_x_, delta_y_; - FRIEND_TEST(::WizardControllerTest, SwitchLanguage); DISALLOW_COPY_AND_ASSIGN(LanguageSwitchMenu); }; diff --git a/chrome/browser/chromeos/login/network_selection_view.cc b/chrome/browser/chromeos/login/network_selection_view.cc index b33e8d6..13e37a2 100644 --- a/chrome/browser/chromeos/login/network_selection_view.cc +++ b/chrome/browser/chromeos/login/network_selection_view.cc @@ -64,15 +64,11 @@ const int kSelectionBoxHeight = 29; // Menu button is drawn using our custom icons in resources. See // TextButtonBorder::Paint() for details. So this offset compensate // horizontal size, eaten by those icons. -const int kMenuHorizontalOffset = -1; - -// Constants were taken from 'views/controls/menu_button.cc'. -const int kDefaultMenuOffsetX = -2; -const int kDefaultMenuOffsetY = -4; +const int kMenuHorizontalOffset = -3; // Vertical addition to the menu window to make it appear exactly below // MenuButton. -const int kMenuVerticalOffset = 3; +const int kMenuVerticalOffset = -1; // Offset that compensates menu width so that it matches // menu button visual width when being in pushed state. @@ -298,9 +294,8 @@ void NetworkSelectionView::Init() { languages_menubutton_->SetFocusable(true); languages_menubutton_->SetNormalHasBorder(true); // Menu is positioned by bottom right corner of the MenuButton. - // TODO(altimofeev): switch to the absolute offsets (button related) - delegate_->language_switch_menu()->set_menu_offset(kMenuHorizontalOffset, - kMenuVerticalOffset); + languages_menubutton_->set_menu_offset(kMenuHorizontalOffset, + kMenuVerticalOffset); select_network_label_ = new views::Label(); select_network_label_->SetFont(rb.GetFont(ResourceBundle::MediumFont)); @@ -309,10 +304,8 @@ void NetworkSelectionView::Init() { GetNativeWindow(), delegate_); - // TODO(altimofeev): switch to the absolute offsets (button related) - network_dropdown_->set_menu_offset( - kDefaultMenuOffsetX + kMenuHorizontalOffset, - kDefaultMenuOffsetY + kMenuVerticalOffset); + network_dropdown_->set_menu_offset(kMenuHorizontalOffset, + kMenuVerticalOffset); network_dropdown_->SetNormalHasBorder(true); network_dropdown_->SetFocusable(true); |