From e28b0fbbcde1c08e4dfbff7d4bd8e1f292892b9c Mon Sep 17 00:00:00 2001 From: "jhawkins@chromium.org" Date: Thu, 10 Sep 2009 18:09:12 +0000 Subject: Use Scoped[Bstr,ComPtr,Variant] instead of their ATL equivalents to reduce dependencies on ATL. BUG=5027 TEST=none Review URL: http://codereview.chromium.org/200045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25879 0039d316-1c4b-4281-b951-d872f2087c98 --- views/controls/textfield/native_textfield_win.cc | 16 ++++++++++------ views/controls/textfield/native_textfield_win.h | 3 ++- 2 files changed, 12 insertions(+), 7 deletions(-) (limited to 'views/controls/textfield') diff --git a/views/controls/textfield/native_textfield_win.cc b/views/controls/textfield/native_textfield_win.cc index e152dbe..15d6bd9 100644 --- a/views/controls/textfield/native_textfield_win.cc +++ b/views/controls/textfield/native_textfield_win.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include + #include "app/l10n_util.h" #include "app/l10n_util_win.h" #include "app/win_util.h" @@ -94,9 +96,9 @@ NativeTextfieldWin::NativeTextfieldWin(Textfield* textfield) } // Set up the text_object_model_. - CComPtr ole_interface; + ScopedComPtr ole_interface; ole_interface.Attach(GetOleInterface()); - text_object_model_ = ole_interface; + text_object_model_.QueryFrom(ole_interface); } NativeTextfieldWin::~NativeTextfieldWin() { @@ -305,7 +307,9 @@ void NativeTextfieldWin::OnCut() { ReplaceSel(L"", true); } -LRESULT NativeTextfieldWin::OnImeChar(UINT message, WPARAM wparam, LPARAM lparam) { +LRESULT NativeTextfieldWin::OnImeChar(UINT message, + WPARAM wparam, + LPARAM lparam) { // http://crbug.com/7707: a rich-edit control may crash when it receives a // WM_IME_CHAR message while it is processing a WM_IME_COMPOSITION message. // Since view controls don't need WM_IME_CHAR messages, we prevent WM_IME_CHAR @@ -512,7 +516,7 @@ LRESULT NativeTextfieldWin::OnMouseWheel(UINT message, WPARAM w_param, // applicable. if (views::RerouteMouseWheel(m_hWnd, w_param, l_param)) return 0; - return DefWindowProc(message, w_param, l_param);; + return DefWindowProc(message, w_param, l_param); } void NativeTextfieldWin::OnMouseMove(UINT keys, const CPoint& point) { @@ -842,9 +846,9 @@ void NativeTextfieldWin::SetContainsMouse(bool contains_mouse) { ITextDocument* NativeTextfieldWin::GetTextObjectModel() const { if (!text_object_model_) { - CComPtr ole_interface; + ScopedComPtr ole_interface; ole_interface.Attach(GetOleInterface()); - text_object_model_ = ole_interface; + text_object_model_.QueryFrom(ole_interface); } return text_object_model_; } diff --git a/views/controls/textfield/native_textfield_win.h b/views/controls/textfield/native_textfield_win.h index cab5981..e1e51d7 100644 --- a/views/controls/textfield/native_textfield_win.h +++ b/views/controls/textfield/native_textfield_win.h @@ -13,6 +13,7 @@ #include // For ITextDocument, a COM interface to CRichEditCtrl #include +#include "base/scoped_comptr_win.h" #include "views/controls/menu/simple_menu_model.h" #include "views/controls/textfield/native_textfield_wrapper.h" @@ -195,7 +196,7 @@ class NativeTextfieldWin gfx::Insets content_insets_; // This interface is useful for accessing the CRichEditCtrl at a low level. - mutable CComQIPtr text_object_model_; + mutable ScopedComPtr text_object_model_; // The position and the length of the ongoing composition string. // These values are used for removing a composition string from a search -- cgit v1.1