OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_EXTENSIONS_UPDATER_MANIFEST_FETCH_DATA_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_UPDATER_MANIFEST_FETCH_DATA_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_UPDATER_MANIFEST_FETCH_DATA_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_UPDATER_MANIFEST_FETCH_DATA_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 ManifestFetchData(const GURL& update_url, int request_id); | 49 ManifestFetchData(const GURL& update_url, int request_id); |
50 ~ManifestFetchData(); | 50 ~ManifestFetchData(); |
51 | 51 |
52 // Returns true if this extension information was successfully added. If the | 52 // Returns true if this extension information was successfully added. If the |
53 // return value is false it means the full_url would have become too long, and | 53 // return value is false it means the full_url would have become too long, and |
54 // this ManifestFetchData object remains unchanged. | 54 // this ManifestFetchData object remains unchanged. |
55 bool AddExtension(const std::string& id, | 55 bool AddExtension(const std::string& id, |
56 const std::string& version, | 56 const std::string& version, |
57 const PingData* ping_data, | 57 const PingData* ping_data, |
58 const std::string& update_url_data, | 58 const std::string& update_url_data, |
59 const std::string& install_source, | 59 const std::string& install_source); |
60 bool force_update); | |
61 | 60 |
62 const GURL& base_url() const { return base_url_; } | 61 const GURL& base_url() const { return base_url_; } |
63 const GURL& full_url() const { return full_url_; } | 62 const GURL& full_url() const { return full_url_; } |
64 const std::set<std::string>& extension_ids() const { return extension_ids_; } | 63 const std::set<std::string>& extension_ids() const { return extension_ids_; } |
65 const std::set<int>& request_ids() const { return request_ids_; } | 64 const std::set<int>& request_ids() const { return request_ids_; } |
66 | 65 |
67 // Returns true if the given id is included in this manifest fetch. | 66 // Returns true if the given id is included in this manifest fetch. |
68 bool Includes(const std::string& extension_id) const; | 67 bool Includes(const std::string& extension_id) const; |
69 | 68 |
70 // Returns true if a ping parameter for |type| was added to full_url for this | 69 // Returns true if a ping parameter for |type| was added to full_url for this |
71 // extension id. | 70 // extension id. |
72 bool DidPing(const std::string& extension_id, PingType type) const; | 71 bool DidPing(const std::string& extension_id, PingType type) const; |
73 | 72 |
74 // Assuming that both this ManifestFetchData and |other| have the same | 73 // Assuming that both this ManifestFetchData and |other| have the same |
75 // full_url, this method merges the other information associated with the | 74 // full_url, this method merges the other information associated with the |
76 // fetch (in particular this adds all request ids associated with |other| | 75 // fetch (in particular this adds all request ids associated with |other| |
77 // to this ManifestFetchData). | 76 // to this ManifestFetchData). |
78 void Merge(const ManifestFetchData& other); | 77 void Merge(const ManifestFetchData& other); |
79 | 78 |
80 // Returns |true| if a given extension was forced to update. | |
81 bool DidForceUpdate(const std::string& extension_id) const; | |
82 | |
83 private: | 79 private: |
84 // The set of extension id's for this ManifestFetchData. | 80 // The set of extension id's for this ManifestFetchData. |
85 std::set<std::string> extension_ids_; | 81 std::set<std::string> extension_ids_; |
86 | 82 |
87 // The set of ping data we actually sent. | 83 // The set of ping data we actually sent. |
88 std::map<std::string, PingData> pings_; | 84 std::map<std::string, PingData> pings_; |
89 | 85 |
90 // The base update url without any arguments added. | 86 // The base update url without any arguments added. |
91 GURL base_url_; | 87 GURL base_url_; |
92 | 88 |
93 // The base update url plus arguments indicating the id, version, etc. | 89 // The base update url plus arguments indicating the id, version, etc. |
94 // information about each extension. | 90 // information about each extension. |
95 GURL full_url_; | 91 GURL full_url_; |
96 | 92 |
97 // The set of request ids associated with this manifest fetch. If multiple | 93 // The set of request ids associated with this manifest fetch. If multiple |
98 // requests are trying to fetch the same manifest, they can be merged into | 94 // requests are trying to fetch the same manifest, they can be merged into |
99 // one fetch, so potentially multiple request ids can get associated with | 95 // one fetch, so potentially multiple request ids can get associated with |
100 // one ManifestFetchData. | 96 // one ManifestFetchData. |
101 std::set<int> request_ids_; | 97 std::set<int> request_ids_; |
102 | 98 |
103 // The set of extension IDs for which this fetch forced a CRX update. | |
104 std::set<std::string> forced_updates_; | |
105 | |
106 DISALLOW_COPY_AND_ASSIGN(ManifestFetchData); | 99 DISALLOW_COPY_AND_ASSIGN(ManifestFetchData); |
107 }; | 100 }; |
108 | 101 |
109 } // namespace extensions | 102 } // namespace extensions |
110 | 103 |
111 #endif // CHROME_BROWSER_EXTENSIONS_UPDATER_MANIFEST_FETCH_DATA_H_ | 104 #endif // CHROME_BROWSER_EXTENSIONS_UPDATER_MANIFEST_FETCH_DATA_H_ |
OLD | NEW |