OLD | NEW |
---|---|
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium OS 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 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_DOWNLOAD_ACTION_H__ | 5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_DOWNLOAD_ACTION_H__ |
6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_DOWNLOAD_ACTION_H__ | 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_DOWNLOAD_ACTION_H__ |
7 | 7 |
8 #include <sys/types.h> | 8 #include <sys/types.h> |
9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
10 #include <fcntl.h> | 10 #include <fcntl.h> |
11 | 11 |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include <base/scoped_ptr.h> | 14 #include <base/scoped_ptr.h> |
15 #include <curl/curl.h> | 15 #include <curl/curl.h> |
16 #include <google/protobuf/stubs/common.h> | |
16 | 17 |
17 #include "update_engine/action.h" | 18 #include "update_engine/action.h" |
18 #include "update_engine/decompressing_file_writer.h" | 19 #include "update_engine/decompressing_file_writer.h" |
19 #include "update_engine/delta_performer.h" | 20 #include "update_engine/delta_performer.h" |
20 #include "update_engine/buffered_file_writer.h" | 21 #include "update_engine/buffered_file_writer.h" |
21 #include "update_engine/http_fetcher.h" | 22 #include "update_engine/http_fetcher.h" |
22 #include "update_engine/install_plan.h" | 23 #include "update_engine/install_plan.h" |
23 #include "update_engine/omaha_hash_calculator.h" | 24 #include "update_engine/omaha_hash_calculator.h" |
24 #include "update_engine/split_file_writer.h" | 25 #include "update_engine/split_file_writer.h" |
25 | 26 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
90 virtual void TransferComplete(HttpFetcher *fetcher, bool successful); | 91 virtual void TransferComplete(HttpFetcher *fetcher, bool successful); |
91 virtual void TransferTerminated(HttpFetcher *fetcher); | 92 virtual void TransferTerminated(HttpFetcher *fetcher); |
92 | 93 |
93 DownloadActionDelegate* delegate() const { return delegate_; } | 94 DownloadActionDelegate* delegate() const { return delegate_; } |
94 void set_delegate(DownloadActionDelegate* delegate) { | 95 void set_delegate(DownloadActionDelegate* delegate) { |
95 delegate_ = delegate; | 96 delegate_ = delegate; |
96 } | 97 } |
97 | 98 |
98 HttpFetcher* http_fetcher() { return http_fetcher_.get(); } | 99 HttpFetcher* http_fetcher() { return http_fetcher_.get(); } |
99 | 100 |
101 void set_skip_reporting_signature_fail(google::protobuf::Closure* callback) { | |
102 skip_reporting_signature_fail_.reset(callback); | |
103 } | |
104 | |
100 private: | 105 private: |
101 // The InstallPlan passed in | 106 // The InstallPlan passed in |
102 InstallPlan install_plan_; | 107 InstallPlan install_plan_; |
103 | 108 |
104 // Update Engine preference store. | 109 // Update Engine preference store. |
105 PrefsInterface* prefs_; | 110 PrefsInterface* prefs_; |
106 | 111 |
107 // The FileWriter that downloaded data should be written to. It will | 112 // The FileWriter that downloaded data should be written to. It will |
108 // either point to *decompressing_file_writer_ or *delta_performer_. | 113 // either point to *decompressing_file_writer_ or *delta_performer_. |
109 FileWriter* writer_; | 114 FileWriter* writer_; |
(...skipping 16 matching lines...) Expand all Loading... | |
126 OmahaHashCalculator omaha_hash_calculator_; | 131 OmahaHashCalculator omaha_hash_calculator_; |
127 | 132 |
128 // Used by TransferTerminated to figure if this action terminated itself or | 133 // Used by TransferTerminated to figure if this action terminated itself or |
129 // was terminated by the action processor. | 134 // was terminated by the action processor. |
130 ActionExitCode code_; | 135 ActionExitCode code_; |
131 | 136 |
132 // For reporting status to outsiders | 137 // For reporting status to outsiders |
133 DownloadActionDelegate* delegate_; | 138 DownloadActionDelegate* delegate_; |
134 uint64_t bytes_received_; | 139 uint64_t bytes_received_; |
135 | 140 |
141 // Called if the download fails OR (download success AND signiture verifies) | |
gauravsh
2011/04/06 00:07:23
nit: s/signiture/signature/
shouldn't the 2nd con
| |
142 scoped_ptr<google::protobuf::Closure> skip_reporting_signature_fail_; | |
143 | |
136 DISALLOW_COPY_AND_ASSIGN(DownloadAction); | 144 DISALLOW_COPY_AND_ASSIGN(DownloadAction); |
137 }; | 145 }; |
138 | 146 |
139 // We want to be sure that we're compiled with large file support on linux, | 147 // We want to be sure that we're compiled with large file support on linux, |
140 // just in case we find ourselves downloading large images. | 148 // just in case we find ourselves downloading large images. |
141 COMPILE_ASSERT(8 == sizeof(off_t), off_t_not_64_bit); | 149 COMPILE_ASSERT(8 == sizeof(off_t), off_t_not_64_bit); |
142 | 150 |
143 } // namespace chromeos_update_engine | 151 } // namespace chromeos_update_engine |
144 | 152 |
145 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_DOWNLOAD_ACTION_H__ | 153 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_DOWNLOAD_ACTION_H__ |
OLD | NEW |