| 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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 // warning to the user in these cases. | 474 // warning to the user in these cases. |
| 474 int warning = 0; | 475 int warning = 0; |
| 475 if (!form_structure->IsAutofillable(true)) | 476 if (!form_structure->IsAutofillable(true)) |
| 476 warning = IDS_AUTOFILL_WARNING_FORM_DISABLED; | 477 warning = IDS_AUTOFILL_WARNING_FORM_DISABLED; |
| 477 else if (is_filling_credit_card && !FormIsHTTPS(*form_structure)) | 478 else if (is_filling_credit_card && !FormIsHTTPS(*form_structure)) |
| 478 warning = IDS_AUTOFILL_WARNING_INSECURE_CONNECTION; | 479 warning = IDS_AUTOFILL_WARNING_INSECURE_CONNECTION; |
| 479 if (warning) { | 480 if (warning) { |
| 480 values.assign(1, l10n_util::GetStringUTF16(warning)); | 481 values.assign(1, l10n_util::GetStringUTF16(warning)); |
| 481 labels.assign(1, string16()); | 482 labels.assign(1, string16()); |
| 482 icons.assign(1, string16()); | 483 icons.assign(1, string16()); |
| 483 unique_ids.assign(1, -1); | 484 unique_ids.assign(1, |
| 485 WebKit::WebAutofillClient::MenuItemIDWarningMessage); |
| 484 } else { | 486 } else { |
| 485 bool section_is_autofilled = | 487 bool section_is_autofilled = |
| 486 SectionIsAutofilled(*form_structure, form, | 488 SectionIsAutofilled(*form_structure, form, |
| 487 autofill_field->section()); | 489 autofill_field->section()); |
| 488 if (section_is_autofilled) { | 490 if (section_is_autofilled) { |
| 489 // If the relevant section is auto-filled and the renderer is querying | 491 // If the relevant section is auto-filled and the renderer is querying |
| 490 // for suggestions, then the user is editing the value of a field. | 492 // for suggestions, then the user is editing the value of a field. |
| 491 // In this case, mimic autocomplete: don't display labels or icons, | 493 // In this case, mimic autocomplete: don't display labels or icons, |
| 492 // as that information is redundant. | 494 // as that information is redundant. |
| 493 labels.assign(labels.size(), string16()); | 495 labels.assign(labels.size(), string16()); |
| (...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1317 *profile_guid = IDToGUID(profile_id); | 1319 *profile_guid = IDToGUID(profile_id); |
| 1318 } | 1320 } |
| 1319 | 1321 |
| 1320 void AutofillManager::UpdateInitialInteractionTimestamp( | 1322 void AutofillManager::UpdateInitialInteractionTimestamp( |
| 1321 const TimeTicks& interaction_timestamp) { | 1323 const TimeTicks& interaction_timestamp) { |
| 1322 if (initial_interaction_timestamp_.is_null() || | 1324 if (initial_interaction_timestamp_.is_null() || |
| 1323 interaction_timestamp < initial_interaction_timestamp_) { | 1325 interaction_timestamp < initial_interaction_timestamp_) { |
| 1324 initial_interaction_timestamp_ = interaction_timestamp; | 1326 initial_interaction_timestamp_ = interaction_timestamp; |
| 1325 } | 1327 } |
| 1326 } | 1328 } |
| OLD | NEW |