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