Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(559)

Side by Side Diff: components/password_manager/core/browser/password_autofill_manager.h

Issue 184103016: Autofill: Refactoring to support fetching password after a username is selected (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Get unit tests compiling. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_AUTOFILL_MANAGER_H_
6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_AUTOFILL_MANAGER_H_
7
8 // This file was contains some repeated code from
9 // chrome/renderer/autofill/password_autofill_manager because as we move to the
10 // new Autofill UI we needs these functions in both the browser and renderer.
11 // Once the move is completed the repeated code in the renderer half should be
12 // removed.
13 // http://crbug.com/51644
Garrett Casto 2014/03/14 08:25:22 I can't tell if this should be updated or removed.
Patrick Dubroy 2014/03/14 12:07:19 Removed, because I'm pretty sure this is obsolete.
Garrett Casto 2014/03/14 23:24:22 FWIW, the explanatory text and crbug.com/118601 de
14
15 #include <map>
16
17 #include "base/gtest_prod_util.h"
18 #include "components/autofill/core/browser/autofill_manager_delegate.h"
19 #include "components/autofill/core/browser/autofill_popup_delegate.h"
20 #include "components/autofill/core/common/password_form_fill_data.h"
21
22 class PasswordManagerClient;
23
24 namespace gfx {
25 class RectF;
26 }
27
28 // This class is responsible for filling password forms.
29 class PasswordAutofillManager : public autofill::AutofillPopupDelegate {
30 public:
31 PasswordAutofillManager(
32 PasswordManagerClient* password_manager_client,
33 autofill::AutofillManagerDelegate* autofill_manager_delegate);
34 virtual ~PasswordAutofillManager();
35
36 // AutofillPopupDelegate implementation.
37 virtual void OnPopupShown() OVERRIDE;
38 virtual void OnPopupHidden() OVERRIDE;
39 virtual bool ShouldRepostEvent(const ui::MouseEvent& event) OVERRIDE;
40 virtual void DidSelectSuggestion(int identifier) OVERRIDE;
41 virtual void DidAcceptSuggestion(const base::string16& value,
42 int identifier) OVERRIDE;
43 virtual void RemoveSuggestion(const base::string16& value,
44 int identifier) OVERRIDE;
45 virtual void ClearPreviewedForm() OVERRIDE;
46
47 // Invoked when a password mapping is added.
48 void AddPasswordFormMapping(
49 const autofill::FormFieldData& username_element,
50 const autofill::PasswordFormFillData& password);
51
52 void ShowPasswordSuggestions(
53 const autofill::FormFieldData& field,
54 const gfx::RectF& bounds,
55 const std::vector<base::string16>& suggestions,
56 const std::vector<base::string16>& realms);
57
58 // Invoked to clear any page specific cached values.
59 void Reset();
60
61 private:
62 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillManagerTest,
63 AcceptAutofillSuggestion);
64
65 // TODO(csharp): Modify the AutofillExternalDeletegate code so that it can
Garrett Casto 2014/03/14 08:25:22 Update comment.
Patrick Dubroy 2014/03/14 12:07:19 I think this is also obsolete -- removed.
66 // figure out if a entry is a password one without using this mapping.
67 // crbug.com/118601
68 typedef std::map<autofill::FormFieldData, autofill::PasswordFormFillData>
69 LoginToPasswordInfoMap;
70
71 // Attempts to fill the password associated with user name |username|, and
72 // returns true if it was successful.
73 bool AcceptAutofillSuggestion(const autofill::FormFieldData& field,
74 const base::string16& username);
75
76 // If |current_username| matches a username for one of the login mappings in
77 // |fill_data|, returns true and assigns the password to |out_password|.
78 // Otherwise, returns false and leaves |out_password| untouched.
79 bool GetPasswordForUsername(
80 const base::string16& current_username,
81 const autofill::PasswordFormFillData& fill_data,
82 base::string16* out_password);
83
84 // Finds login information for a |node| that was previously filled.
85 bool FindLoginInfo(const autofill::FormFieldData& field,
86 autofill::PasswordFormFillData* found_password);
87
88 // The logins we have filled so far with their associated info.
89 LoginToPasswordInfoMap login_to_password_info_;
90
91 // Provides embedder-level operations on passwords. Must outlive |this|.
92 PasswordManagerClient* const password_manager_client_; // weak
93
94 autofill::AutofillManagerDelegate* const autofill_manager_delegate_; // weak
95
96 autofill::FormFieldData form_field_;
97
98 base::WeakPtrFactory<PasswordAutofillManager> weak_ptr_factory_;
99
100 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillManager);
101 };
102
103 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_AUTOFILL_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698