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

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

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