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 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_MANAGER_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_MANAGER_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_MANAGER_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_MANAGER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/callback_forward.h" | 14 #include "base/callback_forward.h" |
15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
16 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
18 #include "base/memory/scoped_vector.h" | 18 #include "base/memory/scoped_vector.h" |
19 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
20 #include "base/strings/string16.h" | 20 #include "base/strings/string16.h" |
21 #include "base/time/time.h" | 21 #include "base/time/time.h" |
22 #include "components/autofill/core/browser/autocomplete_history_manager.h" | 22 #include "components/autofill/core/browser/autocomplete_history_manager.h" |
23 #include "components/autofill/core/browser/autofill_download.h" | 23 #include "components/autofill/core/browser/autofill_download.h" |
24 #include "components/autofill/core/browser/autofill_driver.h" | 24 #include "components/autofill/core/browser/autofill_driver.h" |
25 #include "components/autofill/core/browser/autofill_manager_delegate.h" | 25 #include "components/autofill/core/browser/autofill_manager_delegate.h" |
26 #include "components/autofill/core/browser/form_structure.h" | 26 #include "components/autofill/core/browser/form_structure.h" |
27 #include "components/autofill/core/browser/personal_data_manager.h" | 27 #include "components/autofill/core/browser/personal_data_manager.h" |
28 #include "components/autofill/core/common/form_data.h" | 28 #include "components/autofill/core/common/form_data.h" |
29 #include "components/autofill/core/common/forms_seen_state.h" | |
30 | 29 |
31 class GURL; | 30 class GURL; |
32 | 31 |
33 namespace content { | 32 namespace content { |
34 class RenderViewHost; | 33 class RenderViewHost; |
35 class WebContents; | 34 class WebContents; |
36 } | 35 } |
37 | 36 |
38 namespace gfx { | 37 namespace gfx { |
39 class Rect; | 38 class Rect; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 autofill::AutofillManagerDelegate* delegate() const { | 111 autofill::AutofillManagerDelegate* delegate() const { |
113 return manager_delegate_; | 112 return manager_delegate_; |
114 } | 113 } |
115 | 114 |
116 const std::string& app_locale() const { return app_locale_; } | 115 const std::string& app_locale() const { return app_locale_; } |
117 | 116 |
118 // Only for testing. | 117 // Only for testing. |
119 void SetTestDelegate(autofill::AutofillManagerTestDelegate* delegate); | 118 void SetTestDelegate(autofill::AutofillManagerTestDelegate* delegate); |
120 | 119 |
121 void OnFormsSeen(const std::vector<FormData>& forms, | 120 void OnFormsSeen(const std::vector<FormData>& forms, |
122 const base::TimeTicks& timestamp, | 121 const base::TimeTicks& timestamp); |
123 autofill::FormsSeenState state); | |
124 | 122 |
125 // Processes the submitted |form|, saving any new Autofill data and uploading | 123 // Processes the submitted |form|, saving any new Autofill data and uploading |
126 // the possible field types for the submitted fields to the crowdsourcing | 124 // the possible field types for the submitted fields to the crowdsourcing |
127 // server. Returns false if this form is not relevant for Autofill. | 125 // server. Returns false if this form is not relevant for Autofill. |
128 bool OnFormSubmitted(const FormData& form, | 126 bool OnFormSubmitted(const FormData& form, |
129 const base::TimeTicks& timestamp); | 127 const base::TimeTicks& timestamp); |
130 | 128 |
131 void OnTextFieldDidChange(const FormData& form, | 129 void OnTextFieldDidChange(const FormData& form, |
132 const FormFieldData& field, | 130 const FormFieldData& field, |
133 const base::TimeTicks& timestamp); | 131 const base::TimeTicks& timestamp); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 bool has_logged_address_suggestions_count_; | 311 bool has_logged_address_suggestions_count_; |
314 // Have we shown Autofill suggestions at least once? | 312 // Have we shown Autofill suggestions at least once? |
315 bool did_show_suggestions_; | 313 bool did_show_suggestions_; |
316 // Has the user manually edited at least one form field among the autofillable | 314 // Has the user manually edited at least one form field among the autofillable |
317 // ones? | 315 // ones? |
318 bool user_did_type_; | 316 bool user_did_type_; |
319 // Has the user autofilled a form on this page? | 317 // Has the user autofilled a form on this page? |
320 bool user_did_autofill_; | 318 bool user_did_autofill_; |
321 // Has the user edited a field that was previously autofilled? | 319 // Has the user edited a field that was previously autofilled? |
322 bool user_did_edit_autofilled_field_; | 320 bool user_did_edit_autofilled_field_; |
323 // When the page finished loading. | 321 // When the form finished loading. |
324 base::TimeTicks forms_loaded_timestamp_; | 322 std::map<FormData, base::TimeTicks> forms_loaded_timestamps_; |
325 // When the user first interacted with a potentially fillable form on this | 323 // When the user first interacted with a potentially fillable form on this |
326 // page. | 324 // page. |
327 base::TimeTicks initial_interaction_timestamp_; | 325 base::TimeTicks initial_interaction_timestamp_; |
328 | 326 |
329 // Our copy of the form data. | 327 // Our copy of the form data. |
330 ScopedVector<FormStructure> form_structures_; | 328 ScopedVector<FormStructure> form_structures_; |
331 | 329 |
332 // GUID to ID mapping. We keep two maps to convert back and forth. | 330 // GUID to ID mapping. We keep two maps to convert back and forth. |
333 mutable std::map<PersonalDataManager::GUIDPair, int> guid_id_map_; | 331 mutable std::map<PersonalDataManager::GUIDPair, int> guid_id_map_; |
334 mutable std::map<int, PersonalDataManager::GUIDPair> id_guid_map_; | 332 mutable std::map<int, PersonalDataManager::GUIDPair> id_guid_map_; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 UserHappinessFormLoadAndSubmission); | 365 UserHappinessFormLoadAndSubmission); |
368 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, UserHappinessFormInteraction); | 366 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, UserHappinessFormInteraction); |
369 FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest, | 367 FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest, |
370 FormSubmittedAutocompleteEnabled); | 368 FormSubmittedAutocompleteEnabled); |
371 DISALLOW_COPY_AND_ASSIGN(AutofillManager); | 369 DISALLOW_COPY_AND_ASSIGN(AutofillManager); |
372 }; | 370 }; |
373 | 371 |
374 } // namespace autofill | 372 } // namespace autofill |
375 | 373 |
376 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_MANAGER_H_ | 374 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_MANAGER_H_ |
OLD | NEW |