diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-10 18:09:12 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-10 18:09:12 +0000 |
commit | e28b0fbbcde1c08e4dfbff7d4bd8e1f292892b9c (patch) | |
tree | f95fb6c3e7fad45259ac16ca3c8fccc9fde5d312 /views | |
parent | 8416157dd9a3e5bd61f605e1d420d8cf6a4ef9ca (diff) | |
download | chromium_src-e28b0fbbcde1c08e4dfbff7d4bd8e1f292892b9c.zip chromium_src-e28b0fbbcde1c08e4dfbff7d4bd8e1f292892b9c.tar.gz chromium_src-e28b0fbbcde1c08e4dfbff7d4bd8e1f292892b9c.tar.bz2 |
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
Diffstat (limited to 'views')
-rw-r--r-- | views/accessibility/view_accessibility.cc | 8 | ||||
-rw-r--r-- | views/accessibility/view_accessibility_wrapper.cc | 2 | ||||
-rw-r--r-- | views/accessibility/view_accessibility_wrapper.h | 3 | ||||
-rw-r--r-- | views/controls/textfield/native_textfield_win.cc | 16 | ||||
-rw-r--r-- | views/controls/textfield/native_textfield_win.h | 3 | ||||
-rw-r--r-- | views/widget/widget_win.cc | 2 | ||||
-rw-r--r-- | views/widget/widget_win.h | 3 |
7 files changed, 22 insertions, 15 deletions
diff --git a/views/accessibility/view_accessibility.cc b/views/accessibility/view_accessibility.cc index e375e10..03d03bb 100644 --- a/views/accessibility/view_accessibility.cc +++ b/views/accessibility/view_accessibility.cc @@ -326,7 +326,7 @@ STDMETHODIMP ViewAccessibility::get_accDefaultAction(VARIANT var_id, GetAccessibleDefaultAction(&temp_action); } if (!temp_action.empty()) { - *def_action = CComBSTR(temp_action.c_str()).Detach(); + *def_action = SysAllocString(temp_action.c_str()); } else { return S_FALSE; } @@ -350,7 +350,7 @@ STDMETHODIMP ViewAccessibility::get_accDescription(VARIANT var_id, BSTR* desc) { view_->GetChildViewAt(var_id.lVal - 1)->GetTooltipText(0, 0, &temp_desc); } if (!temp_desc.empty()) { - *desc = CComBSTR(temp_desc.c_str()).Detach(); + *desc = SysAllocString(temp_desc.c_str()); } else { return S_FALSE; } @@ -413,7 +413,7 @@ STDMETHODIMP ViewAccessibility::get_accKeyboardShortcut(VARIANT var_id, GetAccessibleKeyboardShortcut(&temp_key); } if (!temp_key.empty()) { - *acc_key = CComBSTR(temp_key.c_str()).Detach(); + *acc_key = SysAllocString(temp_key.c_str()); } else { return S_FALSE; } @@ -440,7 +440,7 @@ STDMETHODIMP ViewAccessibility::get_accName(VARIANT var_id, BSTR* name) { } if (!temp_name.empty()) { // Return name retrieved. - *name = CComBSTR(temp_name.c_str()).Detach(); + *name = SysAllocString(temp_name.c_str()); } else { // If view has no name, return S_FALSE. return S_FALSE; diff --git a/views/accessibility/view_accessibility_wrapper.cc b/views/accessibility/view_accessibility_wrapper.cc index ff336ae..7e7f5a6 100644 --- a/views/accessibility/view_accessibility_wrapper.cc +++ b/views/accessibility/view_accessibility_wrapper.cc @@ -29,7 +29,7 @@ STDMETHODIMP ViewAccessibilityWrapper::CreateDefaultInstance(REFIID iid) { if (!SUCCEEDED(hr) || !instance) return E_FAIL; - CComPtr<IAccessible> accessibility_instance(instance); + ScopedComPtr<IAccessible> accessibility_instance(instance); if (!SUCCEEDED(instance->Initialize(view_))) return E_FAIL; diff --git a/views/accessibility/view_accessibility_wrapper.h b/views/accessibility/view_accessibility_wrapper.h index 4390662..8ea1743 100644 --- a/views/accessibility/view_accessibility_wrapper.h +++ b/views/accessibility/view_accessibility_wrapper.h @@ -9,6 +9,7 @@ #include <oleacc.h> #include "base/basictypes.h" +#include "base/scoped_comptr_win.h" namespace views { class View; @@ -44,7 +45,7 @@ class ViewAccessibilityWrapper { private: // Instance of accessibility information and handling for a View. - CComPtr<IAccessible> accessibility_info_; + ScopedComPtr<IAccessible> accessibility_info_; // View needed to initialize IAccessible. views::View* view_; 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 <algorithm> + #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<IRichEditOle> ole_interface; + ScopedComPtr<IRichEditOle, &IID_IRichEditOle> 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<IRichEditOle> ole_interface; + ScopedComPtr<IRichEditOle, &IID_IRichEditOle> 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 <tom.h> // For ITextDocument, a COM interface to CRichEditCtrl #include <vsstyle.h> +#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<ITextDocument> text_object_model_; + mutable ScopedComPtr<ITextDocument> 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 diff --git a/views/widget/widget_win.cc b/views/widget/widget_win.cc index 1d8df95..8fbf31e 100644 --- a/views/widget/widget_win.cc +++ b/views/widget/widget_win.cc @@ -470,7 +470,7 @@ LRESULT WidgetWin::OnGetObject(UINT uMsg, WPARAM w_param, LPARAM l_param) { return static_cast<LRESULT>(0L); } - CComPtr<IAccessible> accessibility_instance(instance); + ScopedComPtr<IAccessible> accessibility_instance(instance); if (!SUCCEEDED(instance->Initialize(root_view_.get()))) { // Return with failure. diff --git a/views/widget/widget_win.h b/views/widget/widget_win.h index 8174511..88a2a33 100644 --- a/views/widget/widget_win.h +++ b/views/widget/widget_win.h @@ -11,6 +11,7 @@ #include <atlmisc.h> #include "base/message_loop.h" +#include "base/scoped_comptr_win.h" #include "base/system_monitor.h" #include "base/window_impl.h" #include "views/focus/focus_manager.h" @@ -586,7 +587,7 @@ class WidgetWin : public base::WindowImpl, int last_mouse_move_y_; // Instance of accessibility information and handling for MSAA root - CComPtr<IAccessible> accessibility_root_; + ScopedComPtr<IAccessible> accessibility_root_; scoped_ptr<DefaultThemeProvider> default_theme_provider_; }; |