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_HTTP_FETCHER_H__ | 5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_HTTP_FETCHER_H__ |
6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_HTTP_FETCHER_H__ | 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_HTTP_FETCHER_H__ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 #include <glib.h> | 10 #include <glib.h> |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 82 |
83 // The delegate; may be NULL. | 83 // The delegate; may be NULL. |
84 HttpFetcherDelegate* delegate_; | 84 HttpFetcherDelegate* delegate_; |
85 private: | 85 private: |
86 DISALLOW_COPY_AND_ASSIGN(HttpFetcher); | 86 DISALLOW_COPY_AND_ASSIGN(HttpFetcher); |
87 }; | 87 }; |
88 | 88 |
89 // Interface for delegates | 89 // Interface for delegates |
90 class HttpFetcherDelegate { | 90 class HttpFetcherDelegate { |
91 public: | 91 public: |
92 // Called every time bytes are received, even if they are automatically | 92 // Called every time bytes are received. |
93 // delivered to an output file. | |
94 virtual void ReceivedBytes(HttpFetcher* fetcher, | 93 virtual void ReceivedBytes(HttpFetcher* fetcher, |
95 const char* bytes, | 94 const char* bytes, |
96 int length) = 0; | 95 int length) = 0; |
97 | 96 |
| 97 // Called if the fetcher seeks to a particular offset. |
| 98 virtual void SeekToOffset(off_t offset) {} |
| 99 |
98 // Called when the transfer has completed successfully or been somehow | 100 // Called when the transfer has completed successfully or been somehow |
99 // aborted. | 101 // aborted. |
100 virtual void TransferComplete(HttpFetcher* fetcher, bool successful) = 0; | 102 virtual void TransferComplete(HttpFetcher* fetcher, bool successful) = 0; |
101 }; | 103 }; |
102 | 104 |
103 } // namespace chromeos_update_engine | 105 } // namespace chromeos_update_engine |
104 | 106 |
105 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_HTTP_FETCHER_H__ | 107 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_HTTP_FETCHER_H__ |
OLD | NEW |