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

Side by Side Diff: views/widget/native_widget_win.cc

Issue 7806010: Fix small memory leak on SysAllocString. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 4
5 #include "views/widget/native_widget_win.h" 5 #include "views/widget/native_widget_win.h"
6 6
7 #include <dwmapi.h> 7 #include <dwmapi.h>
8 #include <shellapi.h> 8 #include <shellapi.h>
9 9
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 } 688 }
689 689
690 void NativeWidgetWin::SetAccessibleName(const std::wstring& name) { 690 void NativeWidgetWin::SetAccessibleName(const std::wstring& name) {
691 base::win::ScopedComPtr<IAccPropServices> pAccPropServices; 691 base::win::ScopedComPtr<IAccPropServices> pAccPropServices;
692 HRESULT hr = CoCreateInstance(CLSID_AccPropServices, NULL, CLSCTX_SERVER, 692 HRESULT hr = CoCreateInstance(CLSID_AccPropServices, NULL, CLSCTX_SERVER,
693 IID_IAccPropServices, reinterpret_cast<void**>(&pAccPropServices)); 693 IID_IAccPropServices, reinterpret_cast<void**>(&pAccPropServices));
694 if (SUCCEEDED(hr)) { 694 if (SUCCEEDED(hr)) {
695 VARIANT var; 695 VARIANT var;
696 var.vt = VT_BSTR; 696 var.vt = VT_BSTR;
697 var.bstrVal = SysAllocString(name.c_str()); 697 var.bstrVal = SysAllocString(name.c_str());
698 hr = pAccPropServices->SetHwndProp(GetNativeView(), OBJID_CLIENT, 698 hr = pAccPropServices->SetHwndProp(GetNativeView(), OBJID_CLIENT,
sky 2011/08/30 15:35:23 Could we simplify this to SetHwndPropStr(..., name
699 CHILDID_SELF, PROPID_ACC_NAME, var); 699 CHILDID_SELF, PROPID_ACC_NAME, var);
700 SysFreeString(var.bstrVal);
700 } 701 }
701 } 702 }
702 703
703 void NativeWidgetWin::SetAccessibleRole(ui::AccessibilityTypes::Role role) { 704 void NativeWidgetWin::SetAccessibleRole(ui::AccessibilityTypes::Role role) {
704 base::win::ScopedComPtr<IAccPropServices> pAccPropServices; 705 base::win::ScopedComPtr<IAccPropServices> pAccPropServices;
705 HRESULT hr = CoCreateInstance(CLSID_AccPropServices, NULL, CLSCTX_SERVER, 706 HRESULT hr = CoCreateInstance(CLSID_AccPropServices, NULL, CLSCTX_SERVER,
706 IID_IAccPropServices, reinterpret_cast<void**>(&pAccPropServices)); 707 IID_IAccPropServices, reinterpret_cast<void**>(&pAccPropServices));
707 if (SUCCEEDED(hr)) { 708 if (SUCCEEDED(hr)) {
708 VARIANT var; 709 VARIANT var;
709 if (role) { 710 if (role) {
(...skipping 1823 matching lines...) Expand 10 before | Expand all | Expand 10 after
2533 return (GetKeyState(VK_LBUTTON) & 0x80) || 2534 return (GetKeyState(VK_LBUTTON) & 0x80) ||
2534 (GetKeyState(VK_RBUTTON) & 0x80) || 2535 (GetKeyState(VK_RBUTTON) & 0x80) ||
2535 (GetKeyState(VK_MBUTTON) & 0x80) || 2536 (GetKeyState(VK_MBUTTON) & 0x80) ||
2536 (GetKeyState(VK_XBUTTON1) & 0x80) || 2537 (GetKeyState(VK_XBUTTON1) & 0x80) ||
2537 (GetKeyState(VK_XBUTTON2) & 0x80); 2538 (GetKeyState(VK_XBUTTON2) & 0x80);
2538 } 2539 }
2539 2540
2540 } // namespace internal 2541 } // namespace internal
2541 2542
2542 } // namespace views 2543 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698