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

Unified Diff: components/autofill/content/renderer/password_autofill_agent.cc

Issue 63273002: Rename WebKit namespace to blink (part 4) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: components/autofill/content/renderer/password_autofill_agent.cc
diff --git a/components/autofill/content/renderer/password_autofill_agent.cc b/components/autofill/content/renderer/password_autofill_agent.cc
index 754ff32c3236b398b49df8416cc1d62521503029..5465de3c33c51285b03bcb57acd30988ad88d5ea 100644
--- a/components/autofill/content/renderer/password_autofill_agent.cc
+++ b/components/autofill/content/renderer/password_autofill_agent.cc
@@ -37,7 +37,7 @@ namespace {
static const size_t kMaximumTextSizeForAutocomplete = 1000;
// Maps element names to the actual elements to simplify form filling.
-typedef std::map<base::string16, WebKit::WebInputElement>
+typedef std::map<base::string16, blink::WebInputElement>
FormInputElementMap;
// Utility struct for form lookup and autofill. When we parse the DOM to look up
@@ -46,7 +46,7 @@ typedef std::map<base::string16, WebKit::WebInputElement>
// to fill the form, the FindFormElements function stores the pointers
// in a FormElements* result, referenced to ensure they are safe to use.
struct FormElements {
- WebKit::WebFormElement form_element;
+ blink::WebFormElement form_element;
FormInputElementMap input_elements;
};
@@ -54,14 +54,14 @@ typedef std::vector<FormElements*> FormElementsList;
// Helper to search the given form element for the specified input elements
// in |data|, and add results to |result|.
-static bool FindFormInputElements(WebKit::WebFormElement* fe,
+static bool FindFormInputElements(blink::WebFormElement* fe,
const FormData& data,
FormElements* result) {
// Loop through the list of elements we need to find on the form in order to
// autofill it. If we don't find any one of them, abort processing this
// form; it can't be the right one.
for (size_t j = 0; j < data.fields.size(); j++) {
- WebKit::WebVector<WebKit::WebNode> temp_elements;
+ blink::WebVector<blink::WebNode> temp_elements;
fe->getNamedElements(data.fields[j].name, temp_elements);
// Match the first input element, if any.
@@ -71,7 +71,7 @@ static bool FindFormInputElements(WebKit::WebFormElement* fe,
// of "name" attribute) so is it considered not found.
bool found_input = false;
for (size_t i = 0; i < temp_elements.size(); ++i) {
- if (temp_elements[i].to<WebKit::WebElement>().hasTagName("input")) {
+ if (temp_elements[i].to<blink::WebElement>().hasTagName("input")) {
// Check for a non-unique match.
if (found_input) {
found_input = false;
@@ -80,8 +80,8 @@ static bool FindFormInputElements(WebKit::WebFormElement* fe,
// Only fill saved passwords into password fields and usernames into
// text fields.
- WebKit::WebInputElement input_element =
- temp_elements[i].to<WebKit::WebInputElement>();
+ blink::WebInputElement input_element =
+ temp_elements[i].to<blink::WebInputElement>();
if (input_element.isPasswordField() !=
(data.fields[j].form_control_type == "password"))
continue;
@@ -109,12 +109,12 @@ static bool FindFormInputElements(WebKit::WebFormElement* fe,
}
// Helper to locate form elements identified by |data|.
-void FindFormElements(WebKit::WebView* view,
+void FindFormElements(blink::WebView* view,
const FormData& data,
FormElementsList* results) {
DCHECK(view);
DCHECK(results);
- WebKit::WebFrame* main_frame = view->mainFrame();
+ blink::WebFrame* main_frame = view->mainFrame();
if (!main_frame)
return;
@@ -123,8 +123,8 @@ void FindFormElements(WebKit::WebView* view,
rep.ClearRef();
// Loop through each frame.
- for (WebKit::WebFrame* f = main_frame; f; f = f->traverseNext(false)) {
- WebKit::WebDocument doc = f->document();
+ for (blink::WebFrame* f = main_frame; f; f = f->traverseNext(false)) {
+ blink::WebDocument doc = f->document();
if (!doc.isHTMLDocument())
continue;
@@ -132,11 +132,11 @@ void FindFormElements(WebKit::WebView* view,
if (data.origin != full_origin.ReplaceComponents(rep))
continue;
- WebKit::WebVector<WebKit::WebFormElement> forms;
+ blink::WebVector<blink::WebFormElement> forms;
doc.forms(forms);
for (size_t i = 0; i < forms.size(); ++i) {
- WebKit::WebFormElement fe = forms[i];
+ blink::WebFormElement fe = forms[i];
GURL full_action(f->document().completeURL(fe.action()));
if (full_action.is_empty()) {
@@ -160,11 +160,11 @@ void FindFormElements(WebKit::WebView* view,
}
}
-bool IsElementEditable(const WebKit::WebInputElement& element) {
+bool IsElementEditable(const blink::WebInputElement& element) {
return element.isEnabled() && !element.isReadOnly();
}
-void SetElementAutofilled(WebKit::WebInputElement* element, bool autofilled) {
+void SetElementAutofilled(blink::WebInputElement* element, bool autofilled) {
if (element->isAutofilled() == autofilled)
return;
element->setAutofilled(autofilled);
@@ -196,7 +196,7 @@ PasswordAutofillAgent::~PasswordAutofillAgent() {
}
bool PasswordAutofillAgent::TextFieldDidEndEditing(
- const WebKit::WebInputElement& element) {
+ const blink::WebInputElement& element) {
LoginToPasswordInfoMap::const_iterator iter =
login_to_password_info_.find(element);
if (iter == login_to_password_info_.end())
@@ -209,11 +209,11 @@ bool PasswordAutofillAgent::TextFieldDidEndEditing(
if (!fill_data.wait_for_username)
return false;
- WebKit::WebInputElement password = iter->second.password_field;
+ blink::WebInputElement password = iter->second.password_field;
if (!IsElementEditable(password))
return false;
- WebKit::WebInputElement username = element; // We need a non-const.
+ blink::WebInputElement username = element; // We need a non-const.
// Do not set selection when ending an editing session, otherwise it can
// mess with focus.
@@ -224,7 +224,7 @@ bool PasswordAutofillAgent::TextFieldDidEndEditing(
}
bool PasswordAutofillAgent::TextDidChangeInTextField(
- const WebKit::WebInputElement& element) {
+ const blink::WebInputElement& element) {
LoginToPasswordInfoMap::const_iterator iter =
login_to_password_info_.find(element);
if (iter == login_to_password_info_.end())
@@ -232,8 +232,8 @@ bool PasswordAutofillAgent::TextDidChangeInTextField(
// The input text is being changed, so any autofilled password is now
// outdated.
- WebKit::WebInputElement username = element; // We need a non-const.
- WebKit::WebInputElement password = iter->second.password_field;
+ blink::WebInputElement username = element; // We need a non-const.
+ blink::WebInputElement password = iter->second.password_field;
SetElementAutofilled(&username, false);
if (password.isAutofilled()) {
password.setValue(base::string16());
@@ -258,7 +258,7 @@ bool PasswordAutofillAgent::TextDidChangeInTextField(
return true;
}
- WebKit::WebString name = element.nameForAutofill();
+ blink::WebString name = element.nameForAutofill();
if (name.isEmpty())
return false; // If the field has no name, then we won't have values.
@@ -272,8 +272,8 @@ bool PasswordAutofillAgent::TextDidChangeInTextField(
}
bool PasswordAutofillAgent::TextFieldHandlingKeyDown(
- const WebKit::WebInputElement& element,
- const WebKit::WebKeyboardEvent& event) {
+ const blink::WebInputElement& element,
+ const blink::WebKeyboardEvent& event) {
// If using the new Autofill UI that lives in the browser, it will handle
// keypresses before this function. This is not currently an issue but if
// the keys handled there or here change, this issue may appear.
@@ -289,9 +289,9 @@ bool PasswordAutofillAgent::TextFieldHandlingKeyDown(
}
bool PasswordAutofillAgent::DidAcceptAutofillSuggestion(
- const WebKit::WebNode& node,
- const WebKit::WebString& value) {
- WebKit::WebInputElement input;
+ const blink::WebNode& node,
+ const blink::WebString& value) {
+ blink::WebInputElement input;
PasswordInfo password;
if (!FindLoginInfo(node, &input, &password))
return false;
@@ -306,14 +306,14 @@ bool PasswordAutofillAgent::DidAcceptAutofillSuggestion(
}
bool PasswordAutofillAgent::DidClearAutofillSelection(
- const WebKit::WebNode& node) {
- WebKit::WebInputElement input;
+ const blink::WebNode& node) {
+ blink::WebInputElement input;
PasswordInfo password;
return FindLoginInfo(node, &input, &password);
}
bool PasswordAutofillAgent::ShowSuggestions(
- const WebKit::WebInputElement& element) {
+ const blink::WebInputElement& element) {
LoginToPasswordInfoMap::const_iterator iter =
login_to_password_info_.find(element);
if (iter == login_to_password_info_.end())
@@ -323,18 +323,18 @@ bool PasswordAutofillAgent::ShowSuggestions(
}
bool PasswordAutofillAgent::OriginCanAccessPasswordManager(
- const WebKit::WebSecurityOrigin& origin) {
+ const blink::WebSecurityOrigin& origin) {
return origin.canAccessPasswordManager();
}
-void PasswordAutofillAgent::OnDynamicFormsSeen(WebKit::WebFrame* frame) {
+void PasswordAutofillAgent::OnDynamicFormsSeen(blink::WebFrame* frame) {
SendPasswordForms(frame, false /* only_visible */);
}
-void PasswordAutofillAgent::SendPasswordForms(WebKit::WebFrame* frame,
+void PasswordAutofillAgent::SendPasswordForms(blink::WebFrame* frame,
bool only_visible) {
// Make sure that this security origin is allowed to use password manager.
- WebKit::WebSecurityOrigin origin = frame->document().securityOrigin();
+ blink::WebSecurityOrigin origin = frame->document().securityOrigin();
if (!OriginCanAccessPasswordManager(origin))
return;
@@ -342,12 +342,12 @@ void PasswordAutofillAgent::SendPasswordForms(WebKit::WebFrame* frame,
if (IsWebpageEmpty(frame))
return;
- WebKit::WebVector<WebKit::WebFormElement> forms;
+ blink::WebVector<blink::WebFormElement> forms;
frame->document().forms(forms);
std::vector<PasswordForm> password_forms;
for (size_t i = 0; i < forms.size(); ++i) {
- const WebKit::WebFormElement& form = forms[i];
+ const blink::WebFormElement& form = forms[i];
// If requested, ignore non-rendered forms, e.g. those styled with
// display:none.
@@ -391,14 +391,14 @@ void PasswordAutofillAgent::DidStartLoading() {
}
}
-void PasswordAutofillAgent::DidFinishDocumentLoad(WebKit::WebFrame* frame) {
+void PasswordAutofillAgent::DidFinishDocumentLoad(blink::WebFrame* frame) {
// The |frame| contents have been parsed, but not yet rendered. Let the
// PasswordManager know that forms are loaded, even though we can't yet tell
// whether they're visible.
SendPasswordForms(frame, false);
}
-void PasswordAutofillAgent::DidFinishLoad(WebKit::WebFrame* frame) {
+void PasswordAutofillAgent::DidFinishLoad(blink::WebFrame* frame) {
// The |frame| contents have been rendered. Let the PasswordManager know
// which of the loaded frames are actually visible to the user. This also
// triggers the "Save password?" infobar if the user just submitted a password
@@ -406,17 +406,17 @@ void PasswordAutofillAgent::DidFinishLoad(WebKit::WebFrame* frame) {
SendPasswordForms(frame, true);
}
-void PasswordAutofillAgent::FrameDetached(WebKit::WebFrame* frame) {
+void PasswordAutofillAgent::FrameDetached(blink::WebFrame* frame) {
FrameClosing(frame);
}
-void PasswordAutofillAgent::FrameWillClose(WebKit::WebFrame* frame) {
+void PasswordAutofillAgent::FrameWillClose(blink::WebFrame* frame) {
FrameClosing(frame);
}
void PasswordAutofillAgent::WillSendSubmitEvent(
- WebKit::WebFrame* frame,
- const WebKit::WebFormElement& form) {
+ blink::WebFrame* frame,
+ const blink::WebFormElement& form) {
// Some login forms have onSubmit handlers that put a hash of the password
// into a hidden field and then clear the password (http://crbug.com/28910).
// This method gets called before any of those handlers run, so save away
@@ -424,8 +424,8 @@ void PasswordAutofillAgent::WillSendSubmitEvent(
provisionally_saved_forms_[frame].reset(CreatePasswordForm(form).release());
}
-void PasswordAutofillAgent::WillSubmitForm(WebKit::WebFrame* frame,
- const WebKit::WebFormElement& form) {
+void PasswordAutofillAgent::WillSubmitForm(blink::WebFrame* frame,
+ const blink::WebFormElement& form) {
scoped_ptr<PasswordForm> submitted_form = CreatePasswordForm(form);
// If there is a provisionally saved password, copy over the previous
@@ -451,7 +451,7 @@ void PasswordAutofillAgent::WillSubmitForm(WebKit::WebFrame* frame,
}
}
-void PasswordAutofillAgent::DidStartProvisionalLoad(WebKit::WebFrame* frame) {
+void PasswordAutofillAgent::DidStartProvisionalLoad(blink::WebFrame* frame) {
if (!frame->parent()) {
// If the navigation is not triggered by a user gesture, e.g. by some ajax
// callback, then inherit the submitted password form from the previous
@@ -459,7 +459,7 @@ void PasswordAutofillAgent::DidStartProvisionalLoad(WebKit::WebFrame* frame) {
// [http://crbug/43219]. Note that there are still some sites that this
// fails for because they use some element other than a submit button to
// trigger submission (which means WillSendSubmitEvent will not be called).
- if (!WebKit::WebUserGestureIndicator::isProcessingUserGesture() &&
+ if (!blink::WebUserGestureIndicator::isProcessingUserGesture() &&
provisionally_saved_forms_[frame].get()) {
Send(new AutofillHostMsg_PasswordFormSubmitted(
routing_id(),
@@ -489,12 +489,12 @@ void PasswordAutofillAgent::OnFillPasswordForm(
// Attach autocomplete listener to enable selecting alternate logins.
// First, get pointers to username element.
- WebKit::WebInputElement username_element =
+ blink::WebInputElement username_element =
form_elements->input_elements[form_data.basic_data.fields[0].name];
// Get pointer to password element. (We currently only support single
// password forms).
- WebKit::WebInputElement password_element =
+ blink::WebInputElement password_element =
form_elements->input_elements[form_data.basic_data.fields[1].name];
// If wait_for_username is true, we don't want to initially fill the form
@@ -561,12 +561,12 @@ void PasswordAutofillAgent::GetSuggestions(
bool PasswordAutofillAgent::ShowSuggestionPopup(
const PasswordFormFillData& fill_data,
- const WebKit::WebInputElement& user_input) {
- WebKit::WebFrame* frame = user_input.document().frame();
+ const blink::WebInputElement& user_input) {
+ blink::WebFrame* frame = user_input.document().frame();
if (!frame)
return false;
- WebKit::WebView* webview = frame->view();
+ blink::WebView* webview = frame->view();
if (!webview)
return false;
@@ -580,7 +580,7 @@ bool PasswordAutofillAgent::ShowSuggestionPopup(
FindFormAndFieldForInputElement(
user_input, &form, &field, REQUIRE_NONE);
- WebKit::WebInputElement selected_element = user_input;
+ blink::WebInputElement selected_element = user_input;
gfx::Rect bounding_box(selected_element.boundsInViewportSpace());
float scale = web_view_->pageScaleFactor();
@@ -598,8 +598,8 @@ bool PasswordAutofillAgent::ShowSuggestionPopup(
void PasswordAutofillAgent::FillFormOnPasswordRecieved(
const PasswordFormFillData& fill_data,
- WebKit::WebInputElement username_element,
- WebKit::WebInputElement password_element) {
+ blink::WebInputElement username_element,
+ blink::WebInputElement password_element) {
if (!username_element.form().autoComplete())
return;
@@ -624,8 +624,8 @@ void PasswordAutofillAgent::FillFormOnPasswordRecieved(
}
bool PasswordAutofillAgent::FillUserNameAndPassword(
- WebKit::WebInputElement* username_element,
- WebKit::WebInputElement* password_element,
+ blink::WebInputElement* username_element,
+ blink::WebInputElement* password_element,
const PasswordFormFillData& fill_data,
bool exact_username_match,
bool set_selection) {
@@ -705,14 +705,14 @@ bool PasswordAutofillAgent::FillUserNameAndPassword(
}
void PasswordAutofillAgent::PerformInlineAutocomplete(
- const WebKit::WebInputElement& username_input,
- const WebKit::WebInputElement& password_input,
+ const blink::WebInputElement& username_input,
+ const blink::WebInputElement& password_input,
const PasswordFormFillData& fill_data) {
DCHECK(!fill_data.wait_for_username);
// We need non-const versions of the username and password inputs.
- WebKit::WebInputElement username = username_input;
- WebKit::WebInputElement password = password_input;
+ blink::WebInputElement username = username_input;
+ blink::WebInputElement password = password_input;
// Don't inline autocomplete if the caret is not at the end.
// TODO(jcivelli): is there a better way to test the caret location?
@@ -734,7 +734,7 @@ void PasswordAutofillAgent::PerformInlineAutocomplete(
#endif
}
-void PasswordAutofillAgent::FrameClosing(const WebKit::WebFrame* frame) {
+void PasswordAutofillAgent::FrameClosing(const blink::WebFrame* frame) {
for (LoginToPasswordInfoMap::iterator iter = login_to_password_info_.begin();
iter != login_to_password_info_.end();) {
if (iter->first.document().frame() == frame)
@@ -744,17 +744,17 @@ void PasswordAutofillAgent::FrameClosing(const WebKit::WebFrame* frame) {
}
}
-bool PasswordAutofillAgent::FindLoginInfo(const WebKit::WebNode& node,
- WebKit::WebInputElement* found_input,
+bool PasswordAutofillAgent::FindLoginInfo(const blink::WebNode& node,
+ blink::WebInputElement* found_input,
PasswordInfo* found_password) {
if (!node.isElementNode())
return false;
- WebKit::WebElement element = node.toConst<WebKit::WebElement>();
+ blink::WebElement element = node.toConst<blink::WebElement>();
if (!element.hasTagName("input"))
return false;
- WebKit::WebInputElement input = element.to<WebKit::WebInputElement>();
+ blink::WebInputElement input = element.to<blink::WebInputElement>();
LoginToPasswordInfoMap::iterator iter = login_to_password_info_.find(input);
if (iter == login_to_password_info_.end())
return false;

Powered by Google App Engine
This is Rietveld 408576698