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

Side by Side Diff: components/autofill/content/renderer/autofill_agent.cc

Issue 812033016: Add RenderFrameObserver::FocusedNodeChanged (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months 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 unified diff | Download patch
OLDNEW
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 #include "components/autofill/content/renderer/autofill_agent.h" 5 #include "components/autofill/content/renderer/autofill_agent.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 void AutofillAgent::DidChangeScrollOffset() { 204 void AutofillAgent::DidChangeScrollOffset() {
205 HidePopup(); 205 HidePopup();
206 } 206 }
207 207
208 void AutofillAgent::FocusedNodeChanged(const WebNode& node) { 208 void AutofillAgent::FocusedNodeChanged(const WebNode& node) {
209 HidePopup(); 209 HidePopup();
210 210
211 if (node.isNull() || !node.isElementNode()) 211 if (node.isNull() || !node.isElementNode())
212 return; 212 return;
213 213
214 if (node.document().frame() != render_frame()->GetWebFrame())
215 return;
216
217 if (password_generation_agent_ && 214 if (password_generation_agent_ &&
218 password_generation_agent_->FocusedNodeHasChanged(node)) { 215 password_generation_agent_->FocusedNodeHasChanged(node)) {
219 is_popup_possibly_visible_ = true; 216 is_popup_possibly_visible_ = true;
220 return; 217 return;
221 } 218 }
222 219
223 WebElement web_element = node.toConst<WebElement>(); 220 WebElement web_element = node.toConst<WebElement>();
224
225 if (!web_element.document().frame())
226 return;
227
228 const WebInputElement* element = toWebInputElement(&web_element); 221 const WebInputElement* element = toWebInputElement(&web_element);
229 222
230 if (!element || !element->isEnabled() || element->isReadOnly() || 223 if (!element || !element->isEnabled() || element->isReadOnly() ||
231 !element->isTextField() || element->isPasswordField()) 224 !element->isTextField() || element->isPasswordField())
232 return; 225 return;
233 226
234 element_ = *element; 227 element_ = *element;
235 } 228 }
236 229
237 void AutofillAgent::Resized() { 230 void AutofillAgent::Resized() {
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 : content::RenderViewObserver(render_view), agent_(agent) { 766 : content::RenderViewObserver(render_view), agent_(agent) {
774 } 767 }
775 768
776 AutofillAgent::LegacyAutofillAgent::~LegacyAutofillAgent() { 769 AutofillAgent::LegacyAutofillAgent::~LegacyAutofillAgent() {
777 } 770 }
778 771
779 void AutofillAgent::LegacyAutofillAgent::OnDestruct() { 772 void AutofillAgent::LegacyAutofillAgent::OnDestruct() {
780 // No-op. Don't delete |this|. 773 // No-op. Don't delete |this|.
781 } 774 }
782 775
783 void AutofillAgent::LegacyAutofillAgent::FocusedNodeChanged(
784 const WebNode& node) {
785 agent_->FocusedNodeChanged(node);
786 }
787
788 void AutofillAgent::LegacyAutofillAgent::Resized() { 776 void AutofillAgent::LegacyAutofillAgent::Resized() {
789 agent_->Resized(); 777 agent_->Resized();
790 } 778 }
791 779
792 } // namespace autofill 780 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698