| 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/chromeos/login/language_switch_menu.h" | 5 #include "chrome/browser/chromeos/login/language_switch_menu.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "base/i18n/rtl.h" | 8 #include "base/i18n/rtl.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 // lower right corner for non-RTL (with menu_offset applied). | 177 // lower right corner for non-RTL (with menu_offset applied). |
| 178 const int reverse_offset = button->width() + button->menu_offset().x() * 2; | 178 const int reverse_offset = button->width() + button->menu_offset().x() * 2; |
| 179 gfx::Point new_pt(point); | 179 gfx::Point new_pt(point); |
| 180 if (base::i18n::IsRTL()) | 180 if (base::i18n::IsRTL()) |
| 181 new_pt.set_x(point.x() + reverse_offset); | 181 new_pt.set_x(point.x() + reverse_offset); |
| 182 else | 182 else |
| 183 new_pt.set_x(point.x() - reverse_offset); | 183 new_pt.set_x(point.x() - reverse_offset); |
| 184 | 184 |
| 185 if (menu_runner_->RunMenuAt(button->GetWidget(), button, | 185 if (menu_runner_->RunMenuAt(button->GetWidget(), button, |
| 186 gfx::Rect(new_pt, gfx::Size()), views::MenuItemView::TOPLEFT, | 186 gfx::Rect(new_pt, gfx::Size()), views::MenuItemView::TOPLEFT, |
| 187 views::MenuRunner::HAS_MNEMONICS) == views::MenuRunner::MENU_DELETED) | 187 ui::MENU_SOURCE_NONE, views::MenuRunner::HAS_MNEMONICS) == |
| 188 views::MenuRunner::MENU_DELETED) |
| 188 return; | 189 return; |
| 189 } | 190 } |
| 190 | 191 |
| 191 //////////////////////////////////////////////////////////////////////////////// | 192 //////////////////////////////////////////////////////////////////////////////// |
| 192 // views::MenuDelegate implementation. | 193 // views::MenuDelegate implementation. |
| 193 | 194 |
| 194 void LanguageSwitchMenu::ExecuteCommand(int command_id, int event_flags) { | 195 void LanguageSwitchMenu::ExecuteCommand(int command_id, int event_flags) { |
| 195 const std::string locale = language_list_->GetLocaleFromIndex(command_id); | 196 const std::string locale = language_list_->GetLocaleFromIndex(command_id); |
| 196 // Here, we should enable keyboard layouts associated with the locale so | 197 // Here, we should enable keyboard layouts associated with the locale so |
| 197 // that users can use those keyboard layouts on the login screen. | 198 // that users can use those keyboard layouts on the login screen. |
| 198 SwitchLanguageAndEnableKeyboardLayouts(locale); | 199 SwitchLanguageAndEnableKeyboardLayouts(locale); |
| 199 InitLanguageMenu(); | 200 InitLanguageMenu(); |
| 200 NotifyLocaleChanged(ash::Shell::GetPrimaryRootWindow()); | 201 NotifyLocaleChanged(ash::Shell::GetPrimaryRootWindow()); |
| 201 } | 202 } |
| 202 | 203 |
| 203 } // namespace chromeos | 204 } // namespace chromeos |
| OLD | NEW |