🎨 lint fix
This commit is contained in:
parent
f360104bee
commit
4949531f57
8 changed files with 88 additions and 76 deletions
|
@ -4,6 +4,8 @@
|
|||
|
||||
#include "atom/renderer/atom_autofill_agent.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "atom/common/api/api_messages.h"
|
||||
#include "content/public/renderer/render_frame.h"
|
||||
#include "content/public/renderer/render_view.h"
|
||||
|
@ -17,11 +19,11 @@
|
|||
#include "ui/gfx/geometry/rect_f.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
|
||||
namespace {
|
||||
const size_t kMaxDataLength = 1024;
|
||||
const size_t kMaxListSize = 512;
|
||||
|
||||
|
||||
void GetDataListSuggestions(const blink::WebInputElement& element,
|
||||
std::vector<base::string16>* values,
|
||||
std::vector<base::string16>* labels) {
|
||||
|
@ -45,7 +47,7 @@ void TrimStringVectorForIPC(std::vector<base::string16>* strings) {
|
|||
(*strings)[i].resize(kMaxDataLength);
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
AutofillAgent::AutofillAgent(
|
||||
content::RenderFrame* frame)
|
||||
|
@ -73,10 +75,10 @@ void AutofillAgent::textFieldDidEndEditing(
|
|||
}
|
||||
|
||||
void AutofillAgent::textFieldDidChange(
|
||||
const blink::WebFormControlElement& element) {
|
||||
const blink::WebFormControlElement& element) {
|
||||
if (!IsUserGesture() && !render_frame()->IsPasting())
|
||||
return;
|
||||
|
||||
|
||||
weak_ptr_factory_.InvalidateWeakPtrs();
|
||||
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
||||
FROM_HERE, base::Bind(&AutofillAgent::textFieldDidChangeImpl,
|
||||
|
@ -84,14 +86,14 @@ void AutofillAgent::textFieldDidChange(
|
|||
}
|
||||
|
||||
void AutofillAgent::textFieldDidChangeImpl(
|
||||
const blink::WebFormControlElement& element) {
|
||||
const blink::WebFormControlElement& element) {
|
||||
ShowSuggestionsOptions options;
|
||||
options.requires_caret_at_end = true;
|
||||
ShowSuggestions(element, options);
|
||||
}
|
||||
|
||||
void AutofillAgent::textFieldDidReceiveKeyDown(
|
||||
const blink::WebInputElement& element,
|
||||
const blink::WebInputElement& element,
|
||||
const blink::WebKeyboardEvent& event) {
|
||||
if (event.windowsKeyCode == ui::VKEY_DOWN ||
|
||||
event.windowsKeyCode == ui::VKEY_UP) {
|
||||
|
@ -113,7 +115,7 @@ void AutofillAgent::dataListOptionsChanged(
|
|||
const blink::WebInputElement& element) {
|
||||
if (!element.focused())
|
||||
return;
|
||||
|
||||
|
||||
ShowSuggestionsOptions options;
|
||||
options.requires_caret_at_end = true;
|
||||
ShowSuggestions(element, options);
|
||||
|
@ -136,7 +138,7 @@ void AutofillAgent::ShowSuggestions(
|
|||
if (!input_element->isTextField())
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
blink::WebString value = element.editingValue();
|
||||
if (value.length() > kMaxDataLength ||
|
||||
(!options.autofill_on_empty_values && value.isEmpty()) ||
|
||||
|
@ -146,7 +148,7 @@ void AutofillAgent::ShowSuggestions(
|
|||
HidePopup();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
std::vector<base::string16> data_list_values;
|
||||
std::vector<base::string16> data_list_labels;
|
||||
if (input_element) {
|
||||
|
@ -155,7 +157,7 @@ void AutofillAgent::ShowSuggestions(
|
|||
TrimStringVectorForIPC(&data_list_values);
|
||||
TrimStringVectorForIPC(&data_list_labels);
|
||||
}
|
||||
|
||||
|
||||
ShowPopup(element, data_list_values, data_list_labels);
|
||||
}
|
||||
|
||||
|
@ -196,10 +198,10 @@ void AutofillAgent::ShowPopup(
|
|||
const blink::WebFormControlElement& element,
|
||||
const std::vector<base::string16>& values,
|
||||
const std::vector<base::string16>& labels) {
|
||||
gfx::RectF bounds =
|
||||
gfx::RectF bounds =
|
||||
render_frame_->GetRenderView()->ElementBoundsInWindow(element);
|
||||
Send(new AtomAutofillViewMsg_ShowPopup(
|
||||
web_contents_routing_id_, routing_id(), bounds, values, labels));
|
||||
}
|
||||
|
||||
} // namespace atom
|
||||
} // namespace atom
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
#ifndef ATOM_RENDERER_ATOM_AUTOFILL_AGENT_H_
|
||||
#define ATOM_RENDERER_ATOM_AUTOFILL_AGENT_H_
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "content/public/renderer/render_frame_observer.h"
|
||||
#include "third_party/WebKit/public/web/WebAutofillClient.h"
|
||||
|
@ -14,14 +16,14 @@
|
|||
|
||||
namespace atom {
|
||||
|
||||
class AutofillAgent : public content::RenderFrameObserver,
|
||||
class AutofillAgent : public content::RenderFrameObserver,
|
||||
public blink::WebAutofillClient {
|
||||
public:
|
||||
AutofillAgent(content::RenderFrame* frame);
|
||||
explicit AutofillAgent(content::RenderFrame* frame);
|
||||
|
||||
// content::RenderFrameObserver:
|
||||
void OnDestruct() override;
|
||||
|
||||
|
||||
void DidChangeScrollOffset() override;
|
||||
void FocusedNodeChanged(const blink::WebNode&) override;
|
||||
|
||||
|
@ -31,9 +33,9 @@ class AutofillAgent : public content::RenderFrameObserver,
|
|||
bool autofill_on_empty_values;
|
||||
bool requires_caret_at_end;
|
||||
};
|
||||
|
||||
|
||||
bool OnMessageReceived(const IPC::Message& message) override;
|
||||
void OnWebContentsRoutingIdReceived(int);
|
||||
void OnWebContentsRoutingIdReceived(int routing_id);
|
||||
|
||||
// blink::WebAutofillClient:
|
||||
void textFieldDidEndEditing(const blink::WebInputElement&) override;
|
||||
|
@ -43,7 +45,7 @@ class AutofillAgent : public content::RenderFrameObserver,
|
|||
const blink::WebKeyboardEvent&) override;
|
||||
void openTextDataListChooser(const blink::WebInputElement&) override;
|
||||
void dataListOptionsChanged(const blink::WebInputElement&) override;
|
||||
|
||||
|
||||
bool IsUserGesture() const;
|
||||
void HidePopup();
|
||||
void ShowPopup(const blink::WebFormControlElement&,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue