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