OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_DELEGATE_H_ | 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_ | 6 #define EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_DELEGATE_H_ |
7 | 7 |
8 #include "extensions/browser/guest_view/guest_view_base.h" | 8 #include "extensions/browser/guest_view/guest_view_base.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
11 class RenderViewHost; | 11 class RenderViewHost; |
12 class WebContents; | 12 class WebContents; |
13 } | 13 } |
14 | 14 |
15 namespace extensions { | 15 namespace extensions { |
16 | 16 |
| 17 class WebViewGuest; |
| 18 |
17 namespace api { | 19 namespace api { |
18 namespace web_view_internal{ | 20 namespace web_view_internal{ |
19 | 21 |
20 struct ContextMenuItem; | 22 struct ContextMenuItem; |
21 | 23 |
22 } // namespace web_view_internal | 24 } // namespace web_view_internal |
23 } // namespace api | 25 } // namespace api |
24 | 26 |
25 // A delegate class of WebViewGuest that are not a part of chrome. | 27 // A delegate class of WebViewGuest that are not a part of chrome. |
26 class WebViewGuestDelegate { | 28 class WebViewGuestDelegate { |
27 public : | 29 public : |
28 WebViewGuestDelegate(); | 30 explicit WebViewGuestDelegate(WebViewGuest* web_view_guest); |
29 virtual ~WebViewGuestDelegate(); | 31 virtual ~WebViewGuestDelegate(); |
30 | 32 |
31 typedef std::vector<linked_ptr<api::web_view_internal::ContextMenuItem> > | 33 typedef std::vector<linked_ptr<api::web_view_internal::ContextMenuItem> > |
32 MenuItemVector; | 34 MenuItemVector; |
33 | 35 |
34 // Returns the current zoom factor. | 36 // Returns the current zoom factor. |
35 virtual double GetZoom() = 0; | 37 virtual double GetZoom() = 0; |
36 | 38 |
37 // Called when context menu operation was handled. | 39 // Called when context menu operation was handled. |
38 virtual bool HandleContextMenu(const content::ContextMenuParams& params) = 0; | 40 virtual bool HandleContextMenu(const content::ContextMenuParams& params) = 0; |
39 | 41 |
40 // Called to attach helpers just after additional initialization is performed. | 42 // Called to attach helpers just after additional initialization is performed. |
41 virtual void OnAttachWebViewHelpers(content::WebContents* contents) = 0; | 43 virtual void OnAttachWebViewHelpers(content::WebContents* contents) = 0; |
42 | 44 |
| 45 // Called to perform some cleanup prior to destruction. |
| 46 virtual void OnEmbedderDestroyed() = 0; |
| 47 |
43 // Called when the guest WebContents commits a provisional load in any frame. | 48 // Called when the guest WebContents commits a provisional load in any frame. |
44 virtual void OnDidCommitProvisionalLoadForFrame(bool is_main_frame) = 0; | 49 virtual void OnDidCommitProvisionalLoadForFrame(bool is_main_frame) = 0; |
45 | 50 |
46 // Called just after additional initialization is performed. | 51 // Called just after additional initialization is performed. |
47 virtual void OnDidInitialize() = 0; | 52 virtual void OnDidInitialize() = 0; |
48 | 53 |
49 virtual void OnDocumentLoadedInFrame( | 54 virtual void OnDocumentLoadedInFrame( |
50 content::RenderFrameHost* render_frame_host) = 0; | 55 content::RenderFrameHost* render_frame_host) = 0; |
51 | 56 |
52 // Called immediately after the guest WebContents has been destroyed. | 57 // Called immediately after the guest WebContents has been destroyed. |
53 virtual void OnGuestDestroyed() = 0; | 58 virtual void OnGuestDestroyed() = 0; |
54 | 59 |
55 // Called when to set the zoom factor. | 60 // Called when to set the zoom factor. |
56 virtual void OnSetZoom(double zoom_factor) = 0; | 61 virtual void OnSetZoom(double zoom_factor) = 0; |
57 | 62 |
58 // Shows the context menu for the guest. | 63 // Shows the context menu for the guest. |
59 // |items| acts as a filter. This restricts the current context's default | 64 // |items| acts as a filter. This restricts the current context's default |
60 // menu items to contain only the items from |items|. | 65 // menu items to contain only the items from |items|. |
61 // |items| == NULL means no filtering will be applied. | 66 // |items| == NULL means no filtering will be applied. |
62 virtual void OnShowContextMenu( | 67 virtual void OnShowContextMenu( |
63 int request_id, | 68 int request_id, |
64 const MenuItemVector* items) = 0; | 69 const MenuItemVector* items) = 0; |
65 | 70 |
| 71 WebViewGuest* web_view_guest() const { return web_view_guest_; } |
| 72 |
66 private: | 73 private: |
| 74 WebViewGuest* const web_view_guest_; |
| 75 |
67 DISALLOW_COPY_AND_ASSIGN(WebViewGuestDelegate); | 76 DISALLOW_COPY_AND_ASSIGN(WebViewGuestDelegate); |
68 }; | 77 }; |
69 | 78 |
70 } // namespace extensions | 79 } // namespace extensions |
71 | 80 |
72 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_DELEGATE_H_ | 81 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_DELEGATE_H_ |
OLD | NEW |