Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / components / autofill / content / renderer / autofill_agent.cc
index 1b37ce2..85f4fad 100644 (file)
@@ -15,6 +15,7 @@
 #include "components/autofill/content/renderer/form_autofill_util.h"
 #include "components/autofill/content/renderer/page_click_tracker.h"
 #include "components/autofill/content/renderer/password_autofill_agent.h"
+#include "components/autofill/content/renderer/password_generation_agent.h"
 #include "components/autofill/core/common/autofill_constants.h"
 #include "components/autofill/core/common/autofill_data_validation.h"
 #include "components/autofill/core/common/autofill_switches.h"
 #include "third_party/WebKit/public/platform/WebURLRequest.h"
 #include "third_party/WebKit/public/web/WebDataSource.h"
 #include "third_party/WebKit/public/web/WebDocument.h"
+#include "third_party/WebKit/public/web/WebElementCollection.h"
 #include "third_party/WebKit/public/web/WebFormControlElement.h"
 #include "third_party/WebKit/public/web/WebFormElement.h"
 #include "third_party/WebKit/public/web/WebFrame.h"
 #include "third_party/WebKit/public/web/WebInputEvent.h"
 #include "third_party/WebKit/public/web/WebNode.h"
-#include "third_party/WebKit/public/web/WebNodeCollection.h"
 #include "third_party/WebKit/public/web/WebOptionElement.h"
 #include "third_party/WebKit/public/web/WebView.h"
 #include "ui/base/l10n/l10n_util.h"
@@ -51,7 +52,7 @@ using blink::WebFrame;
 using blink::WebInputElement;
 using blink::WebKeyboardEvent;
 using blink::WebNode;
-using blink::WebNodeCollection;
+using blink::WebElementCollection;
 using blink::WebOptionElement;
 using blink::WebString;
 
@@ -65,7 +66,7 @@ void GetDataListSuggestions(const blink::WebInputElement& element,
                             bool ignore_current_value,
                             std::vector<base::string16>* values,
                             std::vector<base::string16>* labels) {
-  WebNodeCollection options = element.dataListOptions();
+  WebElementCollection options = element.dataListOptions();
   if (options.isNull())
     return;
 
@@ -109,20 +110,14 @@ void TrimStringVectorForIPC(std::vector<base::string16>* strings) {
   }
 }
 
-gfx::RectF GetScaledBoundingBox(float scale, WebInputElement* element) {
-  gfx::Rect bounding_box(element->boundsInViewportSpace());
-  return gfx::RectF(bounding_box.x() * scale,
-                    bounding_box.y() * scale,
-                    bounding_box.width() * scale,
-                    bounding_box.height() * scale);
-}
-
 }  // namespace
 
 AutofillAgent::AutofillAgent(content::RenderView* render_view,
-                             PasswordAutofillAgent* password_autofill_agent)
+                             PasswordAutofillAgent* password_autofill_agent,
+                             PasswordGenerationAgent* password_generation_agent)
     : content::RenderViewObserver(render_view),
       password_autofill_agent_(password_autofill_agent),
+      password_generation_agent_(password_generation_agent),
       autofill_query_id_(0),
       autofill_action_(AUTOFILL_NONE),
       web_view_(render_view->GetWebView()),
@@ -334,6 +329,11 @@ void AutofillAgent::TextFieldDidChangeImpl(const WebInputElement& element) {
   if (!element.focused())
     return;
 
+  if (password_generation_agent_ &&
+      password_generation_agent_->TextDidChangeInTextField(element)) {
+    return;
+  }
+
   if (password_autofill_agent_->TextDidChangeInTextField(element)) {
     element_ = element;
     return;