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

Side by Side Diff: components/autofill/core/browser/autofill_manager.cc

Issue 2510803003: Pass RapporService to content/browser/ (Closed)
Patch Set: Fix more compile errors in JNI files Created 4 years 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 unified diff | Download patch
OLDNEW
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
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 886 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 } 961 }
961 std::reverse(queried_forms.begin(), queried_forms.end()); 962 std::reverse(queried_forms.begin(), queried_forms.end());
962 963
963 // If there are no current forms corresponding to the queried signatures, drop 964 // If there are no current forms corresponding to the queried signatures, drop
964 // the query response. 965 // the query response.
965 if (queried_forms.empty()) 966 if (queried_forms.empty())
966 return; 967 return;
967 968
968 // Parse and store the server predictions. 969 // Parse and store the server predictions.
969 FormStructure::ParseQueryResponse(std::move(response), queried_forms, 970 FormStructure::ParseQueryResponse(std::move(response), queried_forms,
970 client_->GetRapporService()); 971 client_->GetRapporServiceImpl());
971 972
972 // Will log quality metrics for each FormStructure based on the presence of 973 // Will log quality metrics for each FormStructure based on the presence of
973 // autocomplete attributes, if available. 974 // autocomplete attributes, if available.
974 for (FormStructure* cur_form : queried_forms) 975 for (FormStructure* cur_form : queried_forms)
975 cur_form->LogQualityMetricsBasedOnAutocomplete(); 976 cur_form->LogQualityMetricsBasedOnAutocomplete();
976 977
977 // Forward form structures to the password generation manager to detect 978 // Forward form structures to the password generation manager to detect
978 // account creation forms. 979 // account creation forms.
979 driver_->PropagateAutofillPredictions(queried_forms); 980 driver_->PropagateAutofillPredictions(queried_forms);
980 981
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
1280 AutofillMetrics::UPLOAD_NOT_OFFERED_NO_ZIP_CODE); 1281 AutofillMetrics::UPLOAD_NOT_OFFERED_NO_ZIP_CODE);
1281 return false; 1282 return false;
1282 } 1283 }
1283 1284
1284 profiles->assign(candidate_profiles.begin(), candidate_profiles.end()); 1285 profiles->assign(candidate_profiles.begin(), candidate_profiles.end());
1285 return true; 1286 return true;
1286 } 1287 }
1287 1288
1288 void AutofillManager::CollectRapportSample(const GURL& source_url, 1289 void AutofillManager::CollectRapportSample(const GURL& source_url,
1289 const char* metric_name) const { 1290 const char* metric_name) const {
1290 if (source_url.is_valid() && client_->GetRapporService()) { 1291 if (source_url.is_valid() && client_->GetRapporServiceImpl()) {
1291 rappor::SampleDomainAndRegistryFromGURL(client_->GetRapporService(), 1292 rappor::SampleDomainAndRegistryFromGURL(client_->GetRapporServiceImpl(),
1292 metric_name, source_url); 1293 metric_name, source_url);
1293 } 1294 }
1294 } 1295 }
1295 1296
1296 // Note that |submitted_form| is passed as a pointer rather than as a reference 1297 // Note that |submitted_form| is passed as a pointer rather than as a reference
1297 // so that we can get memory management right across threads. Note also that we 1298 // so that we can get memory management right across threads. Note also that we
1298 // explicitly pass in all the time stamps of interest, as the cached ones might 1299 // explicitly pass in all the time stamps of interest, as the cached ones might
1299 // get reset before this method executes. 1300 // get reset before this method executes.
1300 void AutofillManager::UploadFormDataAsyncCallback( 1301 void AutofillManager::UploadFormDataAsyncCallback(
1301 const FormStructure* submitted_form, 1302 const FormStructure* submitted_form,
1302 const TimeTicks& load_time, 1303 const TimeTicks& load_time,
1303 const TimeTicks& interaction_time, 1304 const TimeTicks& interaction_time,
1304 const TimeTicks& submission_time, 1305 const TimeTicks& submission_time,
1305 bool observed_submission) { 1306 bool observed_submission) {
1306 submitted_form->LogQualityMetrics( 1307 submitted_form->LogQualityMetrics(load_time, interaction_time,
1307 load_time, interaction_time, submission_time, client_->GetRapporService(), 1308 submission_time,
1308 did_show_suggestions_, observed_submission); 1309 client_->GetRapporServiceImpl(),
1310 did_show_suggestions_, observed_submission);
1309 1311
1310 if (submitted_form->ShouldBeCrowdsourced()) 1312 if (submitted_form->ShouldBeCrowdsourced())
1311 UploadFormData(*submitted_form, observed_submission); 1313 UploadFormData(*submitted_form, observed_submission);
1312 } 1314 }
1313 1315
1314 void AutofillManager::UploadFormData(const FormStructure& submitted_form, 1316 void AutofillManager::UploadFormData(const FormStructure& submitted_form,
1315 bool observed_submission) { 1317 bool observed_submission) {
1316 if (!download_manager_) 1318 if (!download_manager_)
1317 return; 1319 return;
1318 1320
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after
2122 if (i > 0) 2124 if (i > 0)
2123 fputs("Next oldest form:\n", file); 2125 fputs("Next oldest form:\n", file);
2124 } 2126 }
2125 fputs("\n", file); 2127 fputs("\n", file);
2126 2128
2127 fclose(file); 2129 fclose(file);
2128 } 2130 }
2129 #endif // ENABLE_FORM_DEBUG_DUMP 2131 #endif // ENABLE_FORM_DEBUG_DUMP
2130 2132
2131 } // namespace autofill 2133 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698