OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium 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 COMPONENTS_UPDATE_CLIENT_UPDATE_ENGINE_H_ | 5 #ifndef COMPONENTS_UPDATE_CLIENT_UPDATE_ENGINE_H_ |
6 #define COMPONENTS_UPDATE_CLIENT_UPDATE_ENGINE_H_ | 6 #define COMPONENTS_UPDATE_CLIENT_UPDATE_ENGINE_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <memory> | 9 #include <memory> |
10 #include <queue> | 10 #include <queue> |
11 #include <set> | 11 #include <set> |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/callback.h" | 15 #include "base/callback.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
18 #include "base/threading/thread_checker.h" | 18 #include "base/threading/thread_checker.h" |
19 #include "components/update_client/action.h" | 19 #include "components/update_client/action.h" |
20 #include "components/update_client/component_patcher_operation.h" | 20 #include "components/update_client/component_patcher_operation.h" |
21 #include "components/update_client/crx_downloader.h" | 21 #include "components/update_client/crx_downloader.h" |
22 #include "components/update_client/crx_update_item.h" | 22 #include "components/update_client/crx_update_item.h" |
23 #include "components/update_client/ping_manager.h" | 23 #include "components/update_client/ping_manager.h" |
24 #include "components/update_client/update_checker.h" | 24 #include "components/update_client/update_checker.h" |
25 #include "components/update_client/update_client.h" | 25 #include "components/update_client/update_client.h" |
26 | 26 |
27 namespace base { | 27 namespace base { |
| 28 class TimeTicks; |
28 class SequencedTaskRunner; | 29 class SequencedTaskRunner; |
29 class SingleThreadTaskRunner; | 30 class SingleThreadTaskRunner; |
30 } // namespace base | 31 } // namespace base |
31 | 32 |
32 namespace update_client { | 33 namespace update_client { |
33 | 34 |
34 class Configurator; | 35 class Configurator; |
35 struct CrxUpdateItem; | 36 struct CrxUpdateItem; |
36 struct UpdateContext; | 37 struct UpdateContext; |
37 | 38 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 // Called when CRX state changes occur. | 83 // Called when CRX state changes occur. |
83 const NotifyObserversCallback notify_observers_callback_; | 84 const NotifyObserversCallback notify_observers_callback_; |
84 | 85 |
85 // Contains the contexts associated with each update in progress. | 86 // Contains the contexts associated with each update in progress. |
86 std::set<UpdateContext*> update_contexts_; | 87 std::set<UpdateContext*> update_contexts_; |
87 | 88 |
88 // Implements a rate limiting mechanism for background update checks. Has the | 89 // Implements a rate limiting mechanism for background update checks. Has the |
89 // effect of rejecting the update call if the update call occurs before | 90 // effect of rejecting the update call if the update call occurs before |
90 // a certain time, which is negotiated with the server as part of the | 91 // a certain time, which is negotiated with the server as part of the |
91 // update protocol. See the comments for X-Retry-After header. | 92 // update protocol. See the comments for X-Retry-After header. |
92 base::Time throttle_updates_until_; | 93 base::TimeTicks throttle_updates_until_; |
93 | 94 |
94 DISALLOW_COPY_AND_ASSIGN(UpdateEngine); | 95 DISALLOW_COPY_AND_ASSIGN(UpdateEngine); |
95 }; | 96 }; |
96 | 97 |
97 // TODO(sorin): consider making this a ref counted type. | 98 // TODO(sorin): consider making this a ref counted type. |
98 struct UpdateContext { | 99 struct UpdateContext { |
99 UpdateContext( | 100 UpdateContext( |
100 const scoped_refptr<Configurator>& config, | 101 const scoped_refptr<Configurator>& config, |
101 bool is_foreground, | 102 bool is_foreground, |
102 const std::vector<std::string>& ids, | 103 const std::vector<std::string>& ids, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 // Contains the ids of the items to update. | 152 // Contains the ids of the items to update. |
152 std::queue<std::string> queue; | 153 std::queue<std::string> queue; |
153 | 154 |
154 // The time in seconds to wait until doing further update checks. | 155 // The time in seconds to wait until doing further update checks. |
155 int retry_after_sec_; | 156 int retry_after_sec_; |
156 }; | 157 }; |
157 | 158 |
158 } // namespace update_client | 159 } // namespace update_client |
159 | 160 |
160 #endif // COMPONENTS_UPDATE_CLIENT_UPDATE_ENGINE_H_ | 161 #endif // COMPONENTS_UPDATE_CLIENT_UPDATE_ENGINE_H_ |
OLD | NEW |