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_PERSONAL_DATA_MANAGER_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_PERSONAL_DATA_MANAGER_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_PERSONAL_DATA_MANAGER_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_PERSONAL_DATA_MANAGER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
177 // Merges |new_profile| into one of the |existing_profiles| if possible; | 177 // Merges |new_profile| into one of the |existing_profiles| if possible; |
178 // otherwise appends |new_profile| to the end of that list. Fills | 178 // otherwise appends |new_profile| to the end of that list. Fills |
179 // |merged_profiles| with the result. Returns the |guid| of the new or updated | 179 // |merged_profiles| with the result. Returns the |guid| of the new or updated |
180 // profile. | 180 // profile. |
181 static std::string MergeProfile( | 181 static std::string MergeProfile( |
182 const AutofillProfile& new_profile, | 182 const AutofillProfile& new_profile, |
183 const std::vector<AutofillProfile*>& existing_profiles, | 183 const std::vector<AutofillProfile*>& existing_profiles, |
184 const std::string& app_locale, | 184 const std::string& app_locale, |
185 std::vector<AutofillProfile>* merged_profiles); | 185 std::vector<AutofillProfile>* merged_profiles); |
186 | 186 |
187 // Returns true if |country_code| is a country that the user is likely to | |
188 // be associated with the user. More concretely, it checks if there are any | |
189 // profiles with this address or if the user's system timezone is in the given | |
Dan Beam
2014/01/02 22:10:39
nit: with an address in |country_code|
Evan Stade
2014/01/02 22:23:16
Done.
| |
190 // country. | |
191 virtual bool IsCountryOfInterest(const std::string& country_code) const; | |
192 | |
187 // Returns our best guess for the country a user is likely to use when | 193 // Returns our best guess for the country a user is likely to use when |
188 // inputting a new address. The value is calculated once and cached, so it | 194 // inputting a new address. The value is calculated once and cached, so it |
189 // will only update when Chrome is restarted. | 195 // will only update when Chrome is restarted. |
190 virtual const std::string& GetDefaultCountryCodeForNewAddress() const; | 196 virtual const std::string& GetDefaultCountryCodeForNewAddress() const; |
191 | 197 |
192 protected: | 198 protected: |
193 // Only PersonalDataManagerFactory and certain tests can create instances of | 199 // Only PersonalDataManagerFactory and certain tests can create instances of |
194 // PersonalDataManager. | 200 // PersonalDataManager. |
195 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, FirstMiddleLast); | 201 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, FirstMiddleLast); |
196 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, AutofillIsEnabledAtStartup); | 202 FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, AutofillIsEnabledAtStartup); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
248 // query handle. | 254 // query handle. |
249 void CancelPendingQuery(WebDataServiceBase::Handle* handle); | 255 void CancelPendingQuery(WebDataServiceBase::Handle* handle); |
250 | 256 |
251 // The first time this is called, logs an UMA metrics for the number of | 257 // The first time this is called, logs an UMA metrics for the number of |
252 // profiles the user has. On subsequent calls, does nothing. | 258 // profiles the user has. On subsequent calls, does nothing. |
253 void LogProfileCount() const; | 259 void LogProfileCount() const; |
254 | 260 |
255 // Returns the value of the AutofillEnabled pref. | 261 // Returns the value of the AutofillEnabled pref. |
256 virtual bool IsAutofillEnabled() const; | 262 virtual bool IsAutofillEnabled() const; |
257 | 263 |
264 // Overrideable for testing. | |
265 virtual std::string CountryCodeForCurrentTimezone() const; | |
266 | |
258 // For tests. | 267 // For tests. |
259 const AutofillMetrics* metric_logger() const { return metric_logger_.get(); } | 268 const AutofillMetrics* metric_logger() const { return metric_logger_.get(); } |
260 | 269 |
261 void set_database(scoped_refptr<AutofillWebDataService> database) { | 270 void set_database(scoped_refptr<AutofillWebDataService> database) { |
262 database_ = database; | 271 database_ = database; |
263 } | 272 } |
264 | 273 |
265 void set_metric_logger(const AutofillMetrics* metric_logger) { | 274 void set_metric_logger(const AutofillMetrics* metric_logger) { |
266 metric_logger_.reset(metric_logger); | 275 metric_logger_.reset(metric_logger); |
267 } | 276 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
321 | 330 |
322 // Whether we have already logged the number of profiles this session. | 331 // Whether we have already logged the number of profiles this session. |
323 mutable bool has_logged_profile_count_; | 332 mutable bool has_logged_profile_count_; |
324 | 333 |
325 DISALLOW_COPY_AND_ASSIGN(PersonalDataManager); | 334 DISALLOW_COPY_AND_ASSIGN(PersonalDataManager); |
326 }; | 335 }; |
327 | 336 |
328 } // namespace autofill | 337 } // namespace autofill |
329 | 338 |
330 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PERSONAL_DATA_MANAGER_H_ | 339 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PERSONAL_DATA_MANAGER_H_ |
OLD | NEW |