| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 #include "content/public/browser/web_contents.h" | 55 #include "content/public/browser/web_contents.h" |
| 56 #include "googleurl/src/gurl.h" | 56 #include "googleurl/src/gurl.h" |
| 57 #include "grit/generated_resources.h" | 57 #include "grit/generated_resources.h" |
| 58 #include "ipc/ipc_message_macros.h" | 58 #include "ipc/ipc_message_macros.h" |
| 59 #include "ui/base/l10n/l10n_util.h" | 59 #include "ui/base/l10n/l10n_util.h" |
| 60 #include "ui/gfx/rect.h" | 60 #include "ui/gfx/rect.h" |
| 61 #include "webkit/forms/form_data.h" | 61 #include "webkit/forms/form_data.h" |
| 62 #include "webkit/forms/form_data_predictions.h" | 62 #include "webkit/forms/form_data_predictions.h" |
| 63 #include "webkit/forms/form_field.h" | 63 #include "webkit/forms/form_field.h" |
| 64 #include "webkit/forms/password_form_dom_manager.h" | 64 #include "webkit/forms/password_form_dom_manager.h" |
| 65 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" |
| 65 | 66 |
| 66 using base::TimeTicks; | 67 using base::TimeTicks; |
| 67 using content::BrowserThread; | 68 using content::BrowserThread; |
| 68 using content::RenderViewHost; | 69 using content::RenderViewHost; |
| 69 using switches::kEnableAutofillFeedback; | 70 using switches::kEnableAutofillFeedback; |
| 70 using webkit::forms::FormData; | 71 using webkit::forms::FormData; |
| 71 using webkit::forms::FormDataPredictions; | 72 using webkit::forms::FormDataPredictions; |
| 72 using webkit::forms::FormField; | 73 using webkit::forms::FormField; |
| 73 | 74 |
| 74 namespace { | 75 namespace { |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 // warning to the user in these cases. | 472 // warning to the user in these cases. |
| 472 int warning = 0; | 473 int warning = 0; |
| 473 if (!form_structure->IsAutofillable(true)) | 474 if (!form_structure->IsAutofillable(true)) |
| 474 warning = IDS_AUTOFILL_WARNING_FORM_DISABLED; | 475 warning = IDS_AUTOFILL_WARNING_FORM_DISABLED; |
| 475 else if (is_filling_credit_card && !FormIsHTTPS(*form_structure)) | 476 else if (is_filling_credit_card && !FormIsHTTPS(*form_structure)) |
| 476 warning = IDS_AUTOFILL_WARNING_INSECURE_CONNECTION; | 477 warning = IDS_AUTOFILL_WARNING_INSECURE_CONNECTION; |
| 477 if (warning) { | 478 if (warning) { |
| 478 values.assign(1, l10n_util::GetStringUTF16(warning)); | 479 values.assign(1, l10n_util::GetStringUTF16(warning)); |
| 479 labels.assign(1, string16()); | 480 labels.assign(1, string16()); |
| 480 icons.assign(1, string16()); | 481 icons.assign(1, string16()); |
| 481 unique_ids.assign(1, -1); | 482 unique_ids.assign(1, WebKit::WarningMessageMenuItemID); |
| 482 } else { | 483 } else { |
| 483 bool section_is_autofilled = | 484 bool section_is_autofilled = |
| 484 SectionIsAutofilled(*form_structure, form, | 485 SectionIsAutofilled(*form_structure, form, |
| 485 autofill_field->section()); | 486 autofill_field->section()); |
| 486 if (section_is_autofilled) { | 487 if (section_is_autofilled) { |
| 487 // If the relevant section is auto-filled and the renderer is querying | 488 // If the relevant section is auto-filled and the renderer is querying |
| 488 // for suggestions, then the user is editing the value of a field. | 489 // for suggestions, then the user is editing the value of a field. |
| 489 // In this case, mimic autocomplete: don't display labels or icons, | 490 // In this case, mimic autocomplete: don't display labels or icons, |
| 490 // as that information is redundant. | 491 // as that information is redundant. |
| 491 labels.assign(labels.size(), string16()); | 492 labels.assign(labels.size(), string16()); |
| (...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1315 *profile_guid = IDToGUID(profile_id); | 1316 *profile_guid = IDToGUID(profile_id); |
| 1316 } | 1317 } |
| 1317 | 1318 |
| 1318 void AutofillManager::UpdateInitialInteractionTimestamp( | 1319 void AutofillManager::UpdateInitialInteractionTimestamp( |
| 1319 const TimeTicks& interaction_timestamp) { | 1320 const TimeTicks& interaction_timestamp) { |
| 1320 if (initial_interaction_timestamp_.is_null() || | 1321 if (initial_interaction_timestamp_.is_null() || |
| 1321 interaction_timestamp < initial_interaction_timestamp_) { | 1322 interaction_timestamp < initial_interaction_timestamp_) { |
| 1322 initial_interaction_timestamp_ = interaction_timestamp; | 1323 initial_interaction_timestamp_ = interaction_timestamp; |
| 1323 } | 1324 } |
| 1324 } | 1325 } |
| OLD | NEW |