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 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_FORM_MANAGER_H_ | 5 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_FORM_MANAGER_H_ |
6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_FORM_MANAGER_H_ | 6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_FORM_MANAGER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 24 matching lines...) Expand all Loading... |
35 // A map from field names to field types. | 35 // A map from field names to field types. |
36 using FieldTypeMap = std::map<base::string16, autofill::ServerFieldType>; | 36 using FieldTypeMap = std::map<base::string16, autofill::ServerFieldType>; |
37 | 37 |
38 // This class helps with filling the observed form (both HTML and from HTTP | 38 // This class helps with filling the observed form (both HTML and from HTTP |
39 // auth) and with saving/updating the stored information about it. | 39 // auth) and with saving/updating the stored information about it. |
40 class PasswordFormManager : public FormFetcher::Consumer { | 40 class PasswordFormManager : public FormFetcher::Consumer { |
41 public: | 41 public: |
42 // |password_manager| owns |this|, |client| and |driver| serve to | 42 // |password_manager| owns |this|, |client| and |driver| serve to |
43 // communicate with embedder, |observed_form| is the associated form |this| | 43 // communicate with embedder, |observed_form| is the associated form |this| |
44 // is managing, |form_saver| is used to save/update the form and | 44 // is managing, |form_saver| is used to save/update the form and |
45 // |form_fetcher| to get saved data about the form. | 45 // |form_fetcher| to get saved data about the form. |form_fetcher| must not be |
| 46 // destroyed before |this|. |
46 // | 47 // |
47 // TODO(crbug.com/621355): So far, |form_fetcher| can be null. In that case | 48 // TODO(crbug.com/621355): So far, |form_fetcher| can be null. In that case |
48 // |this| creates an instance of it itself (meant for production code). Once | 49 // |this| creates an instance of it itself (meant for production code). Once |
49 // the fetcher is shared between PasswordFormManager instances, it will be | 50 // the fetcher is shared between PasswordFormManager instances, it will be |
50 // required that |form_fetcher| is not null. | 51 // required that |form_fetcher| is not null. |
51 PasswordFormManager(PasswordManager* password_manager, | 52 PasswordFormManager(PasswordManager* password_manager, |
52 PasswordManagerClient* client, | 53 PasswordManagerClient* client, |
53 const base::WeakPtr<PasswordManagerDriver>& driver, | 54 const base::WeakPtr<PasswordManagerDriver>& driver, |
54 const autofill::PasswordForm& observed_form, | 55 const autofill::PasswordForm& observed_form, |
55 std::unique_ptr<FormSaver> form_saver, | 56 std::unique_ptr<FormSaver> form_saver, |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 void OnNoInteraction(bool is_update); | 237 void OnNoInteraction(bool is_update); |
237 | 238 |
238 // Saves the outcome of HTML parsing based form classifier to upload proto. | 239 // Saves the outcome of HTML parsing based form classifier to upload proto. |
239 void SaveGenerationFieldDetectedByClassifier( | 240 void SaveGenerationFieldDetectedByClassifier( |
240 const base::string16& generation_field); | 241 const base::string16& generation_field); |
241 | 242 |
242 FormSaver* form_saver() { return form_saver_.get(); } | 243 FormSaver* form_saver() { return form_saver_.get(); } |
243 | 244 |
244 // Clears references to matches derived from the associated FormFetcher data. | 245 // Clears references to matches derived from the associated FormFetcher data. |
245 // After calling this, the PasswordFormManager holds no references to objects | 246 // After calling this, the PasswordFormManager holds no references to objects |
246 // owned by the associated FormFetcher. | 247 // owned by the associated FormFetcher. This does not cause removing |this| as |
| 248 // a consumer of |form_fetcher_|. |
247 void ResetStoredMatches(); | 249 void ResetStoredMatches(); |
248 | 250 |
249 // Takes ownership of |fetcher|. | 251 // Takes ownership of |fetcher|. |
250 // TODO(crbug.com/621355) Until https://codereview.chromium.org/2758773002/, | 252 // TODO(crbug.com/621355) Until https://codereview.chromium.org/2758773002/, |
251 // |fetcher.get()| must be the same as |form_fetcher_|. | 253 // |fetcher.get()| must be the same as |form_fetcher_|. |
252 void GrabFetcher(std::unique_ptr<FormFetcher> fetcher); | 254 void GrabFetcher(std::unique_ptr<FormFetcher> fetcher); |
253 | 255 |
254 protected: | 256 protected: |
255 // FormFetcher::Consumer: | 257 // FormFetcher::Consumer: |
256 void ProcessMatches( | 258 void ProcessMatches( |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 // True if the main frame's visible URL, at the time this PasswordFormManager | 577 // True if the main frame's visible URL, at the time this PasswordFormManager |
576 // was created, is secure. | 578 // was created, is secure. |
577 bool is_main_frame_secure_ = false; | 579 bool is_main_frame_secure_ = false; |
578 | 580 |
579 DISALLOW_COPY_AND_ASSIGN(PasswordFormManager); | 581 DISALLOW_COPY_AND_ASSIGN(PasswordFormManager); |
580 }; | 582 }; |
581 | 583 |
582 } // namespace password_manager | 584 } // namespace password_manager |
583 | 585 |
584 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_FORM_MANAGER_H_ | 586 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_FORM_MANAGER_H_ |
OLD | NEW |