diff options
author | yoichio@chromium.org <yoichio@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-05 10:19:29 +0000 |
---|---|---|
committer | yoichio@chromium.org <yoichio@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-05 10:19:29 +0000 |
commit | 2886f2d5738b62a7453b5543fa129cd2d148671f (patch) | |
tree | 10baf977f044e8ded4bd09d8b4efeebdbb21b900 | |
parent | 210fd56a3ff552fe84854acf4e1ce0fb7c5fe90e (diff) | |
download | chromium_src-2886f2d5738b62a7453b5543fa129cd2d148671f.zip chromium_src-2886f2d5738b62a7453b5543fa129cd2d148671f.tar.gz chromium_src-2886f2d5738b62a7453b5543fa129cd2d148671f.tar.bz2 |
Change imm32_manager_ using scoped_ptr for mock testing.
We will add Imm32Manager mocking test.
BUG=244688
Review URL: https://chromiumcodereview.appspot.com/21835006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@215590 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | content/browser/renderer_host/render_widget_host_view_win.cc | 45 | ||||
-rw-r--r-- | content/browser/renderer_host/render_widget_host_view_win.h | 2 |
2 files changed, 24 insertions, 23 deletions
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 563ea65..d18af60 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); } } diff --git a/content/browser/renderer_host/render_widget_host_view_win.h b/content/browser/renderer_host/render_widget_host_view_win.h index da7caa1..7229708 100644 --- a/content/browser/renderer_host/render_widget_host_view_win.h +++ b/content/browser/renderer_host/render_widget_host_view_win.h @@ -475,7 +475,7 @@ class RenderWidgetHostViewWin // Wrapper class for IMM32 APIs. // (See "ui/base/ime/win/imm32_manager.h" for its details.) - ui::IMM32Manager imm32_manager_; + scoped_ptr<ui::IMM32Manager> imm32_manager_; // Represents whether or not this browser process is receiving status // messages about the focused edit control from a renderer process. |