Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(531)

Side by Side Diff: chrome/browser/chromeos/status/input_method_menu_button.cc

Issue 6962012: Convert ChromiumOS input method menu to views::MenuItemView implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix comments. Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/status/input_method_menu.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 136
137 if (WindowIsActive()) { 137 if (WindowIsActive()) {
138 // We don't call these functions if the |current_window| is not active since 138 // 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 139 // the calls are relatively expensive (crosbug.com/9206). Please note that
140 // PrepareMenu() is necessary for fixing crosbug.com/7522 when the window 140 // PrepareMenuModel() is necessary for fixing crosbug.com/7522 when the
141 // is active. 141 // window is active.
142 menu_->PrepareMenu(); 142 menu_->PrepareMenuModel();
143 SchedulePaint(); 143 SchedulePaint();
144 } 144 }
145 145
146 // TODO(yusukes): For a window which isn't on top, probably it's better to 146 // TODO(yusukes): For a window which isn't on top, probably it's better to
147 // update the texts when the window gets activated because SetTooltipText() 147 // update the texts when the window gets activated because SetTooltipText()
148 // and SetText() are also expensive. 148 // and SetText() are also expensive.
149 } 149 }
150 150
151 void InputMethodMenuButton::OpenConfigUI() { 151 void InputMethodMenuButton::OpenConfigUI() {
152 host_->OpenButtonOptions(this); // ask browser to open the WebUI page. 152 host_->OpenButtonOptions(this); // ask browser to open the WebUI page.
153 } 153 }
154 154
155 bool InputMethodMenuButton::ShouldSupportConfigUI() { 155 bool InputMethodMenuButton::ShouldSupportConfigUI() {
156 return host_->ShouldOpenButtonOptions(this); 156 return host_->ShouldOpenButtonOptions(this);
157 } 157 }
158 158
159 void InputMethodMenuButton::UpdateUIFromCurrentInputMethod() { 159 void InputMethodMenuButton::UpdateUIFromCurrentInputMethod() {
160 chromeos::InputMethodLibrary* input_method_library = 160 chromeos::InputMethodLibrary* input_method_library =
161 chromeos::CrosLibrary::Get()->GetInputMethodLibrary(); 161 chromeos::CrosLibrary::Get()->GetInputMethodLibrary();
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
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/status/input_method_menu.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698