OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 EXTENSIONS_BROWSER_UPDATER_MANIFEST_FETCH_DATA_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_UPDATER_MANIFEST_FETCH_DATA_H_ | 6 #define EXTENSIONS_BROWSER_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> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
14 | 14 |
15 namespace extensions { | 15 namespace extensions { |
16 | 16 |
| 17 class ManifestFetchDataDelegate; |
| 18 |
17 // To save on server resources we can request updates for multiple extensions | 19 // To save on server resources we can request updates for multiple extensions |
18 // in one manifest check. This class helps us keep track of the id's for a | 20 // in one manifest check. This class helps us keep track of the id's for a |
19 // given fetch, building up the actual URL, and what if anything to include | 21 // given fetch, building up the actual URL, and what if anything to include |
20 // in the ping parameter. | 22 // in the ping parameter. |
21 class ManifestFetchData { | 23 class ManifestFetchData { |
22 public: | 24 public: |
23 static const int kNeverPinged = -1; | 25 static const int kNeverPinged = -1; |
24 | 26 |
25 // Each ping type is sent at most once per day. | 27 // Each ping type is sent at most once per day. |
26 enum PingType { | 28 enum PingType { |
(...skipping 12 matching lines...) Expand all Loading... |
39 int rollcall_days; | 41 int rollcall_days; |
40 int active_days; | 42 int active_days; |
41 // Wether the extension is enabled or not. | 43 // Wether the extension is enabled or not. |
42 bool is_enabled; | 44 bool is_enabled; |
43 | 45 |
44 PingData() : rollcall_days(0), active_days(0), is_enabled(true) {} | 46 PingData() : rollcall_days(0), active_days(0), is_enabled(true) {} |
45 PingData(int rollcall, int active, bool enabled) | 47 PingData(int rollcall, int active, bool enabled) |
46 : rollcall_days(rollcall), active_days(active), is_enabled(enabled) {} | 48 : rollcall_days(rollcall), active_days(active), is_enabled(enabled) {} |
47 }; | 49 }; |
48 | 50 |
49 ManifestFetchData(const GURL& update_url, int request_id); | 51 ManifestFetchData(const GURL& update_url, |
| 52 int request_id, |
| 53 ManifestFetchDataDelegate* delegate); |
50 ~ManifestFetchData(); | 54 ~ManifestFetchData(); |
51 | 55 |
52 // Returns true if this extension information was successfully added. If the | 56 // 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 | 57 // return value is false it means the full_url would have become too long, and |
54 // this ManifestFetchData object remains unchanged. | 58 // this ManifestFetchData object remains unchanged. |
55 bool AddExtension(const std::string& id, | 59 bool AddExtension(const std::string& id, |
56 const std::string& version, | 60 const std::string& version, |
57 const PingData* ping_data, | 61 const PingData* ping_data, |
58 const std::string& update_url_data, | 62 const std::string& update_url_data, |
59 const std::string& install_source); | 63 const std::string& install_source); |
(...skipping 29 matching lines...) Expand all Loading... |
89 // The base update url plus arguments indicating the id, version, etc. | 93 // The base update url plus arguments indicating the id, version, etc. |
90 // information about each extension. | 94 // information about each extension. |
91 GURL full_url_; | 95 GURL full_url_; |
92 | 96 |
93 // The set of request ids associated with this manifest fetch. If multiple | 97 // The set of request ids associated with this manifest fetch. If multiple |
94 // requests are trying to fetch the same manifest, they can be merged into | 98 // requests are trying to fetch the same manifest, they can be merged into |
95 // one fetch, so potentially multiple request ids can get associated with | 99 // one fetch, so potentially multiple request ids can get associated with |
96 // one ManifestFetchData. | 100 // one ManifestFetchData. |
97 std::set<int> request_ids_; | 101 std::set<int> request_ids_; |
98 | 102 |
| 103 // The delegate to use for fetch details. Must outlive this ManifestFetchData |
| 104 // instance. |
| 105 ManifestFetchDataDelegate* delegate_; |
| 106 |
99 DISALLOW_COPY_AND_ASSIGN(ManifestFetchData); | 107 DISALLOW_COPY_AND_ASSIGN(ManifestFetchData); |
100 }; | 108 }; |
101 | 109 |
102 } // namespace extensions | 110 } // namespace extensions |
103 | 111 |
104 #endif // CHROME_BROWSER_EXTENSIONS_UPDATER_MANIFEST_FETCH_DATA_H_ | 112 #endif // EXTENSIONS_BROWSER_UPDATER_MANIFEST_FETCH_DATA_H_ |
OLD | NEW |