OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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 // An object to record and send user feedback to spelling service. The spelling | 5 // An object to record and send user feedback to spelling service. The spelling |
6 // service uses the feedback to improve its suggestions. | 6 // service uses the feedback to improve its suggestions. |
7 // | 7 // |
8 // Assigns uint32_t hash identifiers to spelling suggestions from spelling | 8 // Assigns uint32_t hash identifiers to spelling suggestions from spelling |
9 // service and stores these suggestions. Records user's actions on these | 9 // service and stores these suggestions. Records user's actions on these |
10 // suggestions. Periodically sends batches of user feedback to the spelling | 10 // suggestions. Periodically sends batches of user feedback to the spelling |
11 // service. | 11 // service. |
12 | 12 |
13 #ifndef COMPONENTS_SPELLCHECK_BROWSER_FEEDBACK_SENDER_H_ | 13 #ifndef COMPONENTS_SPELLCHECK_BROWSER_FEEDBACK_SENDER_H_ |
14 #define COMPONENTS_SPELLCHECK_BROWSER_FEEDBACK_SENDER_H_ | 14 #define COMPONENTS_SPELLCHECK_BROWSER_FEEDBACK_SENDER_H_ |
15 | 15 |
16 #include <stddef.h> | 16 #include <stddef.h> |
17 #include <stdint.h> | 17 #include <stdint.h> |
18 | 18 |
19 #include <array> | 19 #include <array> |
20 #include <climits> | 20 #include <climits> |
21 #include <map> | 21 #include <map> |
22 #include <set> | 22 #include <set> |
23 #include <vector> | 23 #include <vector> |
24 | 24 |
25 #include "base/macros.h" | 25 #include "base/macros.h" |
| 26 #include "base/memory/scoped_vector.h" |
26 #include "base/memory/weak_ptr.h" | 27 #include "base/memory/weak_ptr.h" |
27 #include "base/timer/timer.h" | 28 #include "base/timer/timer.h" |
28 #include "components/spellcheck/browser/feedback.h" | 29 #include "components/spellcheck/browser/feedback.h" |
29 #include "components/spellcheck/browser/misspelling.h" | 30 #include "components/spellcheck/browser/misspelling.h" |
30 #include "net/url_request/url_fetcher_delegate.h" | 31 #include "net/url_request/url_fetcher_delegate.h" |
31 #include "url/gurl.h" | 32 #include "url/gurl.h" |
32 | 33 |
33 class SpellCheckMarker; | 34 class SpellCheckMarker; |
34 struct SpellCheckResult; | 35 struct SpellCheckResult; |
35 | 36 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 | 179 |
179 // A timer to periodically request a list of document spelling markers from | 180 // A timer to periodically request a list of document spelling markers from |
180 // all of the renderers. The timer starts in StartFeedbackCollection() and | 181 // all of the renderers. The timer starts in StartFeedbackCollection() and |
181 // stops in StopFeedbackCollection(). The timer stops and abandons its tasks | 182 // stops in StopFeedbackCollection(). The timer stops and abandons its tasks |
182 // on destruction. | 183 // on destruction. |
183 base::RepeatingTimer timer_; | 184 base::RepeatingTimer timer_; |
184 | 185 |
185 // Feedback senders that need to stay alive for the duration of sending data. | 186 // Feedback senders that need to stay alive for the duration of sending data. |
186 // If a sender is destroyed before it finishes, then sending feedback will be | 187 // If a sender is destroyed before it finishes, then sending feedback will be |
187 // canceled. | 188 // canceled. |
188 std::vector<std::unique_ptr<net::URLFetcher>> senders_; | 189 ScopedVector<net::URLFetcher> senders_; |
189 | 190 |
190 DISALLOW_COPY_AND_ASSIGN(FeedbackSender); | 191 DISALLOW_COPY_AND_ASSIGN(FeedbackSender); |
191 }; | 192 }; |
192 | 193 |
193 } // namespace spellcheck | 194 } // namespace spellcheck |
194 | 195 |
195 #endif // COMPONENTS_SPELLCHECK_BROWSER_FEEDBACK_SENDER_H_ | 196 #endif // COMPONENTS_SPELLCHECK_BROWSER_FEEDBACK_SENDER_H_ |
OLD | NEW |