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

Side by Side Diff: chrome/browser/autofill/password_autofill_manager.h

Issue 9600038: Add Password Autofill Manager to New Autofill (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Hiding renderer popup Created 8 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_AUTOFILL_PASSWORD_AUTOFILL_MANAGER_H_
6 #define CHROME_BROWSER_AUTOFILL_PASSWORD_AUTOFILL_MANAGER_H_
7 #pragma once
8
9 // This file was contains some repeated code from
10 // chrome/renderer/autofill/password_autofill_manager because as we move to the
11 // new Autofill UI we needs these functions in both the browser and renderer.
12 // Once the move is completed the repeated code in the renderer half should be
13 // removed.
14 // http://crbug.com/51644
15
16 #include <map>
17
18 #include "webkit/forms/password_form_dom_manager.h"
19
20 namespace content {
21 class RenderViewHost;
22 } // namespace content
23
24 // This class is responsible for filling password forms.
25 class PasswordAutofillManager {
26 public:
27 explicit PasswordAutofillManager(content::RenderViewHost* render_view_host);
28 virtual ~PasswordAutofillManager();
29
30 // If this return true, it indicates the event would be consumed by the
31 // password manager in the renderer, so we shouldn't attempt to handle the
32 // key down, but instead pass it to the renderer.
33 bool WouldHandleKeyDown(const webkit::forms::FormField& field);
34
35 // Fills the password associated with user name |value|. Returns true if the
36 // username and password fields were filled, false otherwise.
37 bool DidAcceptAutofillSuggestion(const webkit::forms::FormField& field,
38 const string16& value);
39
40 // A no-op. No filling happens for selection. But this method returns
41 // true when |node| is fillable by password Autofill.
42 bool DidSelectAutofillSuggestion(const webkit::forms::FormField& field);
43
44 // A no-op. Password forms are not previewed, so they do not need to be
45 // cleared when the selection changes. However, this method returns
46 // true when |node| is fillable by password Autofill.
47 bool DidClearAutofillSelection(const webkit::forms::FormField& field);
48
49 // Invoked when a password form is filled.
50 void FillPasswordForm(const webkit::forms::FormField& username_element,
51 const webkit::forms::PasswordFormFillData& form_data,
52 long long frame_id);
53
54 // Invoked when the passed frame is closing. Gives us a chance to clear any
55 // reference we may have to elements in that frame.
56 void FrameClosing(long long frame_id);
Ilya Sherman 2012/03/08 23:22:14 I think it should be safe, and much simpler, to ju
csharp 2012/03/09 16:20:19 k, I'll make that change. I'll also add a comment
57
58 private:
59 struct PasswordInfo {
60 long long frame_id;
61 webkit::forms::PasswordFormFillData fill_data;
62 };
63 typedef std::map<webkit::forms::FormField, PasswordInfo>
64 LoginToPasswordInfoMap;
65
66 bool WillFillUserNameAndPassword(
67 const webkit::forms::FormField& username_element,
68 const webkit::forms::PasswordFormFillData& fill_data);
69
70 // Finds login information for a |node| that was previously filled.
71 bool FindLoginInfo(const webkit::forms::FormField& field,
72 webkit::forms::FormField* found_input,
73 PasswordInfo* found_password);
74
75 // The logins we have filled so far with their associated info.
76 LoginToPasswordInfoMap login_to_password_info_;
77
78 content::RenderViewHost* render_view_host_; // Weak reference.
79
80 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillManager);
81 };
82
83 #endif // CHROME_BROWSER_AUTOFILL_PASSWORD_AUTOFILL_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698