OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #include "components/autofill/core/browser/autofill_manager.h" | 5 #include "components/autofill/core/browser/autofill_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 #include "components/autofill/core/common/autofill_constants.h" | 53 #include "components/autofill/core/common/autofill_constants.h" |
54 #include "components/autofill/core/common/autofill_data_validation.h" | 54 #include "components/autofill/core/common/autofill_data_validation.h" |
55 #include "components/autofill/core/common/autofill_pref_names.h" | 55 #include "components/autofill/core/common/autofill_pref_names.h" |
56 #include "components/autofill/core/common/autofill_util.h" | 56 #include "components/autofill/core/common/autofill_util.h" |
57 #include "components/autofill/core/common/form_data.h" | 57 #include "components/autofill/core/common/form_data.h" |
58 #include "components/autofill/core/common/form_data_predictions.h" | 58 #include "components/autofill/core/common/form_data_predictions.h" |
59 #include "components/autofill/core/common/form_field_data.h" | 59 #include "components/autofill/core/common/form_field_data.h" |
60 #include "components/autofill/core/common/password_form_fill_data.h" | 60 #include "components/autofill/core/common/password_form_fill_data.h" |
61 #include "components/pref_registry/pref_registry_syncable.h" | 61 #include "components/pref_registry/pref_registry_syncable.h" |
62 #include "components/prefs/pref_service.h" | 62 #include "components/prefs/pref_service.h" |
63 #include "components/rappor/rappor_utils.h" | 63 #include "components/rappor/public/rappor_utils.h" |
| 64 #include "components/rappor/rappor_service_impl.h" |
64 #include "google_apis/gaia/identity_provider.h" | 65 #include "google_apis/gaia/identity_provider.h" |
65 #include "grit/components_strings.h" | 66 #include "grit/components_strings.h" |
66 #include "ui/base/l10n/l10n_util.h" | 67 #include "ui/base/l10n/l10n_util.h" |
67 #include "ui/gfx/geometry/rect.h" | 68 #include "ui/gfx/geometry/rect.h" |
68 #include "url/gurl.h" | 69 #include "url/gurl.h" |
69 | 70 |
70 #if defined(OS_IOS) | 71 #if defined(OS_IOS) |
71 #include "components/autofill/core/browser/keyboard_accessory_metrics_logger.h" | 72 #include "components/autofill/core/browser/keyboard_accessory_metrics_logger.h" |
72 #endif | 73 #endif |
73 | 74 |
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 } | 943 } |
943 std::reverse(queried_forms.begin(), queried_forms.end()); | 944 std::reverse(queried_forms.begin(), queried_forms.end()); |
944 | 945 |
945 // If there are no current forms corresponding to the queried signatures, drop | 946 // If there are no current forms corresponding to the queried signatures, drop |
946 // the query response. | 947 // the query response. |
947 if (queried_forms.empty()) | 948 if (queried_forms.empty()) |
948 return; | 949 return; |
949 | 950 |
950 // Parse and store the server predictions. | 951 // Parse and store the server predictions. |
951 FormStructure::ParseQueryResponse(std::move(response), queried_forms, | 952 FormStructure::ParseQueryResponse(std::move(response), queried_forms, |
952 client_->GetRapporService()); | 953 client_->GetRapporServiceImpl()); |
953 | 954 |
954 // Will log quality metrics for each FormStructure based on the presence of | 955 // Will log quality metrics for each FormStructure based on the presence of |
955 // autocomplete attributes, if available. | 956 // autocomplete attributes, if available. |
956 for (FormStructure* cur_form : queried_forms) | 957 for (FormStructure* cur_form : queried_forms) |
957 cur_form->LogQualityMetricsBasedOnAutocomplete(); | 958 cur_form->LogQualityMetricsBasedOnAutocomplete(); |
958 | 959 |
959 // Forward form structures to the password generation manager to detect | 960 // Forward form structures to the password generation manager to detect |
960 // account creation forms. | 961 // account creation forms. |
961 driver_->PropagateAutofillPredictions(queried_forms); | 962 driver_->PropagateAutofillPredictions(queried_forms); |
962 | 963 |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1262 AutofillMetrics::UPLOAD_NOT_OFFERED_NO_ZIP_CODE); | 1263 AutofillMetrics::UPLOAD_NOT_OFFERED_NO_ZIP_CODE); |
1263 return false; | 1264 return false; |
1264 } | 1265 } |
1265 | 1266 |
1266 profiles->assign(candidate_profiles.begin(), candidate_profiles.end()); | 1267 profiles->assign(candidate_profiles.begin(), candidate_profiles.end()); |
1267 return true; | 1268 return true; |
1268 } | 1269 } |
1269 | 1270 |
1270 void AutofillManager::CollectRapportSample(const GURL& source_url, | 1271 void AutofillManager::CollectRapportSample(const GURL& source_url, |
1271 const char* metric_name) const { | 1272 const char* metric_name) const { |
1272 if (source_url.is_valid() && client_->GetRapporService()) { | 1273 if (source_url.is_valid() && client_->GetRapporServiceImpl()) { |
1273 rappor::SampleDomainAndRegistryFromGURL(client_->GetRapporService(), | 1274 rappor::SampleDomainAndRegistryFromGURL(client_->GetRapporServiceImpl(), |
1274 metric_name, source_url); | 1275 metric_name, source_url); |
1275 } | 1276 } |
1276 } | 1277 } |
1277 | 1278 |
1278 // Note that |submitted_form| is passed as a pointer rather than as a reference | 1279 // Note that |submitted_form| is passed as a pointer rather than as a reference |
1279 // so that we can get memory management right across threads. Note also that we | 1280 // so that we can get memory management right across threads. Note also that we |
1280 // explicitly pass in all the time stamps of interest, as the cached ones might | 1281 // explicitly pass in all the time stamps of interest, as the cached ones might |
1281 // get reset before this method executes. | 1282 // get reset before this method executes. |
1282 void AutofillManager::UploadFormDataAsyncCallback( | 1283 void AutofillManager::UploadFormDataAsyncCallback( |
1283 const FormStructure* submitted_form, | 1284 const FormStructure* submitted_form, |
1284 const TimeTicks& load_time, | 1285 const TimeTicks& load_time, |
1285 const TimeTicks& interaction_time, | 1286 const TimeTicks& interaction_time, |
1286 const TimeTicks& submission_time, | 1287 const TimeTicks& submission_time, |
1287 bool observed_submission) { | 1288 bool observed_submission) { |
1288 submitted_form->LogQualityMetrics( | 1289 submitted_form->LogQualityMetrics(load_time, interaction_time, |
1289 load_time, interaction_time, submission_time, client_->GetRapporService(), | 1290 submission_time, |
1290 did_show_suggestions_, observed_submission); | 1291 client_->GetRapporServiceImpl(), |
| 1292 did_show_suggestions_, observed_submission); |
1291 | 1293 |
1292 if (submitted_form->ShouldBeCrowdsourced()) | 1294 if (submitted_form->ShouldBeCrowdsourced()) |
1293 UploadFormData(*submitted_form, observed_submission); | 1295 UploadFormData(*submitted_form, observed_submission); |
1294 } | 1296 } |
1295 | 1297 |
1296 void AutofillManager::UploadFormData(const FormStructure& submitted_form, | 1298 void AutofillManager::UploadFormData(const FormStructure& submitted_form, |
1297 bool observed_submission) { | 1299 bool observed_submission) { |
1298 if (!download_manager_) | 1300 if (!download_manager_) |
1299 return; | 1301 return; |
1300 | 1302 |
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2104 if (i > 0) | 2106 if (i > 0) |
2105 fputs("Next oldest form:\n", file); | 2107 fputs("Next oldest form:\n", file); |
2106 } | 2108 } |
2107 fputs("\n", file); | 2109 fputs("\n", file); |
2108 | 2110 |
2109 fclose(file); | 2111 fclose(file); |
2110 } | 2112 } |
2111 #endif // ENABLE_FORM_DEBUG_DUMP | 2113 #endif // ENABLE_FORM_DEBUG_DUMP |
2112 | 2114 |
2113 } // namespace autofill | 2115 } // namespace autofill |
OLD | NEW |