Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | |
|
vabr (Chromium)
2016/08/10 14:00:51
nit: No "(c)" in the copyright message, just the y
leonhsl(Using Gerrit)
2016/08/11 06:29:55
Oh,, I have no idea where I copied this from.. ;-)
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_RENDERER_AUTOFILL_FAKE_CONTENT_PASSWORD_MANAGER_DRIVER_H_ | |
| 6 #define CHROME_RENDERER_AUTOFILL_FAKE_CONTENT_PASSWORD_MANAGER_DRIVER_H_ | |
| 7 | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "base/optional.h" | |
| 11 #include "base/strings/string16.h" | |
| 12 #include "components/autofill/content/public/interfaces/autofill_driver.mojom.h" | |
| 13 #include "mojo/public/cpp/bindings/binding_set.h" | |
| 14 | |
| 15 class FakeContentPasswordManagerDriver | |
| 16 : public autofill::mojom::PasswordManagerDriver { | |
| 17 public: | |
| 18 FakeContentPasswordManagerDriver(); | |
| 19 | |
| 20 ~FakeContentPasswordManagerDriver() override; | |
| 21 | |
| 22 void BindRequest(autofill::mojom::PasswordManagerDriverRequest request); | |
| 23 | |
| 24 bool called_show_pw_suggestions() const { | |
| 25 return called_show_pw_suggestions_; | |
| 26 } | |
| 27 | |
| 28 int show_pw_suggestions_key() const { return show_pw_suggestions_key_; } | |
| 29 | |
| 30 const base::Optional<base::string16>& show_pw_suggestions_username() const { | |
| 31 return show_pw_suggestions_username_; | |
| 32 } | |
| 33 | |
| 34 int show_pw_suggestions_options() const { | |
| 35 return show_pw_suggestions_options_; | |
| 36 } | |
| 37 | |
| 38 void reset_show_pw_suggestions() { | |
| 39 called_show_pw_suggestions_ = false; | |
| 40 show_pw_suggestions_key_ = -1; | |
| 41 show_pw_suggestions_username_ = base::nullopt; | |
| 42 show_pw_suggestions_options_ = -1; | |
| 43 } | |
| 44 | |
| 45 bool called_password_form_submitted() const { | |
| 46 return called_password_form_submitted_; | |
| 47 } | |
| 48 | |
| 49 const base::Optional<autofill::PasswordForm>& password_form_submitted() | |
| 50 const { | |
| 51 return password_form_submitted_; | |
| 52 } | |
| 53 | |
| 54 bool called_inpage_navigation() const { return called_inpage_navigation_; } | |
| 55 | |
| 56 const base::Optional<autofill::PasswordForm>& | |
| 57 password_form_inpage_navigation() const { | |
| 58 return password_form_inpage_navigation_; | |
| 59 } | |
| 60 | |
| 61 bool called_password_forms_rendered() const { | |
| 62 return called_password_forms_rendered_; | |
| 63 } | |
| 64 | |
| 65 const base::Optional<std::vector<autofill::PasswordForm>>& | |
|
vabr (Chromium)
2016/08/10 14:00:51
Should you forward-declare PasswordForm?
namespac
leonhsl(Using Gerrit)
2016/08/11 06:29:55
As we also uses PasswordForm to define a member va
vabr (Chromium)
2016/08/11 07:29:18
Acknowledged.
| |
| 66 password_forms_rendered() const { | |
| 67 return password_forms_rendered_; | |
| 68 } | |
| 69 | |
| 70 void reset_password_forms_rendered() { | |
| 71 called_password_forms_rendered_ = false; | |
| 72 password_forms_rendered_ = base::nullopt; | |
| 73 } | |
| 74 | |
| 75 bool called_record_save_progress() const { | |
| 76 return called_record_save_progress_; | |
| 77 } | |
| 78 | |
| 79 bool called_agent_constructed() const { return called_agent_constructed_; } | |
| 80 | |
| 81 bool called_save_generation_field() const { | |
| 82 return called_save_generation_field_; | |
| 83 } | |
| 84 | |
| 85 const base::Optional<base::string16>& save_generation_field() const { | |
| 86 return save_generation_field_; | |
| 87 } | |
| 88 | |
| 89 void reset_save_generation_field() { | |
| 90 called_save_generation_field_ = false; | |
| 91 save_generation_field_ = base::nullopt; | |
| 92 } | |
| 93 | |
| 94 bool called_password_no_longer_generated() const { | |
| 95 return called_password_no_longer_generated_; | |
| 96 } | |
| 97 | |
| 98 void reset_called_password_no_longer_generated() { | |
| 99 called_password_no_longer_generated_ = false; | |
| 100 } | |
| 101 | |
| 102 bool called_presave_generated_password() const { | |
| 103 return called_presave_generated_password_; | |
| 104 } | |
| 105 | |
| 106 void reset_called_presave_generated_password() { | |
| 107 called_presave_generated_password_ = false; | |
| 108 } | |
| 109 | |
| 110 private: | |
| 111 // mojom::PasswordManagerDriver: | |
| 112 void PasswordFormsParsed( | |
| 113 const std::vector<autofill::PasswordForm>& forms) override; | |
| 114 | |
| 115 void PasswordFormsRendered( | |
| 116 const std::vector<autofill::PasswordForm>& visible_forms, | |
| 117 bool did_stop_loading) override; | |
| 118 | |
| 119 void PasswordFormSubmitted( | |
| 120 const autofill::PasswordForm& password_form) override; | |
| 121 | |
| 122 void InPageNavigation(const autofill::PasswordForm& password_form) override; | |
| 123 | |
| 124 void PresaveGeneratedPassword( | |
| 125 const autofill::PasswordForm& password_form) override; | |
| 126 | |
| 127 void PasswordNoLongerGenerated( | |
| 128 const autofill::PasswordForm& password_form) override; | |
| 129 | |
| 130 void ShowPasswordSuggestions(int key, | |
| 131 base::i18n::TextDirection text_direction, | |
| 132 const base::string16& typed_username, | |
| 133 int options, | |
| 134 const gfx::RectF& bounds) override; | |
| 135 | |
| 136 void PasswordAutofillAgentConstructed() override; | |
| 137 | |
| 138 void RecordSavePasswordProgress(const std::string& log) override; | |
|
vabr (Chromium)
2016/08/10 14:00:52
Please also #include <string>.
leonhsl(Using Gerrit)
2016/08/11 06:29:55
Done.
| |
| 139 | |
| 140 void SaveGenerationFieldDetectedByClassifier( | |
| 141 const autofill::PasswordForm& password_form, | |
| 142 const base::string16& generation_field) override; | |
| 143 | |
| 144 // Records whether ShowPasswordSuggestions() gets called. | |
| 145 bool called_show_pw_suggestions_ = false; | |
| 146 // Records data received via ShowPasswordSuggestions() call. | |
| 147 int show_pw_suggestions_key_ = -1; | |
| 148 base::Optional<base::string16> show_pw_suggestions_username_; | |
| 149 int show_pw_suggestions_options_ = -1; | |
| 150 // Records whether PasswordFormSubmitted() gets called. | |
| 151 bool called_password_form_submitted_ = false; | |
| 152 // Records data received via PasswordFormSubmitted() call. | |
| 153 base::Optional<autofill::PasswordForm> password_form_submitted_; | |
| 154 // Records whether InPageNavigation() gets called. | |
| 155 bool called_inpage_navigation_ = false; | |
| 156 // Records data received via InPageNavigation() call. | |
| 157 base::Optional<autofill::PasswordForm> password_form_inpage_navigation_; | |
| 158 // Records whether PasswordFormsRendered() gets called. | |
| 159 bool called_password_forms_rendered_ = false; | |
| 160 // Records data received via PasswordFormsRendered() call. | |
| 161 base::Optional<std::vector<autofill::PasswordForm>> password_forms_rendered_; | |
| 162 // Records whether RecordSavePasswordProgress() gets called. | |
| 163 bool called_record_save_progress_ = false; | |
| 164 // Records whether PasswordAutofillAgentConstructed() gets called. | |
| 165 bool called_agent_constructed_ = false; | |
| 166 // Records whether SaveGenerationFieldDetectedByClassifier() gets called. | |
| 167 bool called_save_generation_field_ = false; | |
| 168 // Records data received via SaveGenerationFieldDetectedByClassifier() call. | |
| 169 base::Optional<base::string16> save_generation_field_; | |
| 170 // Records whether PasswordNoLongerGenerated() gets called. | |
| 171 bool called_password_no_longer_generated_ = false; | |
| 172 // Records whether PresaveGeneratedPassword() gets called. | |
| 173 bool called_presave_generated_password_ = false; | |
| 174 | |
| 175 mojo::BindingSet<autofill::mojom::PasswordManagerDriver> bindings_; | |
| 176 }; | |
| 177 | |
| 178 #endif // CHROME_RENDERER_AUTOFILL_FAKE_CONTENT_PASSWORD_MANAGER_DRIVER_H_ | |
| OLD | NEW |