| OLD | NEW |
| 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 #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> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "chrome/browser/autofill/personal_data_manager.h" | 28 #include "chrome/browser/autofill/personal_data_manager.h" |
| 29 #include "chrome/browser/autofill/phone_number.h" | 29 #include "chrome/browser/autofill/phone_number.h" |
| 30 #include "chrome/browser/autofill/phone_number_i18n.h" | 30 #include "chrome/browser/autofill/phone_number_i18n.h" |
| 31 #include "chrome/browser/autofill/select_control_handler.h" | 31 #include "chrome/browser/autofill/select_control_handler.h" |
| 32 #include "chrome/browser/prefs/pref_service.h" | 32 #include "chrome/browser/prefs/pref_service.h" |
| 33 #include "chrome/browser/profiles/profile.h" | 33 #include "chrome/browser/profiles/profile.h" |
| 34 #include "chrome/browser/ui/browser.h" | 34 #include "chrome/browser/ui/browser.h" |
| 35 #include "chrome/browser/ui/browser_list.h" | 35 #include "chrome/browser/ui/browser_list.h" |
| 36 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 36 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 37 #include "chrome/common/autofill_messages.h" | 37 #include "chrome/common/autofill_messages.h" |
| 38 #include "chrome/common/chrome_notification_types.h" |
| 38 #include "chrome/common/chrome_switches.h" | 39 #include "chrome/common/chrome_switches.h" |
| 39 #include "chrome/common/guid.h" | 40 #include "chrome/common/guid.h" |
| 40 #include "chrome/common/pref_names.h" | 41 #include "chrome/common/pref_names.h" |
| 41 #include "chrome/common/url_constants.h" | 42 #include "chrome/common/url_constants.h" |
| 42 #include "content/browser/renderer_host/render_view_host.h" | 43 #include "content/browser/renderer_host/render_view_host.h" |
| 43 #include "content/common/notification_service.h" | 44 #include "content/common/notification_service.h" |
| 44 #include "content/common/notification_source.h" | 45 #include "content/common/notification_source.h" |
| 45 #include "content/common/notification_type.h" | |
| 46 #include "googleurl/src/gurl.h" | 46 #include "googleurl/src/gurl.h" |
| 47 #include "grit/generated_resources.h" | 47 #include "grit/generated_resources.h" |
| 48 #include "ipc/ipc_message_macros.h" | 48 #include "ipc/ipc_message_macros.h" |
| 49 #include "ui/base/l10n/l10n_util.h" | 49 #include "ui/base/l10n/l10n_util.h" |
| 50 #include "webkit/glue/form_data.h" | 50 #include "webkit/glue/form_data.h" |
| 51 #include "webkit/glue/form_data_predictions.h" | 51 #include "webkit/glue/form_data_predictions.h" |
| 52 #include "webkit/glue/form_field.h" | 52 #include "webkit/glue/form_field.h" |
| 53 | 53 |
| 54 using switches::kEnableAutofillFeedback; | 54 using switches::kEnableAutofillFeedback; |
| 55 using webkit_glue::FormData; | 55 using webkit_glue::FormData; |
| (...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 | 717 |
| 718 void AutofillManager::OnShowAutofillDialog() { | 718 void AutofillManager::OnShowAutofillDialog() { |
| 719 Browser* browser = BrowserList::GetLastActiveWithProfile( | 719 Browser* browser = BrowserList::GetLastActiveWithProfile( |
| 720 tab_contents()->profile()); | 720 tab_contents()->profile()); |
| 721 if (browser) | 721 if (browser) |
| 722 browser->ShowOptionsTab(chrome::kAutofillSubPage); | 722 browser->ShowOptionsTab(chrome::kAutofillSubPage); |
| 723 } | 723 } |
| 724 | 724 |
| 725 void AutofillManager::OnDidFillAutofillFormData() { | 725 void AutofillManager::OnDidFillAutofillFormData() { |
| 726 NotificationService::current()->Notify( | 726 NotificationService::current()->Notify( |
| 727 NotificationType::AUTOFILL_DID_FILL_FORM_DATA, | 727 chrome::NOTIFICATION_AUTOFILL_DID_FILL_FORM_DATA, |
| 728 Source<RenderViewHost>(tab_contents()->render_view_host()), | 728 Source<RenderViewHost>(tab_contents()->render_view_host()), |
| 729 NotificationService::NoDetails()); | 729 NotificationService::NoDetails()); |
| 730 } | 730 } |
| 731 | 731 |
| 732 void AutofillManager::OnDidShowAutofillSuggestions() { | 732 void AutofillManager::OnDidShowAutofillSuggestions() { |
| 733 NotificationService::current()->Notify( | 733 NotificationService::current()->Notify( |
| 734 NotificationType::AUTOFILL_DID_SHOW_SUGGESTIONS, | 734 chrome::NOTIFICATION_AUTOFILL_DID_SHOW_SUGGESTIONS, |
| 735 Source<RenderViewHost>(tab_contents()->render_view_host()), | 735 Source<RenderViewHost>(tab_contents()->render_view_host()), |
| 736 NotificationService::NoDetails()); | 736 NotificationService::NoDetails()); |
| 737 } | 737 } |
| 738 | 738 |
| 739 void AutofillManager::OnLoadedServerPredictions( | 739 void AutofillManager::OnLoadedServerPredictions( |
| 740 const std::string& response_xml) { | 740 const std::string& response_xml) { |
| 741 // Parse and store the server predictions. | 741 // Parse and store the server predictions. |
| 742 FormStructure::ParseQueryResponse(response_xml, | 742 FormStructure::ParseQueryResponse(response_xml, |
| 743 form_structures_.get(), | 743 form_structures_.get(), |
| 744 *metric_logger_); | 744 *metric_logger_); |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1195 void AutofillManager::UnpackGUIDs(int id, | 1195 void AutofillManager::UnpackGUIDs(int id, |
| 1196 GUIDPair* cc_guid, | 1196 GUIDPair* cc_guid, |
| 1197 GUIDPair* profile_guid) { | 1197 GUIDPair* profile_guid) { |
| 1198 int cc_id = id >> std::numeric_limits<unsigned short>::digits & | 1198 int cc_id = id >> std::numeric_limits<unsigned short>::digits & |
| 1199 std::numeric_limits<unsigned short>::max(); | 1199 std::numeric_limits<unsigned short>::max(); |
| 1200 int profile_id = id & std::numeric_limits<unsigned short>::max(); | 1200 int profile_id = id & std::numeric_limits<unsigned short>::max(); |
| 1201 | 1201 |
| 1202 *cc_guid = IDToGUID(cc_id); | 1202 *cc_guid = IDToGUID(cc_id); |
| 1203 *profile_guid = IDToGUID(profile_id); | 1203 *profile_guid = IDToGUID(profile_id); |
| 1204 } | 1204 } |
| OLD | NEW |