2020-08-27 14:31:51 +00:00
|
|
|
// Copyright (c) 2019 GitHub, Inc.
|
|
|
|
// Use of this source code is governed by the MIT license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2021-11-22 07:34:31 +00:00
|
|
|
#ifndef ELECTRON_SHELL_BROWSER_ELECTRON_AUTOFILL_DRIVER_FACTORY_H_
|
|
|
|
#define ELECTRON_SHELL_BROWSER_ELECTRON_AUTOFILL_DRIVER_FACTORY_H_
|
2020-08-27 14:31:51 +00:00
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <unordered_map>
|
|
|
|
|
2023-02-03 11:43:42 +00:00
|
|
|
#include "base/functional/callback_forward.h"
|
2020-08-27 14:31:51 +00:00
|
|
|
#include "content/public/browser/web_contents_observer.h"
|
|
|
|
#include "content/public/browser/web_contents_user_data.h"
|
|
|
|
#include "shell/common/api/api.mojom.h"
|
|
|
|
|
|
|
|
namespace electron {
|
|
|
|
|
|
|
|
class AutofillDriver;
|
|
|
|
|
|
|
|
class AutofillDriverFactory
|
2024-05-21 19:21:31 +00:00
|
|
|
: private content::WebContentsObserver,
|
2020-08-27 14:31:51 +00:00
|
|
|
public content::WebContentsUserData<AutofillDriverFactory> {
|
|
|
|
public:
|
|
|
|
typedef base::OnceCallback<std::unique_ptr<AutofillDriver>()>
|
|
|
|
CreationCallback;
|
|
|
|
|
|
|
|
~AutofillDriverFactory() override;
|
|
|
|
|
|
|
|
static void BindAutofillDriver(
|
2021-11-03 17:17:06 +00:00
|
|
|
mojo::PendingAssociatedReceiver<mojom::ElectronAutofillDriver>
|
|
|
|
pending_receiver,
|
2020-08-27 14:31:51 +00:00
|
|
|
content::RenderFrameHost* render_frame_host);
|
|
|
|
|
|
|
|
AutofillDriver* DriverForFrame(content::RenderFrameHost* render_frame_host);
|
|
|
|
void AddDriverForFrame(content::RenderFrameHost* render_frame_host,
|
|
|
|
CreationCallback factory_method);
|
|
|
|
void DeleteDriverForFrame(content::RenderFrameHost* render_frame_host);
|
|
|
|
|
|
|
|
void CloseAllPopups();
|
|
|
|
|
|
|
|
WEB_CONTENTS_USER_DATA_KEY_DECL();
|
|
|
|
|
|
|
|
private:
|
2024-05-21 19:21:31 +00:00
|
|
|
// content::WebContentsObserver:
|
|
|
|
void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override;
|
|
|
|
void DidFinishNavigation(
|
|
|
|
content::NavigationHandle* navigation_handle) override;
|
|
|
|
|
2020-08-27 14:31:51 +00:00
|
|
|
explicit AutofillDriverFactory(content::WebContents* web_contents);
|
|
|
|
friend class content::WebContentsUserData<AutofillDriverFactory>;
|
|
|
|
|
|
|
|
std::unordered_map<content::RenderFrameHost*, std::unique_ptr<AutofillDriver>>
|
|
|
|
driver_map_;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace electron
|
|
|
|
|
2021-11-22 07:34:31 +00:00
|
|
|
#endif // ELECTRON_SHELL_BROWSER_ELECTRON_AUTOFILL_DRIVER_FACTORY_H_
|