| 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/chromeos/status/input_method_menu_button.h" | 5 #include "chrome/browser/chromeos/status/input_method_menu_button.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/chromeos/cros/cros_library.h" | 10 #include "chrome/browser/chromeos/cros/cros_library.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 host_->GetScreenMode() == StatusAreaHost::kBrowserMode) { | 126 host_->GetScreenMode() == StatusAreaHost::kBrowserMode) { |
| 127 // As the disabled color is set to invisible, disabling makes the | 127 // As the disabled color is set to invisible, disabling makes the |
| 128 // button disappear. | 128 // button disappear. |
| 129 SetEnabled(false); | 129 SetEnabled(false); |
| 130 SetTooltipText(L""); // remove tooltip | 130 SetTooltipText(L""); // remove tooltip |
| 131 } else { | 131 } else { |
| 132 SetEnabled(true); | 132 SetEnabled(true); |
| 133 SetTooltipText(tooltip); | 133 SetTooltipText(tooltip); |
| 134 } | 134 } |
| 135 SetText(name); | 135 SetText(name); |
| 136 SetAccessibleName(WideToUTF16(tooltip)); |
| 136 | 137 |
| 137 if (WindowIsActive()) { | 138 if (WindowIsActive()) { |
| 138 // We don't call these functions if the |current_window| is not active since | 139 // We don't call these functions if the |current_window| is not active since |
| 139 // the calls are relatively expensive (crosbug.com/9206). Please note that | 140 // the calls are relatively expensive (crosbug.com/9206). Please note that |
| 140 // PrepareMenuModel() is necessary for fixing crosbug.com/7522 when the | 141 // PrepareMenuModel() is necessary for fixing crosbug.com/7522 when the |
| 141 // window is active. | 142 // window is active. |
| 142 menu_->PrepareMenuModel(); | 143 menu_->PrepareMenuModel(); |
| 143 SchedulePaint(); | 144 SchedulePaint(); |
| 144 } | 145 } |
| 145 | 146 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 162 const input_method::InputMethodDescriptor& input_method = | 163 const input_method::InputMethodDescriptor& input_method = |
| 163 input_method_library->current_input_method(); | 164 input_method_library->current_input_method(); |
| 164 const std::wstring name = InputMethodMenu::GetTextForIndicator(input_method); | 165 const std::wstring name = InputMethodMenu::GetTextForIndicator(input_method); |
| 165 const std::wstring tooltip = InputMethodMenu::GetTextForMenu(input_method); | 166 const std::wstring tooltip = InputMethodMenu::GetTextForMenu(input_method); |
| 166 const size_t num_active_input_methods = | 167 const size_t num_active_input_methods = |
| 167 input_method_library->GetNumActiveInputMethods(); | 168 input_method_library->GetNumActiveInputMethods(); |
| 168 UpdateUI(input_method.id, name, tooltip, num_active_input_methods); | 169 UpdateUI(input_method.id, name, tooltip, num_active_input_methods); |
| 169 } | 170 } |
| 170 | 171 |
| 171 } // namespace chromeos | 172 } // namespace chromeos |
| OLD | NEW |