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

Unified Diff: content/browser/renderer_host/render_widget_host_view_win.cc

Issue 21835006: Change imm32_manager_ using scoped_ptr for mock testing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_view_win.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_win.cc b/content/browser/renderer_host/render_widget_host_view_win.cc
index 563ea65a85f6b9eb554e26b4f564eaf73cfa6637..d18af60da8daaa169327d6aedd37be60ef8196b4 100644
--- a/content/browser/renderer_host/render_widget_host_view_win.cc
+++ b/content/browser/renderer_host/render_widget_host_view_win.cc
@@ -391,6 +391,7 @@ RenderWidgetHostViewWin::RenderWidgetHostViewWin(RenderWidgetHost* widget)
compositor_host_window_(NULL),
hide_compositor_window_at_next_paint_(false),
track_mouse_leave_(false),
+ imm32_manager_(new ui::IMM32Manager),
ime_notification_(false),
capture_enter_key_(false),
is_hidden_(false),
@@ -707,7 +708,7 @@ void RenderWidgetHostViewWin::SelectionBoundsChanged(
// Only update caret position if the input method is enabled.
if (is_enabled) {
caret_rect_ = gfx::UnionRects(params.anchor_rect, params.focus_rect);
- imm32_manager_.UpdateCaretRect(m_hWnd, caret_rect_);
+ imm32_manager_->UpdateCaretRect(m_hWnd, caret_rect_);
}
}
@@ -715,7 +716,7 @@ void RenderWidgetHostViewWin::ScrollOffsetChanged() {
}
void RenderWidgetHostViewWin::ImeCancelComposition() {
- imm32_manager_.CancelIME(m_hWnd);
+ imm32_manager_->CancelIME(m_hWnd);
}
void RenderWidgetHostViewWin::ImeCompositionRangeChanged(
@@ -1535,7 +1536,7 @@ void RenderWidgetHostViewWin::OnInputLangChange(DWORD character_set,
// 1 Sending a request only if ime_status_ != ime_notification_, and;
// 2 Copying ime_status to ime_notification_ if it sends the request
// successfully (because Action 1 shows ime_status = !ime_notification_.)
- bool ime_status = imm32_manager_.SetInputLanguage();
+ bool ime_status = imm32_manager_->SetInputLanguage();
if (ime_status != ime_notification_) {
if (render_widget_host_) {
render_widget_host_->SetInputMethodActive(ime_status);
@@ -1607,10 +1608,10 @@ LRESULT RenderWidgetHostViewWin::OnImeSetContext(
}
if (ime_notification_)
- imm32_manager_.CreateImeWindow(m_hWnd);
+ imm32_manager_->CreateImeWindow(m_hWnd);
- imm32_manager_.CleanupComposition(m_hWnd);
- return imm32_manager_.SetImeWindowStyle(
+ imm32_manager_->CleanupComposition(m_hWnd);
+ return imm32_manager_->SetImeWindowStyle(
m_hWnd, message, wparam, lparam, &handled);
}
@@ -1621,8 +1622,8 @@ LRESULT RenderWidgetHostViewWin::OnImeStartComposition(
return 0;
// Reset the composition status and create IME windows.
- imm32_manager_.CreateImeWindow(m_hWnd);
- imm32_manager_.ResetComposition(m_hWnd);
+ imm32_manager_->CreateImeWindow(m_hWnd);
+ imm32_manager_->ResetComposition(m_hWnd);
// When the focus is on an element that does not draw composition by itself
// (i.e., PPAPI plugin not handling IME), let IME to draw the text. Otherwise
// we have to prevent WTL from calling ::DefWindowProc() because the function
@@ -1639,7 +1640,7 @@ LRESULT RenderWidgetHostViewWin::OnImeComposition(
return 0;
// At first, update the position of the IME window.
- imm32_manager_.UpdateImeWindow(m_hWnd);
+ imm32_manager_->UpdateImeWindow(m_hWnd);
// ui::CompositionUnderline should be identical to
// WebKit::WebCompositionUnderline, so that we can do reinterpret_cast safely.
@@ -1650,10 +1651,10 @@ LRESULT RenderWidgetHostViewWin::OnImeComposition(
// Retrieve the result string and its attributes of the ongoing composition
// and send it to a renderer process.
ui::CompositionText composition;
- if (imm32_manager_.GetResult(m_hWnd, lparam, &composition.text)) {
+ if (imm32_manager_->GetResult(m_hWnd, lparam, &composition.text)) {
render_widget_host_->ImeConfirmComposition(
composition.text, ui::Range::InvalidRange(), false);
- imm32_manager_.ResetComposition(m_hWnd);
+ imm32_manager_->ResetComposition(m_hWnd);
// Fall though and try reading the composition string.
// Japanese IMEs send a message containing both GCS_RESULTSTR and
// GCS_COMPSTR, which means an ongoing composition has been finished
@@ -1661,7 +1662,7 @@ LRESULT RenderWidgetHostViewWin::OnImeComposition(
}
// Retrieve the composition string and its attributes of the ongoing
// composition and send it to a renderer process.
- if (imm32_manager_.GetComposition(m_hWnd, lparam, &composition)) {
+ if (imm32_manager_->GetComposition(m_hWnd, lparam, &composition)) {
// TODO(suzhe): due to a bug of webkit, we can't use selection range with
// composition string. See: https://bugs.webkit.org/show_bug.cgi?id=37788
composition.selection = ui::Range(composition.selection.end());
@@ -1695,15 +1696,15 @@ LRESULT RenderWidgetHostViewWin::OnImeEndComposition(
if (!render_widget_host_)
return 0;
- if (imm32_manager_.is_composing()) {
+ if (imm32_manager_->is_composing()) {
// A composition has been ended while there is an ongoing composition,
// i.e. the ongoing composition has been canceled.
// We need to reset the composition status both of the IMM32Manager object
// and of the renderer process.
render_widget_host_->ImeCancelComposition();
- imm32_manager_.ResetComposition(m_hWnd);
+ imm32_manager_->ResetComposition(m_hWnd);
}
- imm32_manager_.DestroyImeWindow(m_hWnd);
+ imm32_manager_->DestroyImeWindow(m_hWnd);
// Let WTL call ::DefWindowProc() and release its resources.
handled = FALSE;
return 0;
@@ -1822,7 +1823,7 @@ LRESULT RenderWidgetHostViewWin::OnMouseEvent(UINT message, WPARAM wparam,
if (base::win::IsTSFAwareRequired()) {
ui::TSFBridge::GetInstance()->CancelComposition();
} else {
- imm32_manager_.CleanupComposition(m_hWnd);
+ imm32_manager_->CleanupComposition(m_hWnd);
}
// Fall through.
case WM_MOUSEMOVE:
@@ -2209,7 +2210,7 @@ LRESULT RenderWidgetHostViewWin::OnTouchEvent(UINT message, WPARAM wparam,
if (base::win::IsTSFAwareRequired()) {
ui::TSFBridge::GetInstance()->CancelComposition();
} else {
- imm32_manager_.CleanupComposition(m_hWnd);
+ imm32_manager_->CleanupComposition(m_hWnd);
}
// TODO(jschuh): Add support for an arbitrary number of touchpoints.
@@ -3066,7 +3067,7 @@ LRESULT RenderWidgetHostViewWin::OnDocumentFeed(RECONVERTSTRING* reconv) {
LRESULT RenderWidgetHostViewWin::OnReconvertString(RECONVERTSTRING* reconv) {
// If there is a composition string already, we don't allow reconversion.
- if (imm32_manager_.is_composing())
+ if (imm32_manager_->is_composing())
return 0;
if (selection_range_.is_empty())
@@ -3116,7 +3117,7 @@ LRESULT RenderWidgetHostViewWin::OnQueryCharPosition(
return 0;
RECT target_rect = {};
- if (imm32_manager_.is_composing() && !composition_range_.is_empty() &&
+ if (imm32_manager_->is_composing() && !composition_range_.is_empty() &&
position->dwCharPos < composition_character_bounds_.size()) {
target_rect =
composition_character_bounds_[position->dwCharPos].ToRECT();
@@ -3148,10 +3149,10 @@ void RenderWidgetHostViewWin::UpdateIMEState() {
}
if (text_input_type_ != ui::TEXT_INPUT_TYPE_NONE &&
text_input_type_ != ui::TEXT_INPUT_TYPE_PASSWORD) {
- imm32_manager_.EnableIME(m_hWnd);
- imm32_manager_.SetUseCompositionWindow(!can_compose_inline_);
+ imm32_manager_->EnableIME(m_hWnd);
+ imm32_manager_->SetUseCompositionWindow(!can_compose_inline_);
} else {
- imm32_manager_.DisableIME(m_hWnd);
+ imm32_manager_->DisableIME(m_hWnd);
}
}
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698