OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CHROME_BROWSER_COMPONENT_UPDATER_CRX_UPDATE_ITEM_H_ | 5 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_CRX_UPDATE_ITEM_H_ |
6 #define CHROME_BROWSER_COMPONENT_UPDATER_CRX_UPDATE_ITEM_H_ | 6 #define CHROME_BROWSER_COMPONENT_UPDATER_CRX_UPDATE_ITEM_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "base/version.h" | 14 #include "base/version.h" |
15 #include "chrome/browser/component_updater/component_updater_service.h" | 15 #include "chrome/browser/component_updater/component_updater_service.h" |
16 #include "chrome/browser/component_updater/crx_downloader.h" | 16 #include "chrome/browser/component_updater/crx_downloader.h" |
17 | 17 |
18 namespace component_updater { | 18 namespace component_updater { |
19 | 19 |
20 class CUResourceThrottle; | |
21 | |
22 // This is the one and only per-item state structure. Designed to be hosted | 20 // This is the one and only per-item state structure. Designed to be hosted |
23 // in a std::vector or a std::list. The two main members are |component| | 21 // in a std::vector or a std::list. The two main members are |component| |
24 // which is supplied by the the component updater client and |status| which | 22 // which is supplied by the the component updater client and |status| which |
25 // is modified as the item is processed by the update pipeline. The expected | 23 // is modified as the item is processed by the update pipeline. The expected |
26 // transition graph is: | 24 // transition graph is: |
27 // | 25 // |
28 // on-demand on-demand | 26 // on-demand on-demand |
29 // +---------------------------> kNew <--------------+-------------+ | 27 // +---------------------------> kNew <--------------+-------------+ |
30 // | | | | | 28 // | | | | |
31 // | V | | | 29 // | V | | |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 // error itself. | 101 // error itself. |
104 int error_category; | 102 int error_category; |
105 int error_code; | 103 int error_code; |
106 int extra_code1; | 104 int extra_code1; |
107 int diff_error_category; | 105 int diff_error_category; |
108 int diff_error_code; | 106 int diff_error_code; |
109 int diff_extra_code1; | 107 int diff_extra_code1; |
110 | 108 |
111 std::vector<CrxDownloader::DownloadMetrics> download_metrics; | 109 std::vector<CrxDownloader::DownloadMetrics> download_metrics; |
112 | 110 |
113 std::vector<base::WeakPtr<CUResourceThrottle> > throttles; | 111 std::vector<base::Closure> ready_callbacks; |
114 | 112 |
115 CrxUpdateItem(); | 113 CrxUpdateItem(); |
116 ~CrxUpdateItem(); | 114 ~CrxUpdateItem(); |
117 | 115 |
118 // Function object used to find a specific component. | 116 // Function object used to find a specific component. |
119 class FindById { | 117 class FindById { |
120 public: | 118 public: |
121 explicit FindById(const std::string& id) : id_(id) {} | 119 explicit FindById(const std::string& id) : id_(id) {} |
122 | 120 |
123 bool operator()(CrxUpdateItem* item) const { return item->id == id_; } | 121 bool operator()(CrxUpdateItem* item) const { return item->id == id_; } |
124 | 122 |
125 private: | 123 private: |
126 const std::string& id_; | 124 const std::string& id_; |
127 }; | 125 }; |
128 }; | 126 }; |
129 | 127 |
130 } // namespace component_updater | 128 } // namespace component_updater |
131 | 129 |
132 #endif // CHROME_BROWSER_COMPONENT_UPDATER_CRX_UPDATE_ITEM_H_ | 130 #endif // CHROME_BROWSER_COMPONENT_UPDATER_CRX_UPDATE_ITEM_H_ |
OLD | NEW |