OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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_AUTOFILL_CONTENT_RENDERER_PASSWORD_GENERATION_MANAGER_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_GENERATION_MANAGER_H_ |
6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_GENERATION_MANAGER_H_ | 6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_GENERATION_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/memory/scoped_ptr.h" | |
12 #include "content/public/renderer/render_view_observer.h" | 13 #include "content/public/renderer/render_view_observer.h" |
13 #include "third_party/WebKit/public/web/WebInputElement.h" | 14 #include "third_party/WebKit/public/web/WebInputElement.h" |
14 #include "third_party/WebKit/public/web/WebPasswordGeneratorClient.h" | 15 #include "third_party/WebKit/public/web/WebPasswordGeneratorClient.h" |
15 #include "url/gurl.h" | 16 #include "url/gurl.h" |
16 | 17 |
17 namespace WebKit { | 18 namespace WebKit { |
18 class WebCString; | 19 class WebCString; |
19 class WebDocument; | 20 class WebDocument; |
20 } | 21 } |
21 | 22 |
23 namespace autofill { | |
24 struct FormData; | |
25 } | |
26 | |
22 namespace content { | 27 namespace content { |
23 struct PasswordForm; | 28 struct PasswordForm; |
24 } | 29 } |
25 | 30 |
26 namespace autofill { | 31 namespace autofill { |
27 | 32 |
28 // This class is responsible for controlling communication for password | 33 // This class is responsible for controlling communication for password |
29 // generation between the browser (which shows the popup and generates | 34 // generation between the browser (which shows the popup and generates |
30 // passwords) and WebKit (shows the generation icon in the password field). | 35 // passwords) and WebKit (shows the generation icon in the password field). |
31 class PasswordGenerationManager : public content::RenderViewObserver, | 36 class PasswordGenerationManager : public content::RenderViewObserver, |
(...skipping 15 matching lines...) Expand all Loading... | |
47 virtual void DidFinishDocumentLoad(WebKit::WebFrame* frame) OVERRIDE; | 52 virtual void DidFinishDocumentLoad(WebKit::WebFrame* frame) OVERRIDE; |
48 virtual void DidFinishLoad(WebKit::WebFrame* frame) OVERRIDE; | 53 virtual void DidFinishLoad(WebKit::WebFrame* frame) OVERRIDE; |
49 | 54 |
50 // WebPasswordGeneratorClient: | 55 // WebPasswordGeneratorClient: |
51 virtual void openPasswordGenerator(WebKit::WebInputElement& element) OVERRIDE; | 56 virtual void openPasswordGenerator(WebKit::WebInputElement& element) OVERRIDE; |
52 | 57 |
53 // Message handlers. | 58 // Message handlers. |
54 void OnFormNotBlacklisted(const content::PasswordForm& form); | 59 void OnFormNotBlacklisted(const content::PasswordForm& form); |
55 void OnPasswordAccepted(const base::string16& password); | 60 void OnPasswordAccepted(const base::string16& password); |
56 void OnPasswordGenerationEnabled(bool enabled); | 61 void OnPasswordGenerationEnabled(bool enabled); |
62 void OnAccountCreationFormsDetected( | |
63 const std::vector<autofill::FormData>& forms); | |
57 | 64 |
58 // Helper function to decide whether we should show password generation icon. | 65 // Helper function to decide whether we should show password generation icon. |
59 void MaybeShowIcon(); | 66 void MaybeShowIcon(); |
60 | 67 |
61 content::RenderView* render_view_; | 68 content::RenderView* render_view_; |
62 | 69 |
63 // True if password generation is enabled for the profile associated | 70 // True if password generation is enabled for the profile associated |
64 // with this renderer. | 71 // with this renderer. |
65 bool enabled_; | 72 bool enabled_; |
66 | 73 |
67 // Stores the origin of the account creation form we detected. | 74 // Stores the origin of the account creation form we detected. |
68 GURL account_creation_form_origin_; | 75 scoped_ptr<content::PasswordForm> possible_account_creation_form_; |
69 | 76 |
70 // Stores the origins of the password forms confirmed not to be blacklisted | 77 // Stores the origins of the password forms confirmed not to be blacklisted |
71 // by the browser. A form can be blacklisted if a user chooses "never save | 78 // by the browser. A form can be blacklisted if a user chooses "never save |
72 // passwords for this site". | 79 // passwords for this site". |
73 std::vector<GURL> not_blacklisted_password_form_origins_; | 80 std::vector<GURL> not_blacklisted_password_form_origins_; |
74 | 81 |
82 // Stores the password form for which the Autofill server classifies one of | |
Ilya Sherman
2013/09/03 23:58:01
nit: "Stores the" -> "Stores each"
zysxqn
2013/09/04 17:26:20
Done.
| |
83 // the form's fields as an ACCOUNT_CREATION_PASSWORD. | |
84 std::vector<autofill::FormData> account_creation_forms_; | |
85 | |
75 std::vector<WebKit::WebInputElement> passwords_; | 86 std::vector<WebKit::WebInputElement> passwords_; |
76 | 87 |
77 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationManager); | 88 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationManager); |
78 }; | 89 }; |
79 | 90 |
80 } // namespace autofill | 91 } // namespace autofill |
81 | 92 |
82 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_GENERATION_MANAGER_H_ | 93 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_GENERATION_MANAGER_H_ |
OLD | NEW |