| 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> |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 // Debugging/logging | 82 // Debugging/logging |
| 83 static std::string StaticType() { return "DownloadAction"; } | 83 static std::string StaticType() { return "DownloadAction"; } |
| 84 std::string Type() const { return StaticType(); } | 84 std::string Type() const { return StaticType(); } |
| 85 | 85 |
| 86 // HttpFetcherDelegate methods (see http_fetcher.h) | 86 // HttpFetcherDelegate methods (see http_fetcher.h) |
| 87 virtual void ReceivedBytes(HttpFetcher *fetcher, | 87 virtual void ReceivedBytes(HttpFetcher *fetcher, |
| 88 const char* bytes, int length); | 88 const char* bytes, int length); |
| 89 virtual void SeekToOffset(off_t offset); | 89 virtual void SeekToOffset(off_t offset); |
| 90 virtual void TransferComplete(HttpFetcher *fetcher, bool successful); | 90 virtual void TransferComplete(HttpFetcher *fetcher, bool successful); |
| 91 virtual void TransferTerminated(HttpFetcher *fetcher); |
| 91 | 92 |
| 92 DownloadActionDelegate* delegate() const { return delegate_; } | 93 DownloadActionDelegate* delegate() const { return delegate_; } |
| 93 void set_delegate(DownloadActionDelegate* delegate) { | 94 void set_delegate(DownloadActionDelegate* delegate) { |
| 94 delegate_ = delegate; | 95 delegate_ = delegate; |
| 95 } | 96 } |
| 96 | 97 |
| 97 HttpFetcher* http_fetcher() { return http_fetcher_.get(); } | 98 HttpFetcher* http_fetcher() { return http_fetcher_.get(); } |
| 98 | 99 |
| 99 private: | 100 private: |
| 100 // The InstallPlan passed in | 101 // The InstallPlan passed in |
| (...skipping 16 matching lines...) Expand all Loading... |
| 117 | 118 |
| 118 // Used to apply a delta update: | 119 // Used to apply a delta update: |
| 119 scoped_ptr<DeltaPerformer> delta_performer_; | 120 scoped_ptr<DeltaPerformer> delta_performer_; |
| 120 | 121 |
| 121 // Pointer to the HttpFetcher that does the http work. | 122 // Pointer to the HttpFetcher that does the http work. |
| 122 scoped_ptr<HttpFetcher> http_fetcher_; | 123 scoped_ptr<HttpFetcher> http_fetcher_; |
| 123 | 124 |
| 124 // Used to find the hash of the bytes downloaded | 125 // Used to find the hash of the bytes downloaded |
| 125 OmahaHashCalculator omaha_hash_calculator_; | 126 OmahaHashCalculator omaha_hash_calculator_; |
| 126 | 127 |
| 128 // Used by TransferTerminated to figure if this action terminated itself or |
| 129 // was terminated by the action processor. |
| 130 ActionExitCode code_; |
| 131 |
| 127 // For reporting status to outsiders | 132 // For reporting status to outsiders |
| 128 DownloadActionDelegate* delegate_; | 133 DownloadActionDelegate* delegate_; |
| 129 uint64_t bytes_received_; | 134 uint64_t bytes_received_; |
| 130 | 135 |
| 131 DISALLOW_COPY_AND_ASSIGN(DownloadAction); | 136 DISALLOW_COPY_AND_ASSIGN(DownloadAction); |
| 132 }; | 137 }; |
| 133 | 138 |
| 134 // We want to be sure that we're compiled with large file support on linux, | 139 // We want to be sure that we're compiled with large file support on linux, |
| 135 // just in case we find ourselves downloading large images. | 140 // just in case we find ourselves downloading large images. |
| 136 COMPILE_ASSERT(8 == sizeof(off_t), off_t_not_64_bit); | 141 COMPILE_ASSERT(8 == sizeof(off_t), off_t_not_64_bit); |
| 137 | 142 |
| 138 } // namespace chromeos_update_engine | 143 } // namespace chromeos_update_engine |
| 139 | 144 |
| 140 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_DOWNLOAD_ACTION_H__ | 145 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_DOWNLOAD_ACTION_H__ |
| OLD | NEW |