2015-06-25 06:28:13 +00:00
|
|
|
// Copyright (c) 2015 GitHub, Inc.
|
|
|
|
// Use of this source code is governed by the MIT license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#ifndef ATOM_BROWSER_WEB_VIEW_GUEST_DELEGATE_H_
|
|
|
|
#define ATOM_BROWSER_WEB_VIEW_GUEST_DELEGATE_H_
|
|
|
|
|
2017-01-30 11:18:40 +00:00
|
|
|
#include "atom/browser/web_contents_zoom_controller.h"
|
2015-06-25 06:28:13 +00:00
|
|
|
#include "content/public/browser/browser_plugin_guest_delegate.h"
|
|
|
|
|
|
|
|
namespace atom {
|
|
|
|
|
|
|
|
namespace api {
|
|
|
|
class WebContents;
|
|
|
|
}
|
|
|
|
|
|
|
|
class WebViewGuestDelegate : public content::BrowserPluginGuestDelegate,
|
2017-01-30 11:18:40 +00:00
|
|
|
public WebContentsZoomController::Observer {
|
2015-06-25 06:28:13 +00:00
|
|
|
public:
|
2018-08-17 15:21:36 +00:00
|
|
|
WebViewGuestDelegate(content::WebContents* embedder,
|
|
|
|
api::WebContents* api_web_contents);
|
2015-06-25 06:28:13 +00:00
|
|
|
~WebViewGuestDelegate() override;
|
|
|
|
|
2018-08-17 15:21:36 +00:00
|
|
|
// Attach to the iframe.
|
|
|
|
void AttachToIframe(content::WebContents* embedder_web_contents,
|
|
|
|
int embedder_frame_id);
|
2017-06-21 12:17:27 +00:00
|
|
|
|
2015-06-25 06:28:13 +00:00
|
|
|
protected:
|
|
|
|
// content::BrowserPluginGuestDelegate:
|
2017-06-21 12:17:27 +00:00
|
|
|
void DidDetach() final;
|
2015-06-25 06:28:13 +00:00
|
|
|
content::WebContents* GetOwnerWebContents() const final;
|
2018-08-17 15:21:36 +00:00
|
|
|
content::RenderWidgetHost* GetOwnerRenderWidgetHost() final;
|
|
|
|
content::SiteInstance* GetOwnerSiteInstance() final;
|
2017-05-23 20:26:19 +00:00
|
|
|
content::WebContents* CreateNewGuestWindow(
|
2018-08-17 15:21:36 +00:00
|
|
|
const content::WebContents::CreateParams& create_params) final;
|
2015-06-25 06:28:13 +00:00
|
|
|
|
2017-01-30 11:18:40 +00:00
|
|
|
// WebContentsZoomController::Observer:
|
|
|
|
void OnZoomLevelChanged(content::WebContents* web_contents,
|
2017-01-30 17:06:50 +00:00
|
|
|
double level,
|
|
|
|
bool is_temporary) override;
|
2018-08-17 15:21:36 +00:00
|
|
|
void OnZoomControllerWebContentsDestroyed() override;
|
2017-01-30 11:18:40 +00:00
|
|
|
|
2015-06-25 06:28:13 +00:00
|
|
|
private:
|
2017-11-30 15:09:05 +00:00
|
|
|
void ResetZoomController();
|
|
|
|
|
2015-06-25 06:28:13 +00:00
|
|
|
// The WebContents that attaches this guest view.
|
2017-10-11 08:14:03 +00:00
|
|
|
content::WebContents* embedder_web_contents_ = nullptr;
|
2015-06-25 06:28:13 +00:00
|
|
|
|
2017-01-30 11:18:40 +00:00
|
|
|
// The zoom controller of the embedder that is used
|
|
|
|
// to subscribe for zoom changes.
|
2018-05-21 22:18:38 +00:00
|
|
|
WebContentsZoomController* embedder_zoom_controller_ = nullptr;
|
2017-01-30 11:18:40 +00:00
|
|
|
|
2018-05-21 22:18:38 +00:00
|
|
|
api::WebContents* api_web_contents_ = nullptr;
|
2015-06-25 06:28:13 +00:00
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(WebViewGuestDelegate);
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace atom
|
|
|
|
|
|
|
|
#endif // ATOM_BROWSER_WEB_VIEW_GUEST_DELEGATE_H_
|