refactor: mojofy autofill (#18723)

This commit is contained in:
Jeremy Apthorp 2019-06-12 15:08:22 -07:00 committed by GitHub
parent ec10fd3044
commit ba96cdb7dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 76 additions and 160 deletions

View file

@ -37,14 +37,6 @@
#include "ui/base/resource/resource_bundle.h" #include "ui/base/resource/resource_bundle.h"
#include "ui/base/ui_base_switches.h" #include "ui/base/ui_base_switches.h"
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#define IPC_MESSAGE_MACROS_LOG_ENABLED
#include "content/public/common/content_ipc_logging.h"
#define IPC_LOG_TABLE_ADD_ENTRY(msg_id, logger) \
content::RegisterIPCLogger(msg_id, logger)
#include "atom/common/common_message_generator.h"
#endif
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
#include "atom/app/atom_main_delegate_mac.h" #include "atom/app/atom_main_delegate_mac.h"
#endif #endif

View file

@ -10,7 +10,6 @@
#include "atom/browser/unresponsive_suppressor.h" #include "atom/browser/unresponsive_suppressor.h"
#include "atom/browser/web_contents_preferences.h" #include "atom/browser/web_contents_preferences.h"
#include "atom/browser/window_list.h" #include "atom/browser/window_list.h"
#include "atom/common/api/api_messages.h"
#include "atom/common/api/constructor.h" #include "atom/common/api/constructor.h"
#include "atom/common/color_util.h" #include "atom/common/color_util.h"
#include "atom/common/native_mate_converters/callback.h" #include "atom/common/native_mate_converters/callback.h"

View file

@ -29,7 +29,6 @@
#include "atom/browser/web_contents_preferences.h" #include "atom/browser/web_contents_preferences.h"
#include "atom/browser/web_contents_zoom_controller.h" #include "atom/browser/web_contents_zoom_controller.h"
#include "atom/browser/web_view_guest_delegate.h" #include "atom/browser/web_view_guest_delegate.h"
#include "atom/common/api/api_messages.h"
#include "atom/common/api/atom_api_native_image.h" #include "atom/common/api/atom_api_native_image.h"
#include "atom/common/api/event_emitter_caller.h" #include "atom/common/api/event_emitter_caller.h"
#include "atom/common/color_util.h" #include "atom/common/color_util.h"
@ -570,9 +569,7 @@ void WebContents::SetContentsBounds(content::WebContents* source,
void WebContents::CloseContents(content::WebContents* source) { void WebContents::CloseContents(content::WebContents* source) {
Emit("close"); Emit("close");
#if defined(TOOLKIT_VIEWS)
HideAutofillPopup(); HideAutofillPopup();
#endif
if (managed_web_contents()) if (managed_web_contents())
managed_web_contents()->GetView()->SetDelegate(nullptr); managed_web_contents()->GetView()->SetDelegate(nullptr);
for (ExtendedWebContentsObserver& observer : observers_) for (ExtendedWebContentsObserver& observer : observers_)
@ -1095,7 +1092,6 @@ void WebContents::DevToolsClosed() {
Emit("devtools-closed"); Emit("devtools-closed");
} }
#if defined(TOOLKIT_VIEWS)
void WebContents::ShowAutofillPopup(content::RenderFrameHost* frame_host, void WebContents::ShowAutofillPopup(content::RenderFrameHost* frame_host,
const gfx::RectF& bounds, const gfx::RectF& bounds,
const std::vector<base::string16>& values, const std::vector<base::string16>& values,
@ -1115,7 +1111,6 @@ void WebContents::ShowAutofillPopup(content::RenderFrameHost* frame_host,
CommonWebContentsDelegate::ShowAutofillPopup( CommonWebContentsDelegate::ShowAutofillPopup(
frame_host, embedder_frame_host, offscreen, popup_bounds, values, labels); frame_host, embedder_frame_host, offscreen, popup_bounds, values, labels);
} }
#endif
bool WebContents::OnMessageReceived(const IPC::Message& message) { bool WebContents::OnMessageReceived(const IPC::Message& message) {
bool handled = true; bool handled = true;
@ -1128,20 +1123,6 @@ bool WebContents::OnMessageReceived(const IPC::Message& message) {
return handled; return handled;
} }
bool WebContents::OnMessageReceived(const IPC::Message& message,
content::RenderFrameHost* frame_host) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(WebContents, message, frame_host)
#if defined(TOOLKIT_VIEWS)
IPC_MESSAGE_HANDLER(AtomAutofillFrameHostMsg_ShowPopup, ShowAutofillPopup)
IPC_MESSAGE_HANDLER(AtomAutofillFrameHostMsg_HidePopup, HideAutofillPopup)
#endif
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
}
// There are three ways of destroying a webContents: // There are three ways of destroying a webContents:
// 1. call webContents.destroy(); // 1. call webContents.destroy();
// 2. garbage collection; // 2. garbage collection;
@ -2031,6 +2012,17 @@ void WebContents::DoGetZoomLevel(DoGetZoomLevelCallback callback) {
std::move(callback).Run(GetZoomLevel()); std::move(callback).Run(GetZoomLevel());
} }
void WebContents::ShowAutofillPopup(const gfx::RectF& bounds,
const std::vector<base::string16>& values,
const std::vector<base::string16>& labels) {
content::RenderFrameHost* frame_host = bindings_.dispatch_context();
ShowAutofillPopup(frame_host, bounds, values, labels);
}
void WebContents::HideAutofillPopup() {
CommonWebContentsDelegate::HideAutofillPopup();
}
v8::Local<v8::Value> WebContents::GetPreloadPath(v8::Isolate* isolate) const { v8::Local<v8::Value> WebContents::GetPreloadPath(v8::Isolate* isolate) const {
if (auto* web_preferences = WebContentsPreferences::From(web_contents())) { if (auto* web_preferences = WebContentsPreferences::From(web_contents())) {
base::FilePath::StringType preload; base::FilePath::StringType preload;

View file

@ -436,8 +436,6 @@ class WebContents : public mate::TrackableObject<WebContents>,
void DidFinishNavigation( void DidFinishNavigation(
content::NavigationHandle* navigation_handle) override; content::NavigationHandle* navigation_handle) override;
bool OnMessageReceived(const IPC::Message& message) override; bool OnMessageReceived(const IPC::Message& message) override;
bool OnMessageReceived(const IPC::Message& message,
content::RenderFrameHost* frame_host) override;
void WebContentsDestroyed() override; void WebContentsDestroyed() override;
void NavigationEntryCommitted( void NavigationEntryCommitted(
const content::LoadCommittedDetails& load_details) override; const content::LoadCommittedDetails& load_details) override;
@ -511,6 +509,11 @@ class WebContents : public mate::TrackableObject<WebContents>,
void SetTemporaryZoomLevel(double level) override; void SetTemporaryZoomLevel(double level) override;
void DoGetZoomLevel(DoGetZoomLevelCallback callback) override; void DoGetZoomLevel(DoGetZoomLevelCallback callback) override;
void ShowAutofillPopup(const gfx::RectF& bounds,
const std::vector<base::string16>& values,
const std::vector<base::string16>& labels) override;
void HideAutofillPopup() override;
// Called when we receive a CursorChange message from chromium. // Called when we receive a CursorChange message from chromium.
void OnCursorChange(const content::WebCursor& cursor); void OnCursorChange(const content::WebCursor& cursor);

View file

@ -6,7 +6,6 @@
#include <utility> #include <utility>
#include "atom/common/api/api_messages.h"
#include "atom/common/native_mate_converters/string16_converter.h" #include "atom/common/native_mate_converters/string16_converter.h"
#include "atom/common/native_mate_converters/value_converter.h" #include "atom/common/native_mate_converters/value_converter.h"
#include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_frame_host.h"

View file

@ -214,9 +214,7 @@ void CommonWebContentsDelegate::SetOwnerWindow(
NativeWindow* owner_window) { NativeWindow* owner_window) {
if (owner_window) { if (owner_window) {
owner_window_ = owner_window->GetWeakPtr(); owner_window_ = owner_window->GetWeakPtr();
#if defined(TOOLKIT_VIEWS)
autofill_popup_.reset(new AutofillPopup()); autofill_popup_.reset(new AutofillPopup());
#endif
NativeWindowRelay::CreateForWebContents(web_contents, NativeWindowRelay::CreateForWebContents(web_contents,
owner_window->GetWeakPtr()); owner_window->GetWeakPtr());
} else { } else {

View file

@ -105,7 +105,6 @@ class CommonWebContentsDelegate : public content::WebContentsDelegate,
const content::NativeWebKeyboardEvent& event) override; const content::NativeWebKeyboardEvent& event) override;
// Autofill related events. // Autofill related events.
#if defined(TOOLKIT_VIEWS)
void ShowAutofillPopup(content::RenderFrameHost* frame_host, void ShowAutofillPopup(content::RenderFrameHost* frame_host,
content::RenderFrameHost* embedder_frame_host, content::RenderFrameHost* embedder_frame_host,
bool offscreen, bool offscreen,
@ -113,7 +112,6 @@ class CommonWebContentsDelegate : public content::WebContentsDelegate,
const std::vector<base::string16>& values, const std::vector<base::string16>& values,
const std::vector<base::string16>& labels); const std::vector<base::string16>& labels);
void HideAutofillPopup(); void HideAutofillPopup();
#endif
// InspectableWebContentsDelegate: // InspectableWebContentsDelegate:
void DevToolsSaveToFile(const std::string& url, void DevToolsSaveToFile(const std::string& url,

View file

@ -4,7 +4,6 @@
#include "atom/browser/osr/osr_web_contents_view.h" #include "atom/browser/osr/osr_web_contents_view.h"
#include "atom/common/api/api_messages.h"
#include "content/browser/web_contents/web_contents_impl.h" // nogncheck #include "content/browser/web_contents/web_contents_impl.h" // nogncheck
#include "content/public/browser/render_view_host.h" #include "content/public/browser/render_view_host.h"
#include "third_party/blink/public/platform/web_screen_info.h" #include "third_party/blink/public/platform/web_screen_info.h"

View file

@ -8,10 +8,11 @@
#include "atom/browser/native_window_views.h" #include "atom/browser/native_window_views.h"
#include "atom/browser/ui/autofill_popup.h" #include "atom/browser/ui/autofill_popup.h"
#include "atom/common/api/api_messages.h" #include "atom/common/api/api.mojom.h"
#include "base/i18n/rtl.h" #include "base/i18n/rtl.h"
#include "chrome/browser/ui/autofill/popup_view_common.h" #include "chrome/browser/ui/autofill/popup_view_common.h"
#include "electron/buildflags/buildflags.h" #include "electron/buildflags/buildflags.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#include "ui/display/display.h" #include "ui/display/display.h"
#include "ui/display/screen.h" #include "ui/display/screen.h"
#include "ui/gfx/geometry/point.h" #include "ui/gfx/geometry/point.h"
@ -110,8 +111,10 @@ void AutofillPopup::SetItems(const std::vector<base::string16>& values,
} }
void AutofillPopup::AcceptSuggestion(int index) { void AutofillPopup::AcceptSuggestion(int index) {
frame_host_->Send(new AtomAutofillFrameMsg_AcceptSuggestion( mojom::ElectronAutofillAgentAssociatedPtr autofill_agent;
frame_host_->GetRoutingID(), GetValueAt(index))); frame_host_->GetRemoteAssociatedInterfaces()->GetInterface(
mojo::MakeRequest(&autofill_agent));
autofill_agent->AcceptDataListSuggestion(GetValueAt(index));
} }
void AutofillPopup::UpdatePopupBounds() { void AutofillPopup::UpdatePopupBounds() {

View file

@ -11,7 +11,6 @@
#include "atom/browser/atom_browser_context.h" #include "atom/browser/atom_browser_context.h"
#include "atom/browser/loader/layered_resource_handler.h" #include "atom/browser/loader/layered_resource_handler.h"
#include "atom/browser/ui/webui/pdf_viewer_handler.h" #include "atom/browser/ui/webui/pdf_viewer_handler.h"
#include "atom/common/api/api_messages.h"
#include "atom/common/atom_constants.h" #include "atom/common/atom_constants.h"
#include "base/sequenced_task_runner_helpers.h" #include "base/sequenced_task_runner_helpers.h"
#include "base/task/post_task.h" #include "base/task/post_task.h"

View file

@ -1,6 +1,7 @@
module atom.mojom; module atom.mojom;
import "mojo/public/mojom/base/values.mojom"; import "mojo/public/mojom/base/values.mojom";
import "mojo/public/mojom/base/string16.mojom";
import "ui/gfx/geometry/mojo/geometry.mojom"; import "ui/gfx/geometry/mojo/geometry.mojom";
interface ElectronRenderer { interface ElectronRenderer {
@ -14,6 +15,10 @@ interface ElectronRenderer {
TakeHeapSnapshot(handle file) => (bool success); TakeHeapSnapshot(handle file) => (bool success);
}; };
interface ElectronAutofillAgent {
AcceptDataListSuggestion(mojo_base.mojom.String16 value);
};
struct DraggableRegion { struct DraggableRegion {
bool draggable; bool draggable;
gfx.mojom.Rect bounds; gfx.mojom.Rect bounds;
@ -64,4 +69,8 @@ interface ElectronBrowser {
[Sync] [Sync]
DoGetZoomLevel() => (double result); DoGetZoomLevel() => (double result);
// TODO: move these into a separate interface
ShowAutofillPopup(gfx.mojom.RectF bounds, array<mojo_base.mojom.String16> values, array<mojo_base.mojom.String16> labels);
HideAutofillPopup();
}; };

View file

@ -1,23 +0,0 @@
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
// Multiply-included file, no traditional include guard.
#include "base/strings/string16.h"
#include "content/public/common/common_param_traits.h"
#include "ipc/ipc_message_macros.h"
#include "ui/gfx/geometry/rect_f.h"
#include "ui/gfx/ipc/gfx_param_traits.h"
#define IPC_MESSAGE_START ElectronMsgStart
IPC_MESSAGE_ROUTED3(AtomAutofillFrameHostMsg_ShowPopup,
gfx::RectF /* bounds */,
std::vector<base::string16> /* values */,
std::vector<base::string16> /* labels */)
IPC_MESSAGE_ROUTED0(AtomAutofillFrameHostMsg_HidePopup)
IPC_MESSAGE_ROUTED1(AtomAutofillFrameMsg_AcceptSuggestion,
base::string16 /* suggestion */)

View file

@ -4,7 +4,6 @@
#include "atom/common/api/remote_object_freer.h" #include "atom/common/api/remote_object_freer.h"
#include "atom/common/api/api_messages.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/values.h" #include "base/values.h"
#include "content/public/renderer/render_frame.h" #include "content/public/renderer/render_frame.h"

View file

@ -1,31 +0,0 @@
// Copyright (c) 2014 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
// Get basic type definitions.
#define IPC_MESSAGE_IMPL
#include "atom/common/common_message_generator.h"
// Generate constructors.
#include "ipc/struct_constructor_macros.h"
// lint: must come after struct_constructor_macros.
#include "atom/common/common_message_generator.h"
// Generate param traits write methods.
#include "ipc/param_traits_write_macros.h"
namespace IPC {
#include "atom/common/common_message_generator.h"
} // namespace IPC
// Generate param traits read methods.
#include "ipc/param_traits_read_macros.h"
namespace IPC {
#include "atom/common/common_message_generator.h"
} // namespace IPC
// Generate param traits log methods.
#include "ipc/param_traits_log_macros.h"
namespace IPC {
#include "atom/common/common_message_generator.h"
} // namespace IPC

View file

@ -1,7 +0,0 @@
// Copyright (c) 2014 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
// Multiply-included file, no traditional include guard.
#include "atom/common/api/api_messages.h"

View file

@ -4,7 +4,6 @@
#include <string> #include <string>
#include "atom/common/api/api_messages.h"
#include "atom/common/native_mate_converters/value_converter.h" #include "atom/common/native_mate_converters/value_converter.h"
#include "atom/common/node_bindings.h" #include "atom/common/node_bindings.h"
#include "atom/common/node_includes.h" #include "atom/common/node_includes.h"

View file

@ -8,7 +8,6 @@
#include <vector> #include <vector>
#include "atom/common/api/api.mojom.h" #include "atom/common/api/api.mojom.h"
#include "atom/common/api/api_messages.h"
#include "atom/common/api/event_emitter_caller.h" #include "atom/common/api/event_emitter_caller.h"
#include "atom/common/native_mate_converters/blink_converter.h" #include "atom/common/native_mate_converters/blink_converter.h"
#include "atom/common/native_mate_converters/callback.h" #include "atom/common/native_mate_converters/callback.h"

View file

@ -4,11 +4,12 @@
#include "atom/renderer/atom_autofill_agent.h" #include "atom/renderer/atom_autofill_agent.h"
#include <utility>
#include <vector> #include <vector>
#include "atom/common/api/api_messages.h"
#include "content/public/renderer/render_frame.h" #include "content/public/renderer/render_frame.h"
#include "content/public/renderer/render_view.h" #include "content/public/renderer/render_view.h"
#include "services/service_manager/public/cpp/interface_provider.h"
#include "third_party/blink/public/platform/web_keyboard_event.h" #include "third_party/blink/public/platform/web_keyboard_event.h"
#include "third_party/blink/public/platform/web_string.h" #include "third_party/blink/public/platform/web_string.h"
#include "third_party/blink/public/web/web_document.h" #include "third_party/blink/public/web/web_document.h"
@ -49,13 +50,23 @@ void TrimStringVectorForIPC(std::vector<base::string16>* strings) {
} }
} // namespace } // namespace
AutofillAgent::AutofillAgent(content::RenderFrame* frame) AutofillAgent::AutofillAgent(content::RenderFrame* frame,
: content::RenderFrameObserver(frame), weak_ptr_factory_(this) { blink::AssociatedInterfaceRegistry* registry)
: content::RenderFrameObserver(frame),
binding_(this),
weak_ptr_factory_(this) {
render_frame()->GetWebFrame()->SetAutofillClient(this); render_frame()->GetWebFrame()->SetAutofillClient(this);
registry->AddInterface(
base::Bind(&AutofillAgent::BindRequest, base::Unretained(this)));
} }
AutofillAgent::~AutofillAgent() = default; AutofillAgent::~AutofillAgent() = default;
void AutofillAgent::BindRequest(
mojom::ElectronAutofillAgentAssociatedRequest request) {
binding_.Bind(std::move(request));
}
void AutofillAgent::OnDestruct() { void AutofillAgent::OnDestruct() {
delete this; delete this;
} }
@ -165,24 +176,13 @@ void AutofillAgent::DidCompleteFocusChangeInFrame() {
DoFocusChangeComplete(); DoFocusChangeComplete();
} }
bool AutofillAgent::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(AutofillAgent, message)
IPC_MESSAGE_HANDLER(AtomAutofillFrameMsg_AcceptSuggestion,
OnAcceptSuggestion)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
}
bool AutofillAgent::IsUserGesture() const { bool AutofillAgent::IsUserGesture() const {
return blink::WebUserGestureIndicator::IsProcessingUserGesture( return blink::WebUserGestureIndicator::IsProcessingUserGesture(
render_frame()->GetWebFrame()); render_frame()->GetWebFrame());
} }
void AutofillAgent::HidePopup() { void AutofillAgent::HidePopup() {
Send(new AtomAutofillFrameHostMsg_HidePopup(render_frame()->GetRoutingID())); GetElectronBrowser()->HideAutofillPopup();
} }
void AutofillAgent::ShowPopup(const blink::WebFormControlElement& element, void AutofillAgent::ShowPopup(const blink::WebFormControlElement& element,
@ -190,11 +190,10 @@ void AutofillAgent::ShowPopup(const blink::WebFormControlElement& element,
const std::vector<base::string16>& labels) { const std::vector<base::string16>& labels) {
gfx::RectF bounds = gfx::RectF bounds =
render_frame()->GetRenderView()->ElementBoundsInWindow(element); render_frame()->GetRenderView()->ElementBoundsInWindow(element);
Send(new AtomAutofillFrameHostMsg_ShowPopup(render_frame()->GetRoutingID(), GetElectronBrowser()->ShowAutofillPopup(bounds, values, labels);
bounds, values, labels));
} }
void AutofillAgent::OnAcceptSuggestion(base::string16 suggestion) { void AutofillAgent::AcceptDataListSuggestion(const base::string16& suggestion) {
auto element = render_frame()->GetWebFrame()->GetDocument().FocusedElement(); auto element = render_frame()->GetWebFrame()->GetDocument().FocusedElement();
if (element.IsFormControlElement()) { if (element.IsFormControlElement()) {
ToWebInputElement(&element)->SetAutofillValue( ToWebInputElement(&element)->SetAutofillValue(
@ -219,4 +218,13 @@ void AutofillAgent::DoFocusChangeComplete() {
focused_node_was_last_clicked_ = false; focused_node_was_last_clicked_ = false;
} }
const mojom::ElectronBrowserPtr& AutofillAgent::GetElectronBrowser() {
if (!browser_ptr_) {
render_frame()->GetRemoteInterfaces()->GetInterface(
mojo::MakeRequest(&browser_ptr_));
}
return browser_ptr_;
}
} // namespace atom } // namespace atom

View file

@ -7,8 +7,11 @@
#include <vector> #include <vector>
#include "atom/common/api/api.mojom.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "content/public/renderer/render_frame_observer.h" #include "content/public/renderer/render_frame_observer.h"
#include "mojo/public/cpp/bindings/associated_binding.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
#include "third_party/blink/public/web/web_autofill_client.h" #include "third_party/blink/public/web/web_autofill_client.h"
#include "third_party/blink/public/web/web_element.h" #include "third_party/blink/public/web/web_element.h"
#include "third_party/blink/public/web/web_form_control_element.h" #include "third_party/blink/public/web/web_form_control_element.h"
@ -17,11 +20,15 @@
namespace atom { namespace atom {
class AutofillAgent : public content::RenderFrameObserver, class AutofillAgent : public content::RenderFrameObserver,
public blink::WebAutofillClient { public blink::WebAutofillClient,
public mojom::ElectronAutofillAgent {
public: public:
explicit AutofillAgent(content::RenderFrame* frame); explicit AutofillAgent(content::RenderFrame* frame,
blink::AssociatedInterfaceRegistry* registry);
~AutofillAgent() override; ~AutofillAgent() override;
void BindRequest(mojom::ElectronAutofillAgentAssociatedRequest request);
// content::RenderFrameObserver: // content::RenderFrameObserver:
void OnDestruct() override; void OnDestruct() override;
@ -38,8 +45,6 @@ class AutofillAgent : public content::RenderFrameObserver,
bool requires_caret_at_end; bool requires_caret_at_end;
}; };
bool OnMessageReceived(const IPC::Message& message) override;
// blink::WebAutofillClient: // blink::WebAutofillClient:
void TextFieldDidEndEditing(const blink::WebInputElement&) override; void TextFieldDidEndEditing(const blink::WebInputElement&) override;
void TextFieldDidChange(const blink::WebFormControlElement&) override; void TextFieldDidChange(const blink::WebFormControlElement&) override;
@ -49,6 +54,9 @@ class AutofillAgent : public content::RenderFrameObserver,
void OpenTextDataListChooser(const blink::WebInputElement&) override; void OpenTextDataListChooser(const blink::WebInputElement&) override;
void DataListOptionsChanged(const blink::WebInputElement&) override; void DataListOptionsChanged(const blink::WebInputElement&) override;
// mojom::ElectronAutofillAgent
void AcceptDataListSuggestion(const base::string16& suggestion) override;
bool IsUserGesture() const; bool IsUserGesture() const;
void HidePopup(); void HidePopup();
void ShowPopup(const blink::WebFormControlElement&, void ShowPopup(const blink::WebFormControlElement&,
@ -56,10 +64,12 @@ class AutofillAgent : public content::RenderFrameObserver,
const std::vector<base::string16>&); const std::vector<base::string16>&);
void ShowSuggestions(const blink::WebFormControlElement& element, void ShowSuggestions(const blink::WebFormControlElement& element,
const ShowSuggestionsOptions& options); const ShowSuggestionsOptions& options);
void OnAcceptSuggestion(base::string16 suggestion);
void DoFocusChangeComplete(); void DoFocusChangeComplete();
const mojom::ElectronBrowserPtr& GetElectronBrowser();
mojom::ElectronBrowserPtr browser_ptr_;
// True when the last click was on the focused node. // True when the last click was on the focused node.
bool focused_node_was_last_clicked_ = false; bool focused_node_was_last_clicked_ = false;
@ -68,6 +78,8 @@ class AutofillAgent : public content::RenderFrameObserver,
// already focused, or if it caused the focus to change. // already focused, or if it caused the focus to change.
bool was_focused_before_now_ = false; bool was_focused_before_now_ = false;
mojo::AssociatedBinding<mojom::ElectronAutofillAgent> binding_;
base::WeakPtrFactory<AutofillAgent> weak_ptr_factory_; base::WeakPtrFactory<AutofillAgent> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(AutofillAgent); DISALLOW_COPY_AND_ASSIGN(AutofillAgent);

View file

@ -8,7 +8,6 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "atom/common/api/api_messages.h"
#include "atom/common/api/event_emitter_caller.h" #include "atom/common/api/event_emitter_caller.h"
#include "atom/common/native_mate_converters/value_converter.h" #include "atom/common/native_mate_converters/value_converter.h"
#include "atom/common/node_includes.h" #include "atom/common/node_includes.h"

View file

@ -4,7 +4,6 @@
#include "atom/renderer/atom_sandboxed_renderer_client.h" #include "atom/renderer/atom_sandboxed_renderer_client.h"
#include "atom/common/api/api_messages.h"
#include "atom/common/api/electron_bindings.h" #include "atom/common/api/electron_bindings.h"
#include "atom/common/application_info.h" #include "atom/common/application_info.h"
#include "atom/common/native_mate_converters/string16_converter.h" #include "atom/common/native_mate_converters/string16_converter.h"

View file

@ -200,7 +200,8 @@ void RendererClientBase::RenderThreadStarted() {
void RendererClientBase::RenderFrameCreated( void RendererClientBase::RenderFrameCreated(
content::RenderFrame* render_frame) { content::RenderFrame* render_frame) {
#if defined(TOOLKIT_VIEWS) #if defined(TOOLKIT_VIEWS)
new AutofillAgent(render_frame); new AutofillAgent(render_frame,
render_frame->GetAssociatedInterfaceRegistry());
#endif #endif
#if BUILDFLAG(ENABLE_PEPPER_FLASH) #if BUILDFLAG(ENABLE_PEPPER_FLASH)
new PepperHelper(render_frame); new PepperHelper(render_frame);

View file

@ -448,7 +448,6 @@ filenames = {
"atom/browser/window_list_observer.h", "atom/browser/window_list_observer.h",
"atom/browser/zoom_level_delegate.cc", "atom/browser/zoom_level_delegate.cc",
"atom/browser/zoom_level_delegate.h", "atom/browser/zoom_level_delegate.h",
"atom/common/api/api_messages.h",
"atom/common/api/atom_api_asar.cc", "atom/common/api/atom_api_asar.cc",
"atom/common/api/atom_api_clipboard.cc", "atom/common/api/atom_api_clipboard.cc",
"atom/common/api/atom_api_clipboard.h", "atom/common/api/atom_api_clipboard.h",
@ -492,8 +491,6 @@ filenames = {
"atom/common/atom_constants.h", "atom/common/atom_constants.h",
"atom/common/color_util.cc", "atom/common/color_util.cc",
"atom/common/color_util.h", "atom/common/color_util.h",
"atom/common/common_message_generator.cc",
"atom/common/common_message_generator.h",
"atom/common/crash_reporter/crash_reporter.cc", "atom/common/crash_reporter/crash_reporter.cc",
"atom/common/crash_reporter/crash_reporter.h", "atom/common/crash_reporter/crash_reporter.h",
"atom/common/crash_reporter/crash_reporter_linux.cc", "atom/common/crash_reporter/crash_reporter_linux.cc",

View file

@ -64,7 +64,6 @@ revert_build_swiftshader_for_arm32.patch
fix_disable_usage_of_abort_report_np_in_mas_builds.patch fix_disable_usage_of_abort_report_np_in_mas_builds.patch
fix_disable_usage_of_pthread_fchdir_np_and_pthread_chdir_np_in_mas.patch fix_disable_usage_of_pthread_fchdir_np_and_pthread_chdir_np_in_mas.patch
fix_disable_usage_of_setapplicationisdaemon_and.patch fix_disable_usage_of_setapplicationisdaemon_and.patch
ipc_message_start.patch
disable_network_services_by_default.patch disable_network_services_by_default.patch
unsandboxed_ppapi_processes_skip_zygote.patch unsandboxed_ppapi_processes_skip_zygote.patch
patch_the_ensure_gn_version_py_script_to_work_on_mac_ci.patch patch_the_ensure_gn_version_py_script_to_work_on_mac_ci.patch

View file

@ -1,23 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: deepak1556 <hop2deep@gmail.com>
Date: Fri, 5 Apr 2019 12:49:24 +0530
Subject: Define ipc identifier for legacy Electron ipc messages
Electron ipc messages used to piggy back on ShellMsgStart for ipc
identifier. But its not available after
https://chromium-review.googlesource.com/c/chromium/src/+/1525181.
This patch can be removed once legacy ipc messages are no longer
used.
diff --git a/ipc/ipc_message_start.h b/ipc/ipc_message_start.h
index 4d83cdf93aef66d3479c9a325e8241592d85359e..a03af8a4b9d370ae849d4fe61c805ecb525fe394 100644
--- a/ipc/ipc_message_start.h
+++ b/ipc/ipc_message_start.h
@@ -69,6 +69,7 @@ enum IPCMessageStart {
ExtensionWorkerMsgStart,
SubresourceFilterMsgStart,
ChromeAppsMsgStart,
+ ElectronMsgStart,
LastIPCMsgStart // Must come last.
};

View file

@ -25,9 +25,6 @@ const BLACKLIST = new Set([
['atom', 'browser', 'ui', 'cocoa', 'touch_bar_forward_declarations.h'], ['atom', 'browser', 'ui', 'cocoa', 'touch_bar_forward_declarations.h'],
['atom', 'browser', 'ui', 'cocoa', 'NSColor+Hex.h'], ['atom', 'browser', 'ui', 'cocoa', 'NSColor+Hex.h'],
['atom', 'browser', 'ui', 'cocoa', 'NSString+ANSI.h'], ['atom', 'browser', 'ui', 'cocoa', 'NSString+ANSI.h'],
['atom', 'common', 'api', 'api_messages.h'],
['atom', 'common', 'common_message_generator.cc'],
['atom', 'common', 'common_message_generator.h'],
['atom', 'common', 'node_includes.h'], ['atom', 'common', 'node_includes.h'],
['spec', 'static', 'jquery-2.0.3.min.js'], ['spec', 'static', 'jquery-2.0.3.min.js'],
['spec', 'ts-smoke', 'electron', 'main.ts'], ['spec', 'ts-smoke', 'electron', 'main.ts'],