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

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

Issue 10540003: Move guid generation from chrome/common/ to base/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: installer Created 8 years, 6 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/autofill/autofill_manager.h" 5 #include "chrome/browser/autofill/autofill_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <map> 10 #include <map>
11 #include <set> 11 #include <set>
12 #include <utility> 12 #include <utility>
13 13
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/guid.h"
16 #include "base/logging.h" 17 #include "base/logging.h"
17 #include "base/string16.h" 18 #include "base/string16.h"
18 #include "base/string_util.h" 19 #include "base/string_util.h"
19 #include "base/threading/sequenced_worker_pool.h" 20 #include "base/threading/sequenced_worker_pool.h"
20 #include "base/utf_string_conversions.h" 21 #include "base/utf_string_conversions.h"
21 #include "chrome/browser/autocomplete_history_manager.h" 22 #include "chrome/browser/autocomplete_history_manager.h"
22 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" 23 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h"
23 #include "chrome/browser/autofill/autofill_external_delegate.h" 24 #include "chrome/browser/autofill/autofill_external_delegate.h"
24 #include "chrome/browser/autofill/autofill_feedback_infobar_delegate.h" 25 #include "chrome/browser/autofill/autofill_feedback_infobar_delegate.h"
25 #include "chrome/browser/autofill/autofill_field.h" 26 #include "chrome/browser/autofill/autofill_field.h"
(...skipping 14 matching lines...) Expand all
40 #include "chrome/browser/profiles/profile.h" 41 #include "chrome/browser/profiles/profile.h"
41 #include "chrome/browser/sync/profile_sync_service_factory.h" 42 #include "chrome/browser/sync/profile_sync_service_factory.h"
42 #include "chrome/browser/sync/profile_sync_service.h" 43 #include "chrome/browser/sync/profile_sync_service.h"
43 #include "chrome/browser/ui/browser.h" 44 #include "chrome/browser/ui/browser.h"
44 #include "chrome/browser/ui/browser_finder.h" 45 #include "chrome/browser/ui/browser_finder.h"
45 #include "chrome/browser/ui/browser_window.h" 46 #include "chrome/browser/ui/browser_window.h"
46 #include "chrome/browser/ui/tab_contents/tab_contents.h" 47 #include "chrome/browser/ui/tab_contents/tab_contents.h"
47 #include "chrome/common/autofill_messages.h" 48 #include "chrome/common/autofill_messages.h"
48 #include "chrome/common/chrome_notification_types.h" 49 #include "chrome/common/chrome_notification_types.h"
49 #include "chrome/common/chrome_switches.h" 50 #include "chrome/common/chrome_switches.h"
50 #include "chrome/common/guid.h"
51 #include "chrome/common/pref_names.h" 51 #include "chrome/common/pref_names.h"
52 #include "chrome/common/url_constants.h" 52 #include "chrome/common/url_constants.h"
53 #include "content/public/browser/browser_thread.h" 53 #include "content/public/browser/browser_thread.h"
54 #include "content/public/browser/notification_service.h" 54 #include "content/public/browser/notification_service.h"
55 #include "content/public/browser/notification_source.h" 55 #include "content/public/browser/notification_source.h"
56 #include "content/public/browser/render_view_host.h" 56 #include "content/public/browser/render_view_host.h"
57 #include "content/public/browser/web_contents.h" 57 #include "content/public/browser/web_contents.h"
58 #include "googleurl/src/gurl.h" 58 #include "googleurl/src/gurl.h"
59 #include "grit/generated_resources.h" 59 #include "grit/generated_resources.h"
60 #include "ipc/ipc_message_macros.h" 60 #include "ipc/ipc_message_macros.h"
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 int unique_id, 943 int unique_id,
944 const std::vector<AutofillProfile*>& profiles, 944 const std::vector<AutofillProfile*>& profiles,
945 const std::vector<CreditCard*>& credit_cards, 945 const std::vector<CreditCard*>& credit_cards,
946 const AutofillProfile** profile, 946 const AutofillProfile** profile,
947 const CreditCard** credit_card, 947 const CreditCard** credit_card,
948 size_t* variant) const { 948 size_t* variant) const {
949 // Unpack the |unique_id| into component parts. 949 // Unpack the |unique_id| into component parts.
950 GUIDPair credit_card_guid; 950 GUIDPair credit_card_guid;
951 GUIDPair profile_guid; 951 GUIDPair profile_guid;
952 UnpackGUIDs(unique_id, &credit_card_guid, &profile_guid); 952 UnpackGUIDs(unique_id, &credit_card_guid, &profile_guid);
953 DCHECK(!guid::IsValidGUID(credit_card_guid.first) || 953 DCHECK(!base::IsValidGUID(credit_card_guid.first) ||
954 !guid::IsValidGUID(profile_guid.first)); 954 !base::IsValidGUID(profile_guid.first));
955 955
956 // Find the profile that matches the |profile_guid|, if one is specified. 956 // Find the profile that matches the |profile_guid|, if one is specified.
957 if (guid::IsValidGUID(profile_guid.first)) { 957 if (base::IsValidGUID(profile_guid.first)) {
958 for (std::vector<AutofillProfile*>::const_iterator iter = profiles.begin(); 958 for (std::vector<AutofillProfile*>::const_iterator iter = profiles.begin();
959 iter != profiles.end(); ++iter) { 959 iter != profiles.end(); ++iter) {
960 if ((*iter)->guid() == profile_guid.first) { 960 if ((*iter)->guid() == profile_guid.first) {
961 *profile = *iter; 961 *profile = *iter;
962 break; 962 break;
963 } 963 }
964 } 964 }
965 DCHECK(*profile); 965 DCHECK(*profile);
966 966
967 *variant = profile_guid.second; 967 *variant = profile_guid.second;
968 } 968 }
969 969
970 // Find the credit card that matches the |credit_card_guid|, if specified. 970 // Find the credit card that matches the |credit_card_guid|, if specified.
971 if (guid::IsValidGUID(credit_card_guid.first)) { 971 if (base::IsValidGUID(credit_card_guid.first)) {
972 for (std::vector<CreditCard*>::const_iterator iter = credit_cards.begin(); 972 for (std::vector<CreditCard*>::const_iterator iter = credit_cards.begin();
973 iter != credit_cards.end(); ++iter) { 973 iter != credit_cards.end(); ++iter) {
974 if ((*iter)->guid() == credit_card_guid.first) { 974 if ((*iter)->guid() == credit_card_guid.first) {
975 *credit_card = *iter; 975 *credit_card = *iter;
976 break; 976 break;
977 } 977 }
978 } 978 }
979 DCHECK(*credit_card); 979 DCHECK(*credit_card);
980 980
981 *variant = credit_card_guid.second; 981 *variant = credit_card_guid.second;
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
1338 if (!form_structures_.empty()) 1338 if (!form_structures_.empty())
1339 metric_logger_->LogUserHappinessMetric(AutofillMetrics::FORMS_LOADED); 1339 metric_logger_->LogUserHappinessMetric(AutofillMetrics::FORMS_LOADED);
1340 1340
1341 // For the |non_queryable_forms|, we have all the field type info we're ever 1341 // For the |non_queryable_forms|, we have all the field type info we're ever
1342 // going to get about them. For the other forms, we'll wait until we get a 1342 // going to get about them. For the other forms, we'll wait until we get a
1343 // response from the server. 1343 // response from the server.
1344 SendAutofillTypePredictions(non_queryable_forms); 1344 SendAutofillTypePredictions(non_queryable_forms);
1345 } 1345 }
1346 1346
1347 int AutofillManager::GUIDToID(const GUIDPair& guid) const { 1347 int AutofillManager::GUIDToID(const GUIDPair& guid) const {
1348 if (!guid::IsValidGUID(guid.first)) 1348 if (!base::IsValidGUID(guid.first))
1349 return 0; 1349 return 0;
1350 1350
1351 std::map<GUIDPair, int>::const_iterator iter = guid_id_map_.find(guid); 1351 std::map<GUIDPair, int>::const_iterator iter = guid_id_map_.find(guid);
1352 if (iter == guid_id_map_.end()) { 1352 if (iter == guid_id_map_.end()) {
1353 int id = guid_id_map_.size() + 1; 1353 int id = guid_id_map_.size() + 1;
1354 guid_id_map_[guid] = id; 1354 guid_id_map_[guid] = id;
1355 id_guid_map_[id] = guid; 1355 id_guid_map_[id] = guid;
1356 return id; 1356 return id;
1357 } else { 1357 } else {
1358 return iter->second; 1358 return iter->second;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1400 *profile_guid = IDToGUID(profile_id); 1400 *profile_guid = IDToGUID(profile_id);
1401 } 1401 }
1402 1402
1403 void AutofillManager::UpdateInitialInteractionTimestamp( 1403 void AutofillManager::UpdateInitialInteractionTimestamp(
1404 const TimeTicks& interaction_timestamp) { 1404 const TimeTicks& interaction_timestamp) {
1405 if (initial_interaction_timestamp_.is_null() || 1405 if (initial_interaction_timestamp_.is_null() ||
1406 interaction_timestamp < initial_interaction_timestamp_) { 1406 interaction_timestamp < initial_interaction_timestamp_) {
1407 initial_interaction_timestamp_ = interaction_timestamp; 1407 initial_interaction_timestamp_ = interaction_timestamp;
1408 } 1408 }
1409 } 1409 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/shortcuts_provider.cc ('k') | chrome/browser/autofill/autofill_profile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698