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

Side by Side Diff: chrome/browser/renderer_host/render_widget_host_view_win.cc

Issue 7620005: Revert 96162 - Revert 96149 - Enable/disable input methods according to |text_input_type_| when a... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 4 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 | « no previous file | 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/renderer_host/render_widget_host_view_win.h" 5 #include "chrome/browser/renderer_host/render_widget_host_view_win.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 case WM_MBUTTONDOWN: 202 case WM_MBUTTONDOWN:
203 ::SendMessage(GetParent(window), message, wparam, lparam); 203 ::SendMessage(GetParent(window), message, wparam, lparam);
204 return 0; 204 return 0;
205 default: 205 default:
206 break; 206 break;
207 } 207 }
208 } 208 }
209 return ::DefWindowProc(window, message, wparam, lparam); 209 return ::DefWindowProc(window, message, wparam, lparam);
210 } 210 }
211 211
212 bool ShouldEnableIME(ui::TextInputType type) {
213 return type != ui::TEXT_INPUT_TYPE_NONE &&
214 type != ui::TEXT_INPUT_TYPE_PASSWORD;
215 }
216
212 } // namespace 217 } // namespace
213 218
214 // RenderWidgetHostView -------------------------------------------------------- 219 // RenderWidgetHostView --------------------------------------------------------
215 220
216 // static 221 // static
217 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( 222 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget(
218 RenderWidgetHost* widget) { 223 RenderWidgetHost* widget) {
219 if (views::Widget::IsPureViews()) 224 if (views::Widget::IsPureViews())
220 return new RenderWidgetHostViewViews(widget); 225 return new RenderWidgetHostViewViews(widget);
221 return new RenderWidgetHostViewWin(widget); 226 return new RenderWidgetHostViewWin(widget);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 } 285 }
281 286
282 void RenderWidgetHostViewWin::DidBecomeSelected() { 287 void RenderWidgetHostViewWin::DidBecomeSelected() {
283 if (!is_hidden_) 288 if (!is_hidden_)
284 return; 289 return;
285 290
286 if (tab_switch_paint_time_.is_null()) 291 if (tab_switch_paint_time_.is_null())
287 tab_switch_paint_time_ = TimeTicks::Now(); 292 tab_switch_paint_time_ = TimeTicks::Now();
288 is_hidden_ = false; 293 is_hidden_ = false;
289 EnsureTooltip(); 294 EnsureTooltip();
295 if (ShouldEnableIME(text_input_type_))
296 ime_input_.EnableIME(m_hWnd);
297 else
298 ime_input_.DisableIME(m_hWnd);
290 render_widget_host_->WasRestored(); 299 render_widget_host_->WasRestored();
291 } 300 }
292 301
293 void RenderWidgetHostViewWin::WasHidden() { 302 void RenderWidgetHostViewWin::WasHidden() {
294 if (is_hidden_) 303 if (is_hidden_)
295 return; 304 return;
296 305
297 // If we receive any more paint messages while we are hidden, we want to 306 // If we receive any more paint messages while we are hidden, we want to
298 // ignore them so we don't re-allocate the backing store. We will paint 307 // ignore them so we don't re-allocate the backing store. We will paint
299 // everything again when we become selected again. 308 // everything again when we become selected again.
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 } 600 }
592 601
593 void RenderWidgetHostViewWin::ImeUpdateTextInputState( 602 void RenderWidgetHostViewWin::ImeUpdateTextInputState(
594 ui::TextInputType type, 603 ui::TextInputType type,
595 bool can_compose_inline, 604 bool can_compose_inline,
596 const gfx::Rect& caret_rect) { 605 const gfx::Rect& caret_rect) {
597 // TODO(kinaba): currently, can_compose_inline is ignored and always treated 606 // TODO(kinaba): currently, can_compose_inline is ignored and always treated
598 // as true. We need to support "can_compose_inline=false" for PPAPI plugins 607 // as true. We need to support "can_compose_inline=false" for PPAPI plugins
599 // that may want to avoid drawing composition-text by themselves and pass 608 // that may want to avoid drawing composition-text by themselves and pass
600 // the responsibility to the browser. 609 // the responsibility to the browser.
601 bool is_enabled = (type != ui::TEXT_INPUT_TYPE_NONE && 610 bool is_enabled = ShouldEnableIME(type);
602 type != ui::TEXT_INPUT_TYPE_PASSWORD);
603 if (text_input_type_ != type) { 611 if (text_input_type_ != type) {
604 text_input_type_ = type; 612 text_input_type_ = type;
605 if (is_enabled) 613 if (is_enabled)
606 ime_input_.EnableIME(m_hWnd); 614 ime_input_.EnableIME(m_hWnd);
607 else 615 else
608 ime_input_.DisableIME(m_hWnd); 616 ime_input_.DisableIME(m_hWnd);
609 } 617 }
610 618
611 // Only update caret position if the input method is enabled. 619 // Only update caret position if the input method is enabled.
612 if (is_enabled) 620 if (is_enabled)
(...skipping 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after
1827 DWORD ex_style) { 1835 DWORD ex_style) {
1828 parent_hwnd_ = parent_hwnd; 1836 parent_hwnd_ = parent_hwnd;
1829 Create(parent_hwnd_, NULL, NULL, WS_POPUP, ex_style); 1837 Create(parent_hwnd_, NULL, NULL, WS_POPUP, ex_style);
1830 MoveWindow(pos.x(), pos.y(), pos.width(), pos.height(), TRUE); 1838 MoveWindow(pos.x(), pos.y(), pos.width(), pos.height(), TRUE);
1831 // To show tooltip on popup window.(e.g. title in <select>) 1839 // To show tooltip on popup window.(e.g. title in <select>)
1832 // Popups default to showing, which means |DidBecomeSelected()| isn't invoked. 1840 // Popups default to showing, which means |DidBecomeSelected()| isn't invoked.
1833 // Ensure the tooltip is created otherwise tooltips are never shown. 1841 // Ensure the tooltip is created otherwise tooltips are never shown.
1834 EnsureTooltip(); 1842 EnsureTooltip();
1835 ShowWindow(IsActivatable() ? SW_SHOW : SW_SHOWNA); 1843 ShowWindow(IsActivatable() ? SW_SHOW : SW_SHOWNA);
1836 } 1844 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698