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 #ifndef COMPONENTS_AUTOFILL_BROWSER_AUTOCHECKOUT_WHITELIST_MANAGER_H_ | 5 #ifndef COMPONENTS_AUTOFILL_BROWSER_AUTOCHECKOUT_WHITELIST_MANAGER_H_ |
6 #define COMPONENTS_AUTOFILL_BROWSER_AUTOCHECKOUT_WHITELIST_MANAGER_H_ | 6 #define COMPONENTS_AUTOFILL_BROWSER_AUTOCHECKOUT_WHITELIST_MANAGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/timer.h" | 11 #include "base/timer.h" |
| 12 #include "components/autofill/browser/autofill_metrics.h" |
12 #include "net/url_request/url_fetcher_delegate.h" | 13 #include "net/url_request/url_fetcher_delegate.h" |
13 | 14 |
14 class GURL; | 15 class GURL; |
15 | 16 |
16 namespace content { | 17 namespace content { |
17 class BrowserContext; | 18 class BrowserContext; |
18 } | 19 } |
19 | 20 |
20 namespace net { | 21 namespace net { |
21 class URLFetcher; | 22 class URLFetcher; |
(...skipping 20 matching lines...) Expand all Loading... |
42 std::string GetMatchedURLPrefix(const GURL& url) const; | 43 std::string GetMatchedURLPrefix(const GURL& url) const; |
43 | 44 |
44 protected: | 45 protected: |
45 // Schedules a future call to TriggerDownload if one isn't already pending. | 46 // Schedules a future call to TriggerDownload if one isn't already pending. |
46 virtual void ScheduleDownload(size_t interval_seconds); | 47 virtual void ScheduleDownload(size_t interval_seconds); |
47 | 48 |
48 // Start the download timer. It is called by ScheduleDownload(), and exposed | 49 // Start the download timer. It is called by ScheduleDownload(), and exposed |
49 // as a separate method for mocking out in tests. | 50 // as a separate method for mocking out in tests. |
50 virtual void StartDownloadTimer(size_t interval_seconds); | 51 virtual void StartDownloadTimer(size_t interval_seconds); |
51 | 52 |
| 53 // Returns the |AutofillMetrics| instance that should be used for logging |
| 54 // Autocheckout whitelist file downloading. |
| 55 virtual const AutofillMetrics& GetMetricLogger() const; |
| 56 |
52 // Timer callback indicating it's time to download whitelist from server. | 57 // Timer callback indicating it's time to download whitelist from server. |
53 void TriggerDownload(); | 58 void TriggerDownload(); |
54 | 59 |
55 // Used by tests only. | 60 // Used by tests only. |
56 void StopDownloadTimer(); | 61 void StopDownloadTimer(); |
57 | 62 |
58 const std::vector<std::string>& url_prefixes() const { | 63 const std::vector<std::string>& url_prefixes() const { |
59 return url_prefixes_; | 64 return url_prefixes_; |
60 } | 65 } |
61 | 66 |
(...skipping 14 matching lines...) Expand all Loading... |
76 | 81 |
77 // The context for the request. | 82 // The context for the request. |
78 net::URLRequestContextGetter* context_getter_; // WEAK | 83 net::URLRequestContextGetter* context_getter_; // WEAK |
79 | 84 |
80 // State of the kEnableExperimentalFormFilling flag. | 85 // State of the kEnableExperimentalFormFilling flag. |
81 const bool experimental_form_filling_enabled_; | 86 const bool experimental_form_filling_enabled_; |
82 | 87 |
83 // State of the kBypassAutocheckoutWhitelist flag. | 88 // State of the kBypassAutocheckoutWhitelist flag. |
84 const bool bypass_autocheckout_whitelist_; | 89 const bool bypass_autocheckout_whitelist_; |
85 | 90 |
| 91 // Logger for UMA metrics. |
| 92 AutofillMetrics metrics_logger_; |
| 93 |
| 94 // When the whitelist download started. Used to track download latency. |
| 95 base::Time request_started_timestamp_; |
| 96 |
86 // The request object. | 97 // The request object. |
87 scoped_ptr<net::URLFetcher> request_; | 98 scoped_ptr<net::URLFetcher> request_; |
88 | 99 |
89 DISALLOW_COPY_AND_ASSIGN(WhitelistManager); | 100 DISALLOW_COPY_AND_ASSIGN(WhitelistManager); |
90 }; | 101 }; |
91 | 102 |
92 } // namespace autocheckout | 103 } // namespace autocheckout |
93 } // namespace autofill | 104 } // namespace autofill |
94 | 105 |
95 #endif // COMPONENTS_AUTOFILL_BROWSER_AUTOCHECKOUT_WHITELIST_MANAGER_H_ | 106 #endif // COMPONENTS_AUTOFILL_BROWSER_AUTOCHECKOUT_WHITELIST_MANAGER_H_ |
96 | 107 |
OLD | NEW |