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

Unified Diff: components/autofill/core/browser/server_field_types_util.cc

Issue 974323002: Componentize autofill dialog common code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add missing includes Created 5 years, 9 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
« no previous file with comments | « components/autofill/core/browser/server_field_types_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/core/browser/server_field_types_util.cc
diff --git a/chrome/browser/ui/autofill/autofill_dialog_common.cc b/components/autofill/core/browser/server_field_types_util.cc
similarity index 63%
copy from chrome/browser/ui/autofill/autofill_dialog_common.cc
copy to components/autofill/core/browser/server_field_types_util.cc
index fd2cadce4333e02f406500bec99a1db0662909b2..7922eddd9b98e8dd6d2ecf24f652b28de31c0f9f 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_common.cc
+++ b/components/autofill/core/browser/server_field_types_util.cc
@@ -1,17 +1,13 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2015 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/ui/autofill/autofill_dialog_common.h"
+#include "components/autofill/core/browser/server_field_types_util.h"
-#include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/browser_process.h"
-#include "components/autofill/core/browser/autofill_country.h"
#include "components/autofill/core/browser/autofill_field.h"
#include "components/autofill/core/browser/autofill_type.h"
namespace autofill {
-namespace common {
bool ServerTypeEncompassesFieldType(ServerFieldType type,
const AutofillType& field_type) {
@@ -37,9 +33,8 @@ bool ServerTypeEncompassesFieldType(ServerFieldType type,
// The page may ask for individual address lines; this roughly matches the
// street address blob.
- if (server_type == ADDRESS_HOME_LINE1 ||
- server_type == ADDRESS_HOME_LINE2 ||
- server_type == ADDRESS_HOME_LINE3) {
+ if (server_type == ADDRESS_HOME_LINE1 || server_type == ADDRESS_HOME_LINE2 ||
+ server_type == ADDRESS_HOME_LINE3) {
return autofill_type.GetStorableType() == ADDRESS_HOME_STREET_ADDRESS;
}
@@ -77,46 +72,6 @@ void BuildInputs(const DetailInput* input_template,
}
}
-AutofillMetrics::DialogUiEvent DialogSectionToUiItemAddedEvent(
- DialogSection section) {
- switch (section) {
- case SECTION_BILLING:
- return AutofillMetrics::DIALOG_UI_BILLING_ITEM_ADDED;
-
- case SECTION_CC_BILLING:
- return AutofillMetrics::DIALOG_UI_CC_BILLING_ITEM_ADDED;
-
- case SECTION_SHIPPING:
- return AutofillMetrics::DIALOG_UI_SHIPPING_ITEM_ADDED;
-
- case SECTION_CC:
- return AutofillMetrics::DIALOG_UI_CC_ITEM_ADDED;
- }
-
- NOTREACHED();
- return AutofillMetrics::NUM_DIALOG_UI_EVENTS;
-}
-
-AutofillMetrics::DialogUiEvent DialogSectionToUiSelectionChangedEvent(
- DialogSection section) {
- switch (section) {
- case SECTION_BILLING:
- return AutofillMetrics::DIALOG_UI_BILLING_SELECTED_SUGGESTION_CHANGED;
-
- case SECTION_CC_BILLING:
- return AutofillMetrics::DIALOG_UI_CC_BILLING_SELECTED_SUGGESTION_CHANGED;
-
- case SECTION_SHIPPING:
- return AutofillMetrics::DIALOG_UI_SHIPPING_SELECTED_SUGGESTION_CHANGED;
-
- case SECTION_CC:
- return AutofillMetrics::DIALOG_UI_CC_SELECTED_SUGGESTION_CHANGED;
- }
-
- NOTREACHED();
- return AutofillMetrics::NUM_DIALOG_UI_EVENTS;
-}
-
std::vector<ServerFieldType> TypesFromInputs(const DetailInputs& inputs) {
std::vector<ServerFieldType> types;
for (size_t i = 0; i < inputs.size(); ++i) {
@@ -125,5 +80,4 @@ std::vector<ServerFieldType> TypesFromInputs(const DetailInputs& inputs) {
return types;
}
-} // namespace common
} // namespace autofill
« no previous file with comments | « components/autofill/core/browser/server_field_types_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698