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_AGENT_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_GENERATION_AGENT_H_ |
6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_GENERATION_AGENT_H_ | 6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_GENERATION_AGENT_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 21 matching lines...) Expand all Loading... |
32 explicit PasswordGenerationAgent(content::RenderView* render_view); | 32 explicit PasswordGenerationAgent(content::RenderView* render_view); |
33 virtual ~PasswordGenerationAgent(); | 33 virtual ~PasswordGenerationAgent(); |
34 | 34 |
35 // Returns true if the field being changed is one where a generated password | 35 // Returns true if the field being changed is one where a generated password |
36 // is being offered. Updates the state of the popup if necessary. | 36 // is being offered. Updates the state of the popup if necessary. |
37 bool TextDidChangeInTextField(const blink::WebInputElement& element); | 37 bool TextDidChangeInTextField(const blink::WebInputElement& element); |
38 | 38 |
39 // Returns true if the newly focused node caused the generation UI to show. | 39 // Returns true if the newly focused node caused the generation UI to show. |
40 bool FocusedNodeHasChanged(const blink::WebNode& node); | 40 bool FocusedNodeHasChanged(const blink::WebNode& node); |
41 | 41 |
| 42 // The length that a password can be before the UI is hidden. |
| 43 static const size_t kMaximumOfferSize = 5; |
| 44 |
42 protected: | 45 protected: |
43 // Returns true if this document is one that we should consider analyzing. | 46 // Returns true if this document is one that we should consider analyzing. |
44 // Virtual so that it can be overriden during testing. | 47 // Virtual so that it can be overriden during testing. |
45 virtual bool ShouldAnalyzeDocument(const blink::WebDocument& document) const; | 48 virtual bool ShouldAnalyzeDocument(const blink::WebDocument& document) const; |
46 | 49 |
47 // RenderViewObserver: | 50 // RenderViewObserver: |
48 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 51 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
49 | 52 |
50 // Use to force enable during testing. | 53 // Use to force enable during testing. |
51 void set_enabled(bool enabled) { enabled_ = enabled; } | 54 void set_enabled(bool enabled) { enabled_ = enabled; } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 109 |
107 // If this feature is enabled. Controlled by Finch. | 110 // If this feature is enabled. Controlled by Finch. |
108 bool enabled_; | 111 bool enabled_; |
109 | 112 |
110 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationAgent); | 113 DISALLOW_COPY_AND_ASSIGN(PasswordGenerationAgent); |
111 }; | 114 }; |
112 | 115 |
113 } // namespace autofill | 116 } // namespace autofill |
114 | 117 |
115 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_GENERATION_AGENT_H_ | 118 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_GENERATION_AGENT_H_ |
OLD | NEW |