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 "base/callback.h"
9 #include "extensions/browser/guest_view/guest_view_base.h"
14 } // namespace content
16 namespace extensions
{
21 namespace web_view_internal
{
23 struct ContextMenuItem
;
24 } // namespace web_view_internal
27 // A delegate class of WebViewGuest that are not a part of chrome.
28 class WebViewGuestDelegate
{
30 virtual ~WebViewGuestDelegate() {}
32 typedef std::vector
<linked_ptr
<api::web_view_internal::ContextMenuItem
> >
35 // Clears http cache for this guest's StoragePartition.
36 virtual void ClearCache(base::Time remove_since
,
37 const base::Closure
& callback
) = 0;
39 // Called when context menu operation was handled.
40 virtual bool HandleContextMenu(const content::ContextMenuParams
& params
) = 0;
42 // Called to attach helpers just after additional initialization is performed.
43 virtual void OnAttachWebViewHelpers(content::WebContents
* contents
) = 0;
45 // Called when the guest WebContents commits a provisional load in any frame.
46 virtual void OnDidCommitProvisionalLoadForFrame(bool is_main_frame
) = 0;
48 // Called just after additional initialization is performed.
49 virtual void OnDidInitialize() = 0;
51 virtual void OnDocumentLoadedInFrame(
52 content::RenderFrameHost
* render_frame_host
) = 0;
54 // Called immediately after the guest WebContents has been destroyed.
55 virtual void OnGuestDestroyed() = 0;
57 // Shows the context menu for the guest.
58 // |items| acts as a filter. This restricts the current context's default
59 // menu items to contain only the items from |items|.
60 // |items| == NULL means no filtering will be applied.
61 virtual void OnShowContextMenu(
63 const MenuItemVector
* items
) = 0;
66 } // namespace extensions
68 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_DELEGATE_H_