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

Unified Diff: chrome/browser/autofill/wallet/required_action.h

Issue 11777007: Adds wallet::RequiredAction for when we start interacting with Online Wallet. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comment fix Created 7 years, 11 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: chrome/browser/autofill/wallet/required_action.h
diff --git a/chrome/browser/autofill/wallet/required_action.h b/chrome/browser/autofill/wallet/required_action.h
new file mode 100644
index 0000000000000000000000000000000000000000..7a201f600e47b1b3f2b29829a6e4585825b3ace1
--- /dev/null
+++ b/chrome/browser/autofill/wallet/required_action.h
@@ -0,0 +1,59 @@
+// Copyright (c) 2012 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 CHROME_BROWSER_AUTOFILL_WALLET_REQUIRED_ACTION_H_
+#define CHROME_BROWSER_AUTOFILL_WALLET_REQUIRED_ACTION_H_
+
+#include <string>
+
+namespace wallet {
+
+class RequiredAction {
+ public:
+ // Matches wallet proto values.
+ enum ActionType {
+ UNKNOWN_TYPE = 0, // Catch all type, not in proto.
+ SETUP_WALLET = 1,
+ ACCEPT_TOS = 2,
+ GAIA_AUTH = 4,
+ UPDATE_EXPIRATION_DATE = 7,
+ UPGRADE_MIN_ADDRESS = 8,
+ INVALID_FORM_FIELD = 11,
+ CVC_RISK_CHALLENGE = 12,
+ };
+
+ RequiredAction();
+ explicit RequiredAction(ActionType action_type);
+ virtual ~RequiredAction();
+
+ // Static helper functions to determine if an ActionType applies to either a
+ // FullWallet or WalletItems.
+ static bool AppliesToFullWallet(ActionType action_type);
+ static bool AppliesToWalletItems(ActionType action_type);
+
+ // Turn a string value of the parsed JSON response into an ActionType.
+ static ActionType ParseFromString(const std::string& str);
+
+ ActionType action_type() const { return action_type_; }
+ void set_action_type(ActionType action_type) { action_type_ = action_type; }
+
+ // Helper functions to determine if this RequiredAction instance applies to
+ // either a FullWallet or WalletItems.
+ bool AppliesToFullWallet() const;
+ bool AppliesToWalletItems() const;
+
+ // Whether |action_type_| is a known type.
+ bool IsKnownType() const;
+
+ // Whether this RequiredAction is equivalent to another.
+ bool operator==(const RequiredAction& action) const;
+
+ private:
+ ActionType action_type_;
+ // Type intentionally copyable.
+};
+
+} // namespace wallet
+
+#endif // CHROME_BROWSER_AUTOFILL_WALLET_REQUIRED_ACTION_H_

Powered by Google App Engine
This is Rietveld 408576698