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

Side by Side Diff: goopdate/package.h

Issue 624713003: Keep only base/extractor.[cc|h]. (Closed) Base URL: https://chromium.googlesource.com/external/omaha.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « goopdate/oneclick_process_launcher.cc ('k') | goopdate/package.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2009-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 // Defines the Package COM object exposed by the model.
17
18 // TODO(omaha3): Protect all public members with the model lock and assert in
19 // all non-public members that the model has been locked by the caller.
20
21 #ifndef OMAHA_GOOPDATE_PACKAGE_H_
22 #define OMAHA_GOOPDATE_PACKAGE_H_
23
24 #include <atlbase.h>
25 #include <atlcom.h>
26 #include "base/basictypes.h"
27 #include "goopdate/omaha3_idl.h"
28 #include "omaha/base/constants.h"
29 #include "omaha/base/time.h"
30 #include "omaha/common/progress_sampler.h"
31 #include "omaha/goopdate/com_wrapper_creator.h"
32 #include "omaha/goopdate/model_object.h"
33 // TODO(omaha): Consider implementing the NetworkRequestCallback portion in a
34 // PImpl or similar pattern. As it is, every file that includes model.h also
35 // becomes dependent on most of net/.
36 #include "omaha/net/network_request.h"
37
38 namespace omaha {
39
40 class AppVersion;
41 struct Lockable;
42
43 class Package
44 : public ModelObject,
45 public NetworkRequestCallback {
46 public:
47 explicit Package(AppVersion* parent_app_version);
48 virtual ~Package();
49
50 STDMETHOD(get)(BSTR dir) const;
51 STDMETHOD(get_isAvailable)(VARIANT_BOOL* is_available) const;
52 STDMETHOD(get_filename)(BSTR* filename) const;
53
54 // NetworkRequestCallback.
55 virtual void OnProgress(int bytes,
56 int bytes_total,
57 int status,
58 const TCHAR* status_text);
59 virtual void OnRequestBegin();
60 virtual void OnRequestRetryScheduled(time64 next_download_retry_time);
61
62 void SetFileInfo(const CString& filename, uint64 size, const CString& hash);
63
64 // Returns the name of the file specified in the manifest.
65 CString filename() const;
66 // Returns the expected size of the file in bytes.
67 uint64 expected_size() const;
68 // Returns the expected SHA-1 hash of the file.
69 CString expected_hash() const;
70
71 uint64 bytes_downloaded() const;
72
73 time64 next_download_retry_time() const;
74
75 AppVersion* app_version();
76 const AppVersion* app_version() const;
77
78 LONG GetEstimatedRemainingDownloadTimeMs() const;
79
80 private:
81 // Weak reference to the parent of the package.
82 AppVersion* app_version_;
83
84 // The name of the package as it appears in the manifest.
85 CString filename_;
86 uint64 expected_size_;
87 CString expected_hash_;
88
89 int bytes_downloaded_;
90 int bytes_total_;
91 time64 next_download_retry_time_;
92
93 ProgressSampler<int> progress_sampler_;
94
95 // True if the package is being downloaded.
96 // TODO(omaha): implement this.
97 bool is_downloading_;
98
99 DISALLOW_COPY_AND_ASSIGN(Package);
100 };
101
102 class ATL_NO_VTABLE PackageWrapper
103 : public ComWrapper<PackageWrapper, Package>,
104 public IDispatchImpl<IPackage,
105 &__uuidof(IPackage),
106 &CAtlModule::m_libid,
107 kMajorTypeLibVersion,
108 kMinorTypeLibVersion> {
109 public:
110
111 // IPackage.
112 STDMETHOD(get)(BSTR dir);
113 STDMETHOD(get_isAvailable)(VARIANT_BOOL* is_available);
114 STDMETHOD(get_filename)(BSTR* filename);
115
116 protected:
117 PackageWrapper() {}
118 virtual ~PackageWrapper() {}
119
120 BEGIN_COM_MAP(PackageWrapper)
121 COM_INTERFACE_ENTRY(IPackage)
122 COM_INTERFACE_ENTRY(IDispatch)
123 END_COM_MAP()
124 };
125
126 } // namespace omaha
127
128 #endif // OMAHA_GOOPDATE_PACKAGE_H_
OLDNEW
« no previous file with comments | « goopdate/oneclick_process_launcher.cc ('k') | goopdate/package.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698