1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_DELEGATE_H_
6 #define EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_DELEGATE_H_
8 #include "extensions/browser/guest_view/guest_view_base.h"
13 } // namespace content
15 namespace extensions
{
20 namespace web_view_internal
{
22 struct ContextMenuItem
;
23 } // namespace web_view_internal
26 // A delegate class of WebViewGuest that are not a part of chrome.
27 class WebViewGuestDelegate
{
29 virtual ~WebViewGuestDelegate() {}
31 typedef std::vector
<linked_ptr
<api::web_view_internal::ContextMenuItem
> >
34 // Returns the current zoom factor.
35 virtual double GetZoom() = 0;
37 // Called when context menu operation was handled.
38 virtual bool HandleContextMenu(const content::ContextMenuParams
& params
) = 0;
40 // Called to attach helpers just after additional initialization is performed.
41 virtual void OnAttachWebViewHelpers(content::WebContents
* contents
) = 0;
43 // Called after the guest has been attached to an embedder and suspended
44 // resource loads have been resumed.
45 virtual void OnDidAttachToEmbedder() = 0;
47 // Called when the guest WebContents commits a provisional load in any frame.
48 virtual void OnDidCommitProvisionalLoadForFrame(bool is_main_frame
) = 0;
50 // Called just after additional initialization is performed.
51 virtual void OnDidInitialize() = 0;
53 virtual void OnDocumentLoadedInFrame(
54 content::RenderFrameHost
* render_frame_host
) = 0;
56 // Called before the embedder is destroyed.
57 virtual void OnEmbedderWillBeDestroyed() = 0;
59 // Called immediately after the guest WebContents has been destroyed.
60 virtual void OnGuestDestroyed() = 0;
62 // Called when to set the zoom factor.
63 virtual void OnSetZoom(double zoom_factor
) = 0;
65 // Shows the context menu for the guest.
66 // |items| acts as a filter. This restricts the current context's default
67 // menu items to contain only the items from |items|.
68 // |items| == NULL means no filtering will be applied.
69 virtual void OnShowContextMenu(
71 const MenuItemVector
* items
) = 0;
74 } // namespace extensions
76 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_DELEGATE_H_