1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "components/autofill/core/common/password_autofill_util.h"
7 #include "base/command_line.h"
8 #include "base/metrics/field_trial.h"
9 #include "components/autofill/core/common/autofill_switches.h"
15 const char kDisableIgnoreAutocompleteOffFieldTrialName[] =
16 "DisableIgnoreAutocompleteOff";
17 const char kEnablingGroup[] = "ENABLED";
19 bool InDisableIgnoreAutocompleteOffGroup() {
20 std::string group_name = base::FieldTrialList::FindFullName(
21 kDisableIgnoreAutocompleteOffFieldTrialName);
23 return group_name.compare(kEnablingGroup) == 0;
28 // We ignore autocomplete='off' unless the user has specified the command line
29 // flag instructing otherwise or is in the field trial group specifying that
30 // ignore autocomplete='off' should be disabled.
31 bool ShouldIgnoreAutocompleteOffForPasswordFields() {
32 // TODO(jww): The field trial is scheduled to end 2014/9/1. At latest, we
33 // should remove the field trial and switch by then.
34 return !InDisableIgnoreAutocompleteOffGroup() &&
35 !CommandLine::ForCurrentProcess()->HasSwitch(
36 switches::kDisableIgnoreAutocompleteOff);
39 } // namespace autofill