This commit is contained in:
Cheng Zhao
2014-06-09 11:27:19 +08:00
parent 77e8d33545
commit e28407b980
4 changed files with 104 additions and 0 deletions

View File

@@ -223,6 +223,8 @@
'atom/renderer/atom_render_view_observer.h',
'atom/renderer/atom_renderer_client.cc',
'atom/renderer/atom_renderer_client.h',
'atom/renderer/autofill/autofill_agent.cc',
'atom/renderer/autofill/autofill_agent.h',
'atom/renderer/autofill/page_click_listener.h',
'atom/renderer/autofill/page_click_tracker.cc',
'atom/renderer/autofill/page_click_tracker.h',

View File

@@ -80,6 +80,15 @@
<h2>Welcome to Atom Shell</h2>
<input type="text" list="modules" />
<datalist id="modules">
<select>
<option value="IN4NWK"></option>
<option value="IN4CDT"></option>
<option value="IN4INS"></option>
</select>
</datalist>
<p>
To run your app with atom-shell, execute the following command under your
Console (or Terminal):

View File

@@ -0,0 +1,24 @@
// Copyright (c) 2014 GitHub, Inc. All rights reserved.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "atom/renderer/autofill/autofill_agent.h"
#include "atom/renderer/autofill/page_click_tracker.h"
#include "content/public/renderer/render_view.h"
#include "third_party/WebKit/public/web/WebView.h"
namespace autofill {
AutofillAgent::AutofillAgent(content::RenderView* render_view)
: content::RenderViewObserver(render_view) {
render_view->GetWebView()->setAutofillClient(this);
// The PageClickTracker is a RenderViewObserver, and hence will be freed when
// the RenderView is destroyed.
new PageClickTracker(render_view, this);
}
AutofillAgent::~AutofillAgent() {}
} // namespace autofill

View File

@@ -0,0 +1,69 @@
// Copyright (c) 2014 GitHub, Inc. All rights reserved.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ATOM_RENDERER_AUTOFILL_AUTOFILL_AGENT_H_
#define ATOM_RENDERER_AUTOFILL_AUTOFILL_AGENT_H_
#include "atom/renderer/autofill/page_click_listener.h"
#include "content/public/renderer/render_view_observer.h"
#include "third_party/WebKit/public/web/WebAutofillClient.h"
namespace autofill {
// AutofillAgent deals with Autofill related communications between WebKit and
// the browser. There is one AutofillAgent per RenderView.
class AutofillAgent : public content::RenderViewObserver,
public PageClickListener,
public WebKit::WebAutofillClient {
public:
AutofillAgent(content::RenderView* render_view);
virtual ~AutofillAgent();
private:
enum AutofillAction {
AUTOFILL_NONE, // No state set.
AUTOFILL_FILL, // Fill the Autofill form data.
AUTOFILL_PREVIEW, // Preview the Autofill form data.
};
// RenderView::Observer:
virtual void DidFinishDocumentLoad(WebKit::WebFrame* frame) OVERRIDE;
virtual void DidCommitProvisionalLoad(WebKit::WebFrame* frame,
bool is_new_navigation) OVERRIDE;
virtual void FrameDetached(WebKit::WebFrame* frame) OVERRIDE;
virtual void WillSubmitForm(WebKit::WebFrame* frame,
const WebKit::WebFormElement& form) OVERRIDE;
virtual void ZoomLevelChanged() OVERRIDE;
virtual void DidChangeScrollOffset(WebKit::WebFrame* frame) OVERRIDE;
virtual void FocusedNodeChanged(const WebKit::WebNode& node) OVERRIDE;
virtual void OrientationChangeEvent(int orientation) OVERRIDE;
// PageClickListener:
virtual void InputElementClicked(const WebKit::WebInputElement& element,
bool was_focused,
bool is_focused) OVERRIDE;
virtual void InputElementLostFocus() OVERRIDE;
// WebKit::WebAutofillClient:
virtual void didClearAutofillSelection(const WebKit::WebNode& node) OVERRIDE;
virtual void textFieldDidEndEditing(
const WebKit::WebInputElement& element) OVERRIDE;
virtual void textFieldDidChange(
const WebKit::WebInputElement& element) OVERRIDE;
virtual void textFieldDidReceiveKeyDown(
const WebKit::WebInputElement& element,
const WebKit::WebKeyboardEvent& event) OVERRIDE;
virtual void didRequestAutocomplete(
WebKit::WebFrame* frame,
const WebKit::WebFormElement& form) OVERRIDE;
virtual void setIgnoreTextChanges(bool ignore) OVERRIDE;
virtual void didAssociateFormControls(
const WebKit::WebVector<WebKit::WebNode>& nodes) OVERRIDE;
DISALLOW_COPY_AND_ASSIGN(AutofillAgent);
};
} // namespace autofill
#endif // ATOM_RENDERER_AUTOFILL_AUTOFILL_AGENT_H_