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

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

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: class -> namespace 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.cc
diff --git a/chrome/browser/autofill/wallet/required_action.cc b/chrome/browser/autofill/wallet/required_action.cc
new file mode 100644
index 0000000000000000000000000000000000000000..020a8f2ba6699ee140ec20c743b867a37c0a6aa1
--- /dev/null
+++ b/chrome/browser/autofill/wallet/required_action.cc
@@ -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.
+
+#include "chrome/browser/autofill/wallet/required_action.h"
+
+#include "base/logging.h"
+#include "base/string_util.h"
+
+namespace wallet {
+
+bool AppliesToFullWallet(RequiredAction action) {
+ switch (action) {
+ case UPDATE_EXPIRATION_DATE:
+ case UPGRADE_MIN_ADDRESS:
+ case INVALID_FORM_FIELD:
+ case CVC_RISK_CHALLENGE:
+ return true;
+ default:
+ return false;
+ }
Ilya Sherman 2013/01/05 23:30:49 Optional nit: I would write this as "return action
Dan Beam 2013/01/07 15:44:53 Done.
+}
+
+bool AppliesToWalletItems(RequiredAction action) {
+ switch (action) {
+ case SETUP_WALLET:
+ case ACCEPT_TOS:
+ case GAIA_AUTH:
+ case INVALID_FORM_FIELD:
+ return true;
+ default:
+ return false;
+ }
+}
+
+RequiredAction ParseFromString(const std::string& str) {
+ std::string str_lower;
+ TrimWhitespaceASCII(StringToLowerASCII(str), TRIM_ALL, &str_lower);
+
+ if (str_lower == "setup_wallet")
+ return SETUP_WALLET;
+ else if (str_lower == "accept_tos")
+ return ACCEPT_TOS;
+ else if (str_lower == "gaia_auth")
+ return GAIA_AUTH;
+ else if (str_lower == "update_expiration_date")
+ return UPDATE_EXPIRATION_DATE;
+ else if (str_lower == "upgrade_min_address")
+ return UPGRADE_MIN_ADDRESS;
+ else if (str_lower == "invalid_form_field")
+ return INVALID_FORM_FIELD;
+ else if (str_lower == "cvc_risk_challenge")
+ return CVC_RISK_CHALLENGE;
+
+ DLOG(ERROR) << "Failed to parse: \"" << str << "\" as a required action";
+ return UNKNOWN_TYPE;
+}
+
+} // namespace wallet

Powered by Google App Engine
This is Rietveld 408576698