OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/base_drag_source.h" | 5 #include "base/base_drag_source.h" |
6 | 6 |
7 /////////////////////////////////////////////////////////////////////////////// | 7 /////////////////////////////////////////////////////////////////////////////// |
8 // BaseDragSource, public: | 8 // BaseDragSource, public: |
9 | 9 |
10 BaseDragSource::BaseDragSource() : ref_count_(0), cancel_drag_(false) { | 10 BaseDragSource::BaseDragSource() : cancel_drag_(false) { |
11 } | 11 } |
12 | 12 |
13 /////////////////////////////////////////////////////////////////////////////// | 13 /////////////////////////////////////////////////////////////////////////////// |
14 // BaseDragSource, IDropSource implementation: | 14 // BaseDragSource, IDropSource implementation: |
15 | 15 |
16 HRESULT BaseDragSource::QueryContinueDrag(BOOL escape_pressed, | 16 HRESULT BaseDragSource::QueryContinueDrag(BOOL escape_pressed, |
17 DWORD key_state) { | 17 DWORD key_state) { |
18 if (cancel_drag_) | 18 if (cancel_drag_) |
19 return DRAGDROP_S_CANCEL; | 19 return DRAGDROP_S_CANCEL; |
20 | 20 |
(...skipping 23 matching lines...) Expand all Loading... |
44 if (IsEqualIID(iid, IID_IUnknown) || IsEqualIID(iid, IID_IDropSource)) { | 44 if (IsEqualIID(iid, IID_IUnknown) || IsEqualIID(iid, IID_IDropSource)) { |
45 *object = this; | 45 *object = this; |
46 } else { | 46 } else { |
47 return E_NOINTERFACE; | 47 return E_NOINTERFACE; |
48 } | 48 } |
49 AddRef(); | 49 AddRef(); |
50 return S_OK; | 50 return S_OK; |
51 } | 51 } |
52 | 52 |
53 ULONG BaseDragSource::AddRef() { | 53 ULONG BaseDragSource::AddRef() { |
54 return ++ref_count_; | 54 base::RefCountedThreadSafe<BaseDragSource>::AddRef(); |
| 55 return 0; |
55 } | 56 } |
56 | 57 |
57 ULONG BaseDragSource::Release() { | 58 ULONG BaseDragSource::Release() { |
58 if (--ref_count_ == 0) { | 59 base::RefCountedThreadSafe<BaseDragSource>::Release(); |
59 delete this; | 60 return 0; |
60 return 0U; | |
61 } | |
62 return ref_count_; | |
63 } | 61 } |
OLD | NEW |