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