| 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 25 matching lines...) Expand all Loading... |
| 36 #include "chrome/browser/ui/browser.h" | 36 #include "chrome/browser/ui/browser.h" |
| 37 #include "chrome/browser/ui/browser_list.h" | 37 #include "chrome/browser/ui/browser_list.h" |
| 38 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 38 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 39 #include "chrome/common/autofill_messages.h" | 39 #include "chrome/common/autofill_messages.h" |
| 40 #include "chrome/common/chrome_notification_types.h" | 40 #include "chrome/common/chrome_notification_types.h" |
| 41 #include "chrome/common/chrome_switches.h" | 41 #include "chrome/common/chrome_switches.h" |
| 42 #include "chrome/common/guid.h" | 42 #include "chrome/common/guid.h" |
| 43 #include "chrome/common/pref_names.h" | 43 #include "chrome/common/pref_names.h" |
| 44 #include "chrome/common/url_constants.h" | 44 #include "chrome/common/url_constants.h" |
| 45 #include "content/browser/renderer_host/render_view_host.h" | 45 #include "content/browser/renderer_host/render_view_host.h" |
| 46 #include "content/common/notification_service.h" | 46 #include "content/public/browser/notification_service.h" |
| 47 #include "content/public/browser/notification_source.h" | 47 #include "content/public/browser/notification_source.h" |
| 48 #include "googleurl/src/gurl.h" | 48 #include "googleurl/src/gurl.h" |
| 49 #include "grit/generated_resources.h" | 49 #include "grit/generated_resources.h" |
| 50 #include "ipc/ipc_message_macros.h" | 50 #include "ipc/ipc_message_macros.h" |
| 51 #include "ui/base/l10n/l10n_util.h" | 51 #include "ui/base/l10n/l10n_util.h" |
| 52 #include "webkit/glue/form_data.h" | 52 #include "webkit/glue/form_data.h" |
| 53 #include "webkit/glue/form_data_predictions.h" | 53 #include "webkit/glue/form_data_predictions.h" |
| 54 #include "webkit/glue/form_field.h" | 54 #include "webkit/glue/form_field.h" |
| 55 | 55 |
| 56 using base::TimeTicks; | 56 using base::TimeTicks; |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 } | 560 } |
| 561 | 561 |
| 562 void AutofillManager::OnShowAutofillDialog() { | 562 void AutofillManager::OnShowAutofillDialog() { |
| 563 Browser* browser = BrowserList::GetLastActiveWithProfile( | 563 Browser* browser = BrowserList::GetLastActiveWithProfile( |
| 564 Profile::FromBrowserContext(tab_contents()->browser_context())); | 564 Profile::FromBrowserContext(tab_contents()->browser_context())); |
| 565 if (browser) | 565 if (browser) |
| 566 browser->ShowOptionsTab(chrome::kAutofillSubPage); | 566 browser->ShowOptionsTab(chrome::kAutofillSubPage); |
| 567 } | 567 } |
| 568 | 568 |
| 569 void AutofillManager::OnDidPreviewAutofillFormData() { | 569 void AutofillManager::OnDidPreviewAutofillFormData() { |
| 570 NotificationService::current()->Notify( | 570 content::NotificationService::current()->Notify( |
| 571 chrome::NOTIFICATION_AUTOFILL_DID_FILL_FORM_DATA, | 571 chrome::NOTIFICATION_AUTOFILL_DID_FILL_FORM_DATA, |
| 572 content::Source<RenderViewHost>(tab_contents()->render_view_host()), | 572 content::Source<RenderViewHost>(tab_contents()->render_view_host()), |
| 573 NotificationService::NoDetails()); | 573 content::NotificationService::NoDetails()); |
| 574 } | 574 } |
| 575 | 575 |
| 576 | 576 |
| 577 void AutofillManager::OnDidFillAutofillFormData(const TimeTicks& timestamp) { | 577 void AutofillManager::OnDidFillAutofillFormData(const TimeTicks& timestamp) { |
| 578 NotificationService::current()->Notify( | 578 content::NotificationService::current()->Notify( |
| 579 chrome::NOTIFICATION_AUTOFILL_DID_FILL_FORM_DATA, | 579 chrome::NOTIFICATION_AUTOFILL_DID_FILL_FORM_DATA, |
| 580 content::Source<RenderViewHost>(tab_contents()->render_view_host()), | 580 content::Source<RenderViewHost>(tab_contents()->render_view_host()), |
| 581 NotificationService::NoDetails()); | 581 content::NotificationService::NoDetails()); |
| 582 | 582 |
| 583 metric_logger_->LogUserHappinessMetric(AutofillMetrics::USER_DID_AUTOFILL); | 583 metric_logger_->LogUserHappinessMetric(AutofillMetrics::USER_DID_AUTOFILL); |
| 584 if (!user_did_autofill_) { | 584 if (!user_did_autofill_) { |
| 585 user_did_autofill_ = true; | 585 user_did_autofill_ = true; |
| 586 metric_logger_->LogUserHappinessMetric( | 586 metric_logger_->LogUserHappinessMetric( |
| 587 AutofillMetrics::USER_DID_AUTOFILL_ONCE); | 587 AutofillMetrics::USER_DID_AUTOFILL_ONCE); |
| 588 } | 588 } |
| 589 | 589 |
| 590 UpdateInitialInteractionTimestamp(timestamp); | 590 UpdateInitialInteractionTimestamp(timestamp); |
| 591 } | 591 } |
| 592 | 592 |
| 593 void AutofillManager::OnDidShowAutofillSuggestions(bool is_new_popup) { | 593 void AutofillManager::OnDidShowAutofillSuggestions(bool is_new_popup) { |
| 594 NotificationService::current()->Notify( | 594 content::NotificationService::current()->Notify( |
| 595 chrome::NOTIFICATION_AUTOFILL_DID_SHOW_SUGGESTIONS, | 595 chrome::NOTIFICATION_AUTOFILL_DID_SHOW_SUGGESTIONS, |
| 596 content::Source<RenderViewHost>(tab_contents()->render_view_host()), | 596 content::Source<RenderViewHost>(tab_contents()->render_view_host()), |
| 597 NotificationService::NoDetails()); | 597 content::NotificationService::NoDetails()); |
| 598 | 598 |
| 599 if (is_new_popup) { | 599 if (is_new_popup) { |
| 600 metric_logger_->LogUserHappinessMetric(AutofillMetrics::SUGGESTIONS_SHOWN); | 600 metric_logger_->LogUserHappinessMetric(AutofillMetrics::SUGGESTIONS_SHOWN); |
| 601 | 601 |
| 602 if (!did_show_suggestions_) { | 602 if (!did_show_suggestions_) { |
| 603 did_show_suggestions_ = true; | 603 did_show_suggestions_ = true; |
| 604 metric_logger_->LogUserHappinessMetric( | 604 metric_logger_->LogUserHappinessMetric( |
| 605 AutofillMetrics::SUGGESTIONS_SHOWN_ONCE); | 605 AutofillMetrics::SUGGESTIONS_SHOWN_ONCE); |
| 606 } | 606 } |
| 607 } | 607 } |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1223 *profile_guid = IDToGUID(profile_id); | 1223 *profile_guid = IDToGUID(profile_id); |
| 1224 } | 1224 } |
| 1225 | 1225 |
| 1226 void AutofillManager::UpdateInitialInteractionTimestamp( | 1226 void AutofillManager::UpdateInitialInteractionTimestamp( |
| 1227 const TimeTicks& interaction_timestamp) { | 1227 const TimeTicks& interaction_timestamp) { |
| 1228 if (initial_interaction_timestamp_.is_null() || | 1228 if (initial_interaction_timestamp_.is_null() || |
| 1229 interaction_timestamp < initial_interaction_timestamp_) { | 1229 interaction_timestamp < initial_interaction_timestamp_) { |
| 1230 initial_interaction_timestamp_ = interaction_timestamp; | 1230 initial_interaction_timestamp_ = interaction_timestamp; |
| 1231 } | 1231 } |
| 1232 } | 1232 } |
| OLD | NEW |