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

Side by Side Diff: chrome/browser/autofill/autofill_manager.h

Issue 8351027: Reduce visibility of methods in AutofillManager and AutofillDownload. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: De-nitting Created 9 years, 1 month 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ 5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_
6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 // forms. 47 // forms.
48 class AutofillManager : public TabContentsObserver, 48 class AutofillManager : public TabContentsObserver,
49 public AutofillDownloadManager::Observer { 49 public AutofillDownloadManager::Observer {
50 public: 50 public:
51 explicit AutofillManager(TabContentsWrapper* tab_contents); 51 explicit AutofillManager(TabContentsWrapper* tab_contents);
52 virtual ~AutofillManager(); 52 virtual ~AutofillManager();
53 53
54 // Registers our Enable/Disable Autofill pref. 54 // Registers our Enable/Disable Autofill pref.
55 static void RegisterUserPrefs(PrefService* prefs); 55 static void RegisterUserPrefs(PrefService* prefs);
56 56
57 // TabContentsObserver implementation. 57 protected:
58 virtual void DidNavigateMainFramePostCommit( 58 // Only test code should subclass AutofillManager.
59 const content::LoadCommittedDetails& details,
60 const ViewHostMsg_FrameNavigate_Params& params);
61 virtual bool OnMessageReceived(const IPC::Message& message);
62 59
63 // AutofillDownloadManager::Observer implementation: 60 // The string/int pair is composed of the guid string and variant index
64 virtual void OnLoadedServerPredictions(const std::string& response_xml); 61 // respectively. The variant index is an index into the multi-valued item
65 virtual void OnUploadedPossibleFieldTypes(); 62 // (where applicable).
66 virtual void OnServerRequestError( 63 typedef std::pair<std::string, size_t> GUIDPair;
67 const std::string& form_signature, 64
68 AutofillDownloadManager::AutofillRequestType request_type, 65 // Test code should prefer to use this constructor.
69 int http_error); 66 AutofillManager(TabContentsWrapper* tab_contents,
67 PersonalDataManager* personal_data);
70 68
71 // Returns the value of the AutofillEnabled pref. 69 // Returns the value of the AutofillEnabled pref.
72 virtual bool IsAutofillEnabled() const; 70 virtual bool IsAutofillEnabled() const;
73 71
74 // Imports the form data, submitted by the user, into |personal_data_|.
75 void ImportFormData(const FormStructure& submitted_form);
76
77 // Uploads the form data to the Autofill server. 72 // Uploads the form data to the Autofill server.
78 virtual void UploadFormData(const FormStructure& submitted_form); 73 virtual void UploadFormData(const FormStructure& submitted_form);
79 74
80 // Reset cache. 75 // Reset cache.
81 void Reset(); 76 void Reset();
82 77
83 protected:
84 // For tests:
85
86 // The string/int pair is composed of the guid string and variant index
87 // respectively. The variant index is an index into the multi-valued item
88 // (where applicable).
89 typedef std::pair<std::string, size_t> GUIDPair;
90
91 AutofillManager(TabContentsWrapper* tab_contents,
92 PersonalDataManager* personal_data);
93
94 void set_personal_data_manager(PersonalDataManager* personal_data) {
95 personal_data_ = personal_data;
96 }
97
98 const AutofillMetrics* metric_logger() const { return metric_logger_.get(); }
99 void set_metric_logger(const AutofillMetrics* metric_logger);
100
101 ScopedVector<FormStructure>* form_structures() { return &form_structures_; }
102
103 // Maps GUIDs to and from IDs that are used to identify profiles and credit 78 // Maps GUIDs to and from IDs that are used to identify profiles and credit
104 // cards sent to and from the renderer process. 79 // cards sent to and from the renderer process.
105 virtual int GUIDToID(const GUIDPair& guid) const; 80 virtual int GUIDToID(const GUIDPair& guid) const;
106 virtual const GUIDPair IDToGUID(int id) const; 81 virtual const GUIDPair IDToGUID(int id) const;
107 82
108 // Methods for packing and unpacking credit card and profile IDs for sending 83 // Methods for packing and unpacking credit card and profile IDs for sending
109 // and receiving to and from the renderer process. 84 // and receiving to and from the renderer process.
110 int PackGUIDs(const GUIDPair& cc_guid, const GUIDPair& profile_guid) const; 85 int PackGUIDs(const GUIDPair& cc_guid, const GUIDPair& profile_guid) const;
111 void UnpackGUIDs(int id, GUIDPair* cc_guid, GUIDPair* profile_guid) const; 86 void UnpackGUIDs(int id, GUIDPair* cc_guid, GUIDPair* profile_guid) const;
112 87
88 const AutofillMetrics* metric_logger() const { return metric_logger_.get(); }
89 void set_metric_logger(const AutofillMetrics* metric_logger);
90
91 ScopedVector<FormStructure>* form_structures() { return &form_structures_; }
92
113 private: 93 private:
94 // TabContentsObserver:
95 virtual void DidNavigateMainFramePostCommit(
96 const content::LoadCommittedDetails& details,
97 const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE;
98 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
99
100 // AutofillDownloadManager::Observer:
101 virtual void OnLoadedServerPredictions(
102 const std::string& response_xml) OVERRIDE;
103
114 void OnFormSubmitted(const webkit_glue::FormData& form, 104 void OnFormSubmitted(const webkit_glue::FormData& form,
115 const base::TimeTicks& timestamp); 105 const base::TimeTicks& timestamp);
116 void OnFormsSeen(const std::vector<webkit_glue::FormData>& forms, 106 void OnFormsSeen(const std::vector<webkit_glue::FormData>& forms,
117 const base::TimeTicks& timestamp); 107 const base::TimeTicks& timestamp);
118 void OnTextFieldDidChange(const webkit_glue::FormData& form, 108 void OnTextFieldDidChange(const webkit_glue::FormData& form,
119 const webkit_glue::FormField& field, 109 const webkit_glue::FormField& field,
120 const base::TimeTicks& timestamp); 110 const base::TimeTicks& timestamp);
121 void OnQueryFormFieldAutofill(int query_id, 111 void OnQueryFormFieldAutofill(int query_id,
122 const webkit_glue::FormData& form, 112 const webkit_glue::FormData& form,
123 const webkit_glue::FormField& field); 113 const webkit_glue::FormField& field);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 size_t variant, 200 size_t variant,
211 webkit_glue::FormField* field); 201 webkit_glue::FormField* field);
212 202
213 // Parses the forms using heuristic matching and querying the Autofill server. 203 // Parses the forms using heuristic matching and querying the Autofill server.
214 void ParseForms(const std::vector<webkit_glue::FormData>& forms); 204 void ParseForms(const std::vector<webkit_glue::FormData>& forms);
215 205
216 // Uses existing personal data to determine possible field types for the 206 // Uses existing personal data to determine possible field types for the
217 // |submitted_form|. 207 // |submitted_form|.
218 void DeterminePossibleFieldTypesForUpload(FormStructure* submitted_form); 208 void DeterminePossibleFieldTypesForUpload(FormStructure* submitted_form);
219 209
210 // Imports the form data, submitted by the user, into |personal_data_|.
211 void ImportFormData(const FormStructure& submitted_form);
212
220 // If |initial_interaction_timestamp_| is unset or is set to a later time than 213 // If |initial_interaction_timestamp_| is unset or is set to a later time than
221 // |interaction_timestamp|, updates the cached timestamp. The latter check is 214 // |interaction_timestamp|, updates the cached timestamp. The latter check is
222 // needed because IPC messages can arrive out of order. 215 // needed because IPC messages can arrive out of order.
223 void UpdateInitialInteractionTimestamp( 216 void UpdateInitialInteractionTimestamp(
224 const base::TimeTicks& interaction_timestamp); 217 const base::TimeTicks& interaction_timestamp);
225 218
226 // Send our current field type predictions to the renderer. This is a no-op if 219 // Send our current field type predictions to the renderer. This is a no-op if
227 // the appropriate command-line flag is not set. 220 // the appropriate command-line flag is not set.
228 void SendAutofillTypePredictions( 221 void SendAutofillTypePredictions(
229 const std::vector<FormStructure*>& forms) const; 222 const std::vector<FormStructure*>& forms) const;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, SaneMetricsWithCacheMismatch); 284 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, SaneMetricsWithCacheMismatch);
292 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, 285 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest,
293 UserHappinessFormLoadAndSubmission); 286 UserHappinessFormLoadAndSubmission);
294 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, UserHappinessFormInteraction); 287 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, UserHappinessFormInteraction);
295 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, FormFillDuration); 288 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, FormFillDuration);
296 289
297 DISALLOW_COPY_AND_ASSIGN(AutofillManager); 290 DISALLOW_COPY_AND_ASSIGN(AutofillManager);
298 }; 291 };
299 292
300 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_ 293 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_download_unittest.cc ('k') | chrome/browser/autofill/autofill_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698