electron/shell/browser/web_view_manager.h

46 lines
1.3 KiB
C
Raw Normal View History

// Copyright (c) 2014 GitHub, Inc.
2014-10-22 22:55:13 +08:00
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ELECTRON_SHELL_BROWSER_WEB_VIEW_MANAGER_H_
#define ELECTRON_SHELL_BROWSER_WEB_VIEW_MANAGER_H_
2014-10-22 22:55:13 +08:00
2014-10-23 23:08:48 +08:00
#include <map>
2014-10-22 22:55:13 +08:00
#include "content/public/browser/browser_plugin_guest_manager.h"
namespace electron {
2014-10-22 22:55:13 +08:00
class WebViewManager : public content::BrowserPluginGuestManager {
public:
WebViewManager();
~WebViewManager() override;
2015-02-04 15:08:29 -08:00
// disable copy
WebViewManager(const WebViewManager&) = delete;
WebViewManager& operator=(const WebViewManager&) = delete;
2014-10-23 23:08:48 +08:00
void AddGuest(int guest_instance_id,
content::WebContents* embedder,
content::WebContents* web_contents);
2014-10-23 23:08:48 +08:00
void RemoveGuest(int guest_instance_id);
static WebViewManager* GetWebViewManager(content::WebContents* web_contents);
2014-10-22 22:55:13 +08:00
// content::BrowserPluginGuestManager:
bool ForEachGuest(content::WebContents* embedder,
const GuestCallback& callback) override;
2014-10-22 22:55:13 +08:00
private:
2014-10-23 23:08:48 +08:00
struct WebContentsWithEmbedder {
2015-02-04 15:28:26 -08:00
content::WebContents* web_contents;
2014-10-23 23:08:48 +08:00
content::WebContents* embedder;
};
2015-02-04 15:28:26 -08:00
// guest_instance_id => (web_contents, embedder)
2015-08-06 20:31:05 +05:30
std::map<int, WebContentsWithEmbedder> web_contents_embedder_map_;
2014-10-22 22:55:13 +08:00
};
} // namespace electron
2014-10-22 22:55:13 +08:00
#endif // ELECTRON_SHELL_BROWSER_WEB_VIEW_MANAGER_H_