Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / components / autofill / content / renderer / password_generation_agent.h
index 2d75af0..97c5527 100644 (file)
@@ -15,7 +15,6 @@
 #include "url/gurl.h"
 
 namespace blink {
-class WebCString;
 class WebDocument;
 }
 
@@ -30,7 +29,7 @@ struct PasswordForm;
 class PasswordGenerationAgent : public content::RenderViewObserver {
  public:
   explicit PasswordGenerationAgent(content::RenderView* render_view);
-  virtual ~PasswordGenerationAgent();
+  ~PasswordGenerationAgent() override;
 
   // Returns true if the field being changed is one where a generated password
   // is being offered. Updates the state of the popup if necessary.
@@ -39,6 +38,9 @@ class PasswordGenerationAgent : public content::RenderViewObserver {
   // Returns true if the newly focused node caused the generation UI to show.
   bool FocusedNodeHasChanged(const blink::WebNode& node);
 
+  // Called when new form controls are inserted.
+  void OnDynamicFormsSeen(blink::WebLocalFrame* frame);
+
   // The length that a password can be before the UI is hidden.
   static const size_t kMaximumOfferSize = 5;
 
@@ -48,15 +50,15 @@ class PasswordGenerationAgent : public content::RenderViewObserver {
   virtual bool ShouldAnalyzeDocument(const blink::WebDocument& document) const;
 
   // RenderViewObserver:
-  virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
+  bool OnMessageReceived(const IPC::Message& message) override;
 
   // Use to force enable during testing.
   void set_enabled(bool enabled) { enabled_ = enabled; }
 
  private:
   // RenderViewObserver:
-  virtual void DidFinishDocumentLoad(blink::WebLocalFrame* frame) OVERRIDE;
-  virtual void DidFinishLoad(blink::WebLocalFrame* frame) OVERRIDE;
+  void DidFinishDocumentLoad(blink::WebLocalFrame* frame) override;
+  void DidFinishLoad(blink::WebLocalFrame* frame) override;
 
   // Message handlers.
   void OnFormNotBlacklisted(const PasswordForm& form);
@@ -64,6 +66,10 @@ class PasswordGenerationAgent : public content::RenderViewObserver {
   void OnAccountCreationFormsDetected(
       const std::vector<autofill::FormData>& forms);
 
+  // Helper function that will try and populate |password_elements_| and
+  // |possible_account_creation_form_|.
+  void FindPossibleGenerationForm(blink::WebLocalFrame* frame);
+
   // Helper function to decide if |passwords_| contains password fields for
   // an account creation form. Sets |generation_element_| to the field that
   // we want to trigger the generation UI on.
@@ -107,6 +113,16 @@ class PasswordGenerationAgent : public content::RenderViewObserver {
   // stats.
   bool password_edited_;
 
+  // True if the generation popup was shown during this navigation. Used to
+  // track UMA stats per page visit rather than per display, since the former
+  // is more interesting.
+  bool generation_popup_shown_;
+
+  // True if the editing popup was shown during this navigation. Used to track
+  // UMA stats per page rather than per display, since the former is more
+  // interesting.
+  bool editing_popup_shown_;
+
   // If this feature is enabled. Controlled by Finch.
   bool enabled_;