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 COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_DOWNLOAD_MANAGER_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_DOWNLOAD_MANAGER_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_DOWNLOAD_MANAGER_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_DOWNLOAD_MANAGER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <list> | 9 #include <list> |
10 #include <map> | 10 #include <map> |
| 11 #include <memory> |
11 #include <string> | 12 #include <string> |
12 #include <utility> | 13 #include <utility> |
13 #include <vector> | 14 #include <vector> |
14 | 15 |
15 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
16 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" |
17 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
18 #include "base/time/time.h" | 19 #include "base/time/time.h" |
19 #include "components/autofill/core/browser/autofill_type.h" | 20 #include "components/autofill/core/browser/autofill_type.h" |
20 #include "net/base/backoff_entry.h" | 21 #include "net/base/backoff_entry.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 // The AutofillDriver that this instance will use. Must not be null, and must | 129 // The AutofillDriver that this instance will use. Must not be null, and must |
129 // outlive this instance. | 130 // outlive this instance. |
130 AutofillDriver* const driver_; // WEAK | 131 AutofillDriver* const driver_; // WEAK |
131 | 132 |
132 // The observer to notify when server predictions are successfully received. | 133 // The observer to notify when server predictions are successfully received. |
133 // Must not be null. | 134 // Must not be null. |
134 AutofillDownloadManager::Observer* const observer_; // WEAK | 135 AutofillDownloadManager::Observer* const observer_; // WEAK |
135 | 136 |
136 // For each requested form for both query and upload we create a separate | 137 // For each requested form for both query and upload we create a separate |
137 // request and save its info. As url fetcher is identified by its address | 138 // request and save its info. As url fetcher is identified by its address |
138 // we use a map between fetchers and info. | 139 // we use a map between fetchers and info. The value type is a pair of an |
139 std::map<net::URLFetcher*, FormRequestData> url_fetchers_; | 140 // owning pointer to the key and the actual FormRequestData. |
| 141 std::map<net::URLFetcher*, |
| 142 std::pair<std::unique_ptr<net::URLFetcher>, FormRequestData>> |
| 143 url_fetchers_; |
140 | 144 |
141 // Cached QUERY requests. | 145 // Cached QUERY requests. |
142 QueryRequestCache cached_forms_; | 146 QueryRequestCache cached_forms_; |
143 size_t max_form_cache_size_; | 147 size_t max_form_cache_size_; |
144 | 148 |
145 // Used for exponential backoff of requests. | 149 // Used for exponential backoff of requests. |
146 net::BackoffEntry fetcher_backoff_; | 150 net::BackoffEntry fetcher_backoff_; |
147 | 151 |
148 // Needed for unit-test. | 152 // Needed for unit-test. |
149 int fetcher_id_for_unittest_; | 153 int fetcher_id_for_unittest_; |
150 | 154 |
151 base::WeakPtrFactory<AutofillDownloadManager> weak_factory_; | 155 base::WeakPtrFactory<AutofillDownloadManager> weak_factory_; |
152 }; | 156 }; |
153 | 157 |
154 } // namespace autofill | 158 } // namespace autofill |
155 | 159 |
156 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_DOWNLOAD_MANAGER_H_ | 160 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_DOWNLOAD_MANAGER_H_ |
OLD | NEW |