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

Side by Side Diff: base/win/accessibility_misc_utils.cc

Issue 10399084: Fix crash in the accessibility code in the shared build. The problem is that the ATL module pointer… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Update license header in atl_module.h Created 8 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "base/win/accessibility_misc_utils.h" 4 #include "base/win/accessibility_misc_utils.h"
5 5
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/win/atl_module.h"
7 8
8 namespace base { 9 namespace base {
9 namespace win { 10 namespace win {
10 11
11 // UIA TextProvider implementation. 12 // UIA TextProvider implementation.
12 UIATextProvider::UIATextProvider() 13 UIATextProvider::UIATextProvider()
13 : editable_(false) {} 14 : editable_(false) {}
14 15
15 // static 16 // static
16 bool UIATextProvider::CreateTextProvider(bool editable, IUnknown** provider) { 17 bool UIATextProvider::CreateTextProvider(bool editable, IUnknown** provider) {
18 // Make sure ATL is initialized in this module.
19 ui::win::CreateATLModuleIfNeeded();
20
17 CComObject<UIATextProvider>* text_provider = NULL; 21 CComObject<UIATextProvider>* text_provider = NULL;
18 HRESULT hr = CComObject<UIATextProvider>::CreateInstance(&text_provider); 22 HRESULT hr = CComObject<UIATextProvider>::CreateInstance(&text_provider);
19 if (SUCCEEDED(hr)) { 23 if (SUCCEEDED(hr)) {
20 DCHECK(text_provider); 24 DCHECK(text_provider);
21 text_provider->set_editable(editable); 25 text_provider->set_editable(editable);
22 text_provider->AddRef(); 26 text_provider->AddRef();
23 *provider = static_cast<ITextProvider*>(text_provider); 27 *provider = static_cast<ITextProvider*>(text_provider);
24 return true; 28 return true;
25 } 29 }
26 return false; 30 return false;
27 } 31 }
28 32
29 STDMETHODIMP UIATextProvider::get_IsReadOnly(BOOL* read_only) { 33 STDMETHODIMP UIATextProvider::get_IsReadOnly(BOOL* read_only) {
30 *read_only = !editable_; 34 *read_only = !editable_;
31 return S_OK; 35 return S_OK;
32 } 36 }
33 37
34 } // namespace win 38 } // namespace win
35 } // namespace base 39 } // namespace base
OLDNEW
« no previous file with comments | « base/base.gypi ('k') | base/win/atl_module.h » ('j') | base/win/atl_module.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698