| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_CRX_UPDATE_ITEM_H_ |
| 6 #define CHROME_BROWSER_COMPONENT_UPDATER_CRX_UPDATE_ITEM_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/basictypes.h" |
| 12 #include "base/time/time.h" |
| 13 #include "base/version.h" |
| 14 #include "chrome/browser/component_updater/component_updater_service.h" |
| 15 |
| 16 // This is the one and only per-item state structure. Designed to be hosted |
| 17 // in a std::vector or a std::list. The two main members are |component| |
| 18 // which is supplied by the the component updater client and |status| which |
| 19 // is modified as the item is processed by the update pipeline. The expected |
| 20 // transition graph is: |
| 21 // |
| 22 // kNew |
| 23 // | |
| 24 // V |
| 25 // +----------------------> kChecking -<---------+-----<-------+ |
| 26 // | | | | |
| 27 // | error V no | | |
| 28 // kNoUpdate <---------------- [update?] ->---- kUpToDate kUpdated |
| 29 // ^ | ^ |
| 30 // | yes | | |
| 31 // | diff=false V | |
| 32 // | +-----------> kCanUpdate | |
| 33 // | | | | |
| 34 // | | V no | |
| 35 // | | [differential update?]->----+ | |
| 36 // | | | | | |
| 37 // | | yes | | | |
| 38 // | | error V | | |
| 39 // | +---------<- kDownloadingDiff | | |
| 40 // | | | | | |
| 41 // | | | | | |
| 42 // | | error V | | |
| 43 // | +---------<- kUpdatingDiff ->--------|-----------+ success |
| 44 // | | | |
| 45 // | error V | |
| 46 // +----------------------------------------- kDownloading | |
| 47 // | | | |
| 48 // | error V | |
| 49 // +------------------------------------------ kUpdating ->----+ success |
| 50 // |
| 51 struct CrxUpdateItem { |
| 52 enum Status { |
| 53 kNew, |
| 54 kChecking, |
| 55 kCanUpdate, |
| 56 kDownloadingDiff, |
| 57 kDownloading, |
| 58 kUpdatingDiff, |
| 59 kUpdating, |
| 60 kUpdated, |
| 61 kUpToDate, |
| 62 kNoUpdate, |
| 63 kLastStatus |
| 64 }; |
| 65 |
| 66 Status status; |
| 67 std::string id; |
| 68 CrxComponent component; |
| 69 |
| 70 base::Time last_check; |
| 71 |
| 72 // The url the full and differential update CRXs are downloaded from. |
| 73 GURL crx_url; |
| 74 GURL diff_crx_url; |
| 75 |
| 76 // The from/to version and fingerprint values. |
| 77 Version previous_version; |
| 78 Version next_version; |
| 79 std::string previous_fp; |
| 80 std::string next_fp; |
| 81 |
| 82 // True if the differential update failed for any reason. |
| 83 bool diff_update_failed; |
| 84 |
| 85 // The error information for full and differential updates. |
| 86 // The |error_category| contains a hint about which module in the component |
| 87 // updater generated the error. The |error_code| constains the error and |
| 88 // the |extra_code1| usually contains a system error, but it can contain |
| 89 // any extended information that is relevant to either the category or the |
| 90 // error itself. |
| 91 int error_category; |
| 92 int error_code; |
| 93 int extra_code1; |
| 94 int diff_error_category; |
| 95 int diff_error_code; |
| 96 int diff_extra_code1; |
| 97 |
| 98 CrxUpdateItem(); |
| 99 ~CrxUpdateItem(); |
| 100 |
| 101 // Function object used to find a specific component. |
| 102 class FindById { |
| 103 public: |
| 104 explicit FindById(const std::string& id) : id_(id) {} |
| 105 |
| 106 bool operator() (CrxUpdateItem* item) const { |
| 107 return (item->id == id_); |
| 108 } |
| 109 private: |
| 110 const std::string& id_; |
| 111 }; |
| 112 }; |
| 113 |
| 114 #endif // CHROME_BROWSER_COMPONENT_UPDATER_CRX_UPDATE_ITEM_H_ |
| OLD | NEW |