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 blink { |
| 11 struct WebFindOptions; |
| 12 } // nanespace blink |
| 13 |
10 namespace content { | 14 namespace content { |
11 class RenderViewHost; | 15 class RenderViewHost; |
12 class WebContents; | 16 class WebContents; |
13 } | 17 } |
14 | 18 |
15 namespace extensions { | 19 namespace extensions { |
16 | 20 |
| 21 class WebViewGuest; |
| 22 class WebViewInternalFindFunction; |
| 23 |
17 namespace api { | 24 namespace api { |
18 namespace web_view_internal{ | 25 namespace web_view_internal{ |
19 | |
20 struct ContextMenuItem; | 26 struct ContextMenuItem; |
21 | |
22 } // namespace web_view_internal | 27 } // namespace web_view_internal |
23 } // namespace api | 28 } // namespace api |
24 | 29 |
25 // A delegate class of WebViewGuest that are not a part of chrome. | 30 // A delegate class of WebViewGuest that are not a part of chrome. |
26 class WebViewGuestDelegate { | 31 class WebViewGuestDelegate { |
27 public : | 32 public : |
28 WebViewGuestDelegate(); | 33 explicit WebViewGuestDelegate(WebViewGuest* web_view_guest); |
29 virtual ~WebViewGuestDelegate(); | 34 virtual ~WebViewGuestDelegate(); |
30 | 35 |
31 typedef std::vector<linked_ptr<api::web_view_internal::ContextMenuItem> > | 36 typedef std::vector<linked_ptr<api::web_view_internal::ContextMenuItem> > |
32 MenuItemVector; | 37 MenuItemVector; |
33 | 38 |
| 39 // Begin or continue a find request. |
| 40 virtual void Find( |
| 41 const base::string16& search_text, |
| 42 const blink::WebFindOptions& options, |
| 43 WebViewInternalFindFunction* find_function) = 0; |
| 44 |
| 45 // Result of string search in the page. |
| 46 virtual void FindReply(content::WebContents* source, |
| 47 int request_id, |
| 48 int number_of_matches, |
| 49 const gfx::Rect& selection_rect, |
| 50 int active_match_ordinal, |
| 51 bool final_update) = 0; |
| 52 |
34 // Returns the current zoom factor. | 53 // Returns the current zoom factor. |
35 virtual double GetZoom() = 0; | 54 virtual double GetZoom() = 0; |
36 | 55 |
37 // Called when context menu operation was handled. | 56 // Called when context menu operation was handled. |
38 virtual bool HandleContextMenu(const content::ContextMenuParams& params) = 0; | 57 virtual bool HandleContextMenu(const content::ContextMenuParams& params) = 0; |
39 | 58 |
40 // Called to attach helpers just after additional initialization is performed. | 59 // Called to attach helpers just after additional initialization is performed. |
41 virtual void OnAttachWebViewHelpers(content::WebContents* contents) = 0; | 60 virtual void OnAttachWebViewHelpers(content::WebContents* contents) = 0; |
42 | 61 |
| 62 // Called to perform some cleanup prior to destruction. |
| 63 virtual void OnEmbedderDestroyed() = 0; |
| 64 |
43 // Called when the guest WebContents commits a provisional load in any frame. | 65 // Called when the guest WebContents commits a provisional load in any frame. |
44 virtual void OnDidCommitProvisionalLoadForFrame(bool is_main_frame) = 0; | 66 virtual void OnDidCommitProvisionalLoadForFrame(bool is_main_frame) = 0; |
45 | 67 |
46 // Called just after additional initialization is performed. | 68 // Called just after additional initialization is performed. |
47 virtual void OnDidInitialize() = 0; | 69 virtual void OnDidInitialize() = 0; |
48 | 70 |
49 virtual void OnDocumentLoadedInFrame( | 71 virtual void OnDocumentLoadedInFrame( |
50 content::RenderFrameHost* render_frame_host) = 0; | 72 content::RenderFrameHost* render_frame_host) = 0; |
51 | 73 |
52 // Called immediately after the guest WebContents has been destroyed. | 74 // Called immediately after the guest WebContents has been destroyed. |
53 virtual void OnGuestDestroyed() = 0; | 75 virtual void OnGuestDestroyed() = 0; |
54 | 76 |
| 77 // Called to cancel all find sessions in progress. |
| 78 virtual void OnRenderProcessGone() = 0; |
| 79 |
55 // Called when to set the zoom factor. | 80 // Called when to set the zoom factor. |
56 virtual void OnSetZoom(double zoom_factor) = 0; | 81 virtual void OnSetZoom(double zoom_factor) = 0; |
57 | 82 |
58 // Shows the context menu for the guest. | 83 // Shows the context menu for the guest. |
59 // |items| acts as a filter. This restricts the current context's default | 84 // |items| acts as a filter. This restricts the current context's default |
60 // menu items to contain only the items from |items|. | 85 // menu items to contain only the items from |items|. |
61 // |items| == NULL means no filtering will be applied. | 86 // |items| == NULL means no filtering will be applied. |
62 virtual void OnShowContextMenu( | 87 virtual void OnShowContextMenu( |
63 int request_id, | 88 int request_id, |
64 const MenuItemVector* items) = 0; | 89 const MenuItemVector* items) = 0; |
65 | 90 |
| 91 // Conclude a find request to clear highlighting. |
| 92 virtual void StopFinding(content::StopFindAction) = 0; |
| 93 |
| 94 WebViewGuest* web_view_guest() const { return web_view_guest_; } |
| 95 |
66 private: | 96 private: |
| 97 WebViewGuest* const web_view_guest_; |
| 98 |
67 DISALLOW_COPY_AND_ASSIGN(WebViewGuestDelegate); | 99 DISALLOW_COPY_AND_ASSIGN(WebViewGuestDelegate); |
68 }; | 100 }; |
69 | 101 |
70 } // namespace extensions | 102 } // namespace extensions |
71 | 103 |
72 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_DELEGATE_H_ | 104 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_DELEGATE_H_ |
OLD | NEW |