| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 menu_->RunMenu(unused_source, pt); | 98 menu_->RunMenu(unused_source, pt); |
| 99 } | 99 } |
| 100 | 100 |
| 101 bool InputMethodMenuButton::WindowIsActive() { | 101 bool InputMethodMenuButton::WindowIsActive() { |
| 102 Browser* active_browser = BrowserList::GetLastActive(); | 102 Browser* active_browser = BrowserList::GetLastActive(); |
| 103 if (!active_browser) { | 103 if (!active_browser) { |
| 104 // Can't get an active browser. Just return true, which is safer. | 104 // Can't get an active browser. Just return true, which is safer. |
| 105 return true; | 105 return true; |
| 106 } | 106 } |
| 107 BrowserWindow* active_window = active_browser->window(); | 107 BrowserWindow* active_window = active_browser->window(); |
| 108 const views::Window* current_window = GetWindow(); | 108 const views::Widget* current_window = GetWidget(); |
| 109 if (!active_window || !current_window) { | 109 if (!active_window || !current_window) { |
| 110 // Can't get an active or current window. Just return true as well. | 110 // Can't get an active or current window. Just return true as well. |
| 111 return true; | 111 return true; |
| 112 } | 112 } |
| 113 return active_window->GetNativeHandle() == current_window->GetNativeWindow(); | 113 return active_window->GetNativeHandle() == current_window->GetNativeWindow(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 void InputMethodMenuButton::UpdateUI(const std::string& input_method_id, | 116 void InputMethodMenuButton::UpdateUI(const std::string& input_method_id, |
| 117 const std::wstring& name, | 117 const std::wstring& name, |
| 118 const std::wstring& tooltip, | 118 const std::wstring& tooltip, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 const InputMethodDescriptor& input_method = | 162 const InputMethodDescriptor& input_method = |
| 163 input_method_library->current_input_method(); | 163 input_method_library->current_input_method(); |
| 164 const std::wstring name = InputMethodMenu::GetTextForIndicator(input_method); | 164 const std::wstring name = InputMethodMenu::GetTextForIndicator(input_method); |
| 165 const std::wstring tooltip = InputMethodMenu::GetTextForMenu(input_method); | 165 const std::wstring tooltip = InputMethodMenu::GetTextForMenu(input_method); |
| 166 const size_t num_active_input_methods = | 166 const size_t num_active_input_methods = |
| 167 input_method_library->GetNumActiveInputMethods(); | 167 input_method_library->GetNumActiveInputMethods(); |
| 168 UpdateUI(input_method.id, name, tooltip, num_active_input_methods); | 168 UpdateUI(input_method.id, name, tooltip, num_active_input_methods); |
| 169 } | 169 } |
| 170 | 170 |
| 171 } // namespace chromeos | 171 } // namespace chromeos |
| OLD | NEW |