OLD | NEW |
| (Empty) |
1 // Copyright 2010 Google Inc. | |
2 // | |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | |
4 // you may not use this file except in compliance with the License. | |
5 // You may obtain a copy of the License at | |
6 // | |
7 // http://www.apache.org/licenses/LICENSE-2.0 | |
8 // | |
9 // Unless required by applicable law or agreed to in writing, software | |
10 // distributed under the License is distributed on an "AS IS" BASIS, | |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 // See the License for the specific language governing permissions and | |
13 // limitations under the License. | |
14 // ======================================================================== | |
15 // | |
16 | |
17 #ifndef OMAHA_NET_BITS_JOB_CALLBACK_H_ | |
18 #define OMAHA_NET_BITS_JOB_CALLBACK_H_ | |
19 | |
20 #include <windows.h> | |
21 #include <bits.h> | |
22 #include <atlbase.h> | |
23 #include <atlcom.h> | |
24 #include "base/basictypes.h" | |
25 #include "omaha/base/synchronized.h" | |
26 | |
27 namespace omaha { | |
28 | |
29 class BitsRequest; | |
30 | |
31 // BitsJobCallback receives notifications that a BITS job is complete, has been | |
32 // modified, or is in error. | |
33 class ATL_NO_VTABLE BitsJobCallback | |
34 : public CComObjectRootEx<CComObjectThreadModel>, | |
35 public IBackgroundCopyCallback { | |
36 public: | |
37 BitsJobCallback() {} | |
38 virtual ~BitsJobCallback() { | |
39 bits_request_ = NULL; | |
40 } | |
41 | |
42 static HRESULT Create(BitsRequest* bits_request, | |
43 BitsJobCallback** bits_job_callback); | |
44 | |
45 void RemoveReferenceToBitsRequest(); | |
46 | |
47 BEGIN_COM_MAP(BitsJobCallback) | |
48 COM_INTERFACE_ENTRY(IBackgroundCopyCallback) | |
49 END_COM_MAP() | |
50 | |
51 // IBackgroundCopyCallback methods. | |
52 STDMETHODIMP JobTransferred(IBackgroundCopyJob* job); | |
53 STDMETHODIMP JobError(IBackgroundCopyJob* job, IBackgroundCopyError* error); | |
54 STDMETHODIMP JobModification(IBackgroundCopyJob* job, DWORD reserved); | |
55 | |
56 private: | |
57 BitsRequest* bits_request_; | |
58 LLock lock_; | |
59 | |
60 DISALLOW_EVIL_CONSTRUCTORS(BitsJobCallback); | |
61 }; | |
62 | |
63 } // namespace omaha | |
64 | |
65 #endif // OMAHA_NET_BITS_JOB_CALLBACK_H_ | |
66 | |
OLD | NEW |