| OLD | NEW |
| 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> |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 } | 316 } |
| 317 | 317 |
| 318 void AutofillManager::SetExternalDelegate(AutofillExternalDelegate* delegate) { | 318 void AutofillManager::SetExternalDelegate(AutofillExternalDelegate* delegate) { |
| 319 // TODO(jrg): consider passing delegate into the ctor. That won't | 319 // TODO(jrg): consider passing delegate into the ctor. That won't |
| 320 // work if the delegate has a pointer to the AutofillManager, but | 320 // work if the delegate has a pointer to the AutofillManager, but |
| 321 // future directions may not need such a pointer. | 321 // future directions may not need such a pointer. |
| 322 external_delegate_ = delegate; | 322 external_delegate_ = delegate; |
| 323 autocomplete_history_manager_.SetExternalDelegate(delegate); | 323 autocomplete_history_manager_.SetExternalDelegate(delegate); |
| 324 } | 324 } |
| 325 | 325 |
| 326 bool AutofillManager::HasExternalDelegate() { | 326 bool AutofillManager::IsNativeUiEnabled() { |
| 327 return external_delegate_ != NULL; | 327 return external_delegate_ != NULL; |
| 328 } | 328 } |
| 329 | 329 |
| 330 bool AutofillManager::OnMessageReceived(const IPC::Message& message) { | 330 bool AutofillManager::OnMessageReceived(const IPC::Message& message) { |
| 331 bool handled = true; | 331 bool handled = true; |
| 332 IPC_BEGIN_MESSAGE_MAP(AutofillManager, message) | 332 IPC_BEGIN_MESSAGE_MAP(AutofillManager, message) |
| 333 IPC_MESSAGE_HANDLER(AutofillHostMsg_FormsSeen, OnFormsSeen) | 333 IPC_MESSAGE_HANDLER(AutofillHostMsg_FormsSeen, OnFormsSeen) |
| 334 IPC_MESSAGE_HANDLER(AutofillHostMsg_FormSubmitted, OnFormSubmitted) | 334 IPC_MESSAGE_HANDLER(AutofillHostMsg_FormSubmitted, OnFormSubmitted) |
| 335 IPC_MESSAGE_HANDLER(AutofillHostMsg_TextFieldDidChange, | 335 IPC_MESSAGE_HANDLER(AutofillHostMsg_TextFieldDidChange, |
| 336 OnTextFieldDidChange) | 336 OnTextFieldDidChange) |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 | 722 |
| 723 if (!did_show_suggestions_) { | 723 if (!did_show_suggestions_) { |
| 724 did_show_suggestions_ = true; | 724 did_show_suggestions_ = true; |
| 725 metric_logger_->LogUserHappinessMetric( | 725 metric_logger_->LogUserHappinessMetric( |
| 726 AutofillMetrics::SUGGESTIONS_SHOWN_ONCE); | 726 AutofillMetrics::SUGGESTIONS_SHOWN_ONCE); |
| 727 } | 727 } |
| 728 } | 728 } |
| 729 } | 729 } |
| 730 | 730 |
| 731 void AutofillManager::OnHideAutofillPopup() { | 731 void AutofillManager::OnHideAutofillPopup() { |
| 732 if (external_delegate_) | 732 if (IsNativeUiEnabled()) |
| 733 external_delegate_->HideAutofillPopup(); | 733 manager_delegate_->HideAutofillPopup(); |
| 734 } | 734 } |
| 735 | 735 |
| 736 void AutofillManager::OnShowPasswordGenerationPopup( | 736 void AutofillManager::OnShowPasswordGenerationPopup( |
| 737 const gfx::Rect& bounds, | 737 const gfx::Rect& bounds, |
| 738 int max_length, | 738 int max_length, |
| 739 const content::PasswordForm& form) { | 739 const content::PasswordForm& form) { |
| 740 password_generator_.reset(new autofill::PasswordGenerator(max_length)); | 740 password_generator_.reset(new autofill::PasswordGenerator(max_length)); |
| 741 manager_delegate_->ShowPasswordGenerationBubble( | 741 manager_delegate_->ShowPasswordGenerationBubble( |
| 742 bounds, form, password_generator_.get()); | 742 bounds, form, password_generator_.get()); |
| 743 } | 743 } |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1319 *profile_guid = IDToGUID(profile_id); | 1319 *profile_guid = IDToGUID(profile_id); |
| 1320 } | 1320 } |
| 1321 | 1321 |
| 1322 void AutofillManager::UpdateInitialInteractionTimestamp( | 1322 void AutofillManager::UpdateInitialInteractionTimestamp( |
| 1323 const TimeTicks& interaction_timestamp) { | 1323 const TimeTicks& interaction_timestamp) { |
| 1324 if (initial_interaction_timestamp_.is_null() || | 1324 if (initial_interaction_timestamp_.is_null() || |
| 1325 interaction_timestamp < initial_interaction_timestamp_) { | 1325 interaction_timestamp < initial_interaction_timestamp_) { |
| 1326 initial_interaction_timestamp_ = interaction_timestamp; | 1326 initial_interaction_timestamp_ = interaction_timestamp; |
| 1327 } | 1327 } |
| 1328 } | 1328 } |
| OLD | NEW |