Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Unified Diff: components/autofill/browser/autocheckout/whitelist_manager.h

Issue 13928035: WIP Component build of autofill Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make windows compiling Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/autofill/browser/autocheckout/whitelist_manager.h
diff --git a/components/autofill/browser/autocheckout/whitelist_manager.h b/components/autofill/browser/autocheckout/whitelist_manager.h
index bd607214d98a8577ff6afe2f213743ef2110d582..0a469e9bbfe61e5320c60018d44c590e95a077b9 100644
--- a/components/autofill/browser/autocheckout/whitelist_manager.h
+++ b/components/autofill/browser/autocheckout/whitelist_manager.h
@@ -1,107 +1,108 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_AUTOFILL_BROWSER_AUTOCHECKOUT_WHITELIST_MANAGER_H_
-#define COMPONENTS_AUTOFILL_BROWSER_AUTOCHECKOUT_WHITELIST_MANAGER_H_
-
-#include <string>
-#include <vector>
-
-#include "base/timer.h"
-#include "components/autofill/browser/autofill_metrics.h"
-#include "net/url_request/url_fetcher_delegate.h"
-
-class GURL;
-
-namespace content {
-class BrowserContext;
-}
-
-namespace net {
-class URLFetcher;
-class URLRequestContextGetter;
-}
-
-namespace autofill {
-namespace autocheckout {
-
-// Downloads and caches the list of URL prefixes whitelisted for use with
-// Autocheckout.
-class WhitelistManager : public net::URLFetcherDelegate {
- public:
- WhitelistManager();
- virtual ~WhitelistManager();
-
- // Schedule a fetch of the Autocheckout whitelist file if it's not already
- // loaded. This helps ensure that the whitelist will be available by the time
- // the user navigates to a form on which Autocheckout should be enabled.
- void Init(net::URLRequestContextGetter* context_getter);
-
- // Matches the url with whitelist and return the matched url prefix.
- // Returns empty string when it is not matched.
- std::string GetMatchedURLPrefix(const GURL& url) const;
-
- protected:
- // Schedules a future call to TriggerDownload if one isn't already pending.
- virtual void ScheduleDownload(size_t interval_seconds);
-
- // Start the download timer. It is called by ScheduleDownload(), and exposed
- // as a separate method for mocking out in tests.
- virtual void StartDownloadTimer(size_t interval_seconds);
-
- // Returns the |AutofillMetrics| instance that should be used for logging
- // Autocheckout whitelist file downloading.
- virtual const AutofillMetrics& GetMetricLogger() const;
-
- // Timer callback indicating it's time to download whitelist from server.
- void TriggerDownload();
-
- // Used by tests only.
- void StopDownloadTimer();
-
- const std::vector<std::string>& url_prefixes() const {
- return url_prefixes_;
- }
-
- private:
- // Implements net::URLFetcherDelegate.
- virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
-
- // Parse whitelist data and build whitelist.
- void BuildWhitelist(const std::string& data);
-
- // A list of whitelisted url prefixes.
- std::vector<std::string> url_prefixes_;
-
- base::OneShotTimer<WhitelistManager> download_timer_;
-
- // Indicates that the last triggered download hasn't resolved yet.
- bool callback_is_pending_;
-
- // The context for the request.
- net::URLRequestContextGetter* context_getter_; // WEAK
-
- // State of the kEnableExperimentalFormFilling flag.
- const bool experimental_form_filling_enabled_;
-
- // State of the kBypassAutocheckoutWhitelist flag.
- const bool bypass_autocheckout_whitelist_;
-
- // Logger for UMA metrics.
- AutofillMetrics metrics_logger_;
-
- // When the whitelist download started. Used to track download latency.
- base::Time request_started_timestamp_;
-
- // The request object.
- scoped_ptr<net::URLFetcher> request_;
-
- DISALLOW_COPY_AND_ASSIGN(WhitelistManager);
-};
-
-} // namespace autocheckout
-} // namespace autofill
-
-#endif // COMPONENTS_AUTOFILL_BROWSER_AUTOCHECKOUT_WHITELIST_MANAGER_H_
-
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_AUTOFILL_BROWSER_AUTOCHECKOUT_WHITELIST_MANAGER_H_
+#define COMPONENTS_AUTOFILL_BROWSER_AUTOCHECKOUT_WHITELIST_MANAGER_H_
+
+#include <string>
+#include <vector>
+
+#include "base/timer.h"
+#include "components/autofill/browser/autofill_metrics.h"
+#include "components/autofill/common/autofill_export.h"
+#include "net/url_request/url_fetcher_delegate.h"
+
+class GURL;
+
+namespace content {
+class BrowserContext;
+}
+
+namespace net {
+class URLFetcher;
+class URLRequestContextGetter;
+}
+
+namespace autofill {
+namespace autocheckout {
+
+// Downloads and caches the list of URL prefixes whitelisted for use with
+// Autocheckout.
+class AUTOFILL_EXPORT WhitelistManager : public net::URLFetcherDelegate {
+ public:
+ WhitelistManager();
+ virtual ~WhitelistManager();
+
+ // Schedule a fetch of the Autocheckout whitelist file if it's not already
+ // loaded. This helps ensure that the whitelist will be available by the time
+ // the user navigates to a form on which Autocheckout should be enabled.
+ void Init(net::URLRequestContextGetter* context_getter);
+
+ // Matches the url with whitelist and return the matched url prefix.
+ // Returns empty string when it is not matched.
+ std::string GetMatchedURLPrefix(const GURL& url) const;
+
+ protected:
+ // Schedules a future call to TriggerDownload if one isn't already pending.
+ virtual void ScheduleDownload(size_t interval_seconds);
+
+ // Start the download timer. It is called by ScheduleDownload(), and exposed
+ // as a separate method for mocking out in tests.
+ virtual void StartDownloadTimer(size_t interval_seconds);
+
+ // Returns the |AutofillMetrics| instance that should be used for logging
+ // Autocheckout whitelist file downloading.
+ virtual const AutofillMetrics& GetMetricLogger() const;
+
+ // Timer callback indicating it's time to download whitelist from server.
+ void TriggerDownload();
+
+ // Used by tests only.
+ void StopDownloadTimer();
+
+ const std::vector<std::string>& url_prefixes() const {
+ return url_prefixes_;
+ }
+
+ private:
+ // Implements net::URLFetcherDelegate.
+ virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
+
+ // Parse whitelist data and build whitelist.
+ void BuildWhitelist(const std::string& data);
+
+ // A list of whitelisted url prefixes.
+ std::vector<std::string> url_prefixes_;
+
+ base::OneShotTimer<WhitelistManager> download_timer_;
+
+ // Indicates that the last triggered download hasn't resolved yet.
+ bool callback_is_pending_;
+
+ // The context for the request.
+ net::URLRequestContextGetter* context_getter_; // WEAK
+
+ // State of the kEnableExperimentalFormFilling flag.
+ const bool experimental_form_filling_enabled_;
+
+ // State of the kBypassAutocheckoutWhitelist flag.
+ const bool bypass_autocheckout_whitelist_;
+
+ // Logger for UMA metrics.
+ AutofillMetrics metrics_logger_;
+
+ // When the whitelist download started. Used to track download latency.
+ base::Time request_started_timestamp_;
+
+ // The request object.
+ scoped_ptr<net::URLFetcher> request_;
+
+ DISALLOW_COPY_AND_ASSIGN(WhitelistManager);
+};
+
+} // namespace autocheckout
+} // namespace autofill
+
+#endif // COMPONENTS_AUTOFILL_BROWSER_AUTOCHECKOUT_WHITELIST_MANAGER_H_
+

Powered by Google App Engine
This is Rietveld 408576698