2014-10-31 18:17:05 +00:00
|
|
|
// Copyright (c) 2014 GitHub, Inc.
|
2014-10-22 14:55:13 +00:00
|
|
|
// 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_WEB_VIEW_MANAGER_H_
|
|
|
|
#define ELECTRON_SHELL_BROWSER_WEB_VIEW_MANAGER_H_
|
2014-10-22 14:55:13 +00:00
|
|
|
|
2014-10-23 15:08:48 +00:00
|
|
|
#include <map>
|
|
|
|
|
2014-10-22 14:55:13 +00:00
|
|
|
#include "content/public/browser/browser_plugin_guest_manager.h"
|
|
|
|
|
|
|
|
namespace electron {
|
|
|
|
|
|
|
|
class WebViewManager : public content::BrowserPluginGuestManager {
|
|
|
|
public:
|
2015-09-05 02:43:30 +00:00
|
|
|
WebViewManager();
|
|
|
|
~WebViewManager() override;
|
2015-02-04 23:08:29 +00:00
|
|
|
|
2021-11-03 11:41:45 +00:00
|
|
|
// disable copy
|
|
|
|
WebViewManager(const WebViewManager&) = delete;
|
|
|
|
WebViewManager& operator=(const WebViewManager&) = delete;
|
|
|
|
|
2014-10-23 15:08:48 +00:00
|
|
|
void AddGuest(int guest_instance_id,
|
|
|
|
content::WebContents* embedder,
|
2015-09-03 00:47:58 +00:00
|
|
|
content::WebContents* web_contents);
|
2014-10-23 15:08:48 +00:00
|
|
|
void RemoveGuest(int guest_instance_id);
|
2016-05-25 17:13:12 +00:00
|
|
|
|
|
|
|
static WebViewManager* GetWebViewManager(content::WebContents* web_contents);
|
|
|
|
|
2014-10-22 14:55:13 +00:00
|
|
|
// content::BrowserPluginGuestManager:
|
2014-12-09 22:38:43 +00:00
|
|
|
bool ForEachGuest(content::WebContents* embedder,
|
2014-12-07 15:43:26 +00:00
|
|
|
const GuestCallback& callback) override;
|
2014-10-22 14:55:13 +00:00
|
|
|
|
|
|
|
private:
|
2014-10-23 15:08:48 +00:00
|
|
|
struct WebContentsWithEmbedder {
|
2015-02-04 23:28:26 +00:00
|
|
|
content::WebContents* web_contents;
|
2014-10-23 15:08:48 +00:00
|
|
|
content::WebContents* embedder;
|
|
|
|
};
|
2015-02-04 23:28:26 +00:00
|
|
|
// guest_instance_id => (web_contents, embedder)
|
2015-08-06 15:01:05 +00:00
|
|
|
std::map<int, WebContentsWithEmbedder> web_contents_embedder_map_;
|
2014-10-22 14:55:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace electron
|
|
|
|
|
2021-11-22 07:34:31 +00:00
|
|
|
#endif // ELECTRON_SHELL_BROWSER_WEB_VIEW_MANAGER_H_
|