OLD | NEW |
---|---|
(Empty) | |
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. | |
4 | |
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_ | |
7 | |
8 #include "chrome/common/extensions/api/web_view_internal.h" | |
9 #include "extensions/browser/guest_view/guest_view_base.h" | |
10 | |
11 namespace content { | |
12 class RenderViewHost; | |
13 class WebContents; | |
14 } | |
15 | |
16 namespace extensions { | |
17 | |
18 namespace webview_api = api::web_view_internal; | |
19 | |
20 // A delegate class of WebViewGuest that are not a part of chrome. | |
21 class WebViewGuestDelegate { | |
Fady Samuel
2014/08/20 14:45:09
Methods here should be pure virtual. WebViewGuest
Xi Han
2014/08/20 15:46:01
Done.
| |
22 public : | |
23 WebViewGuestDelegate(); | |
24 virtual ~WebViewGuestDelegate(); | |
25 | |
26 typedef std::vector<linked_ptr<webview_api::ContextMenuItem> > MenuItemVector; | |
27 | |
28 // Returns the current zoom factor. | |
29 virtual double GetZoom(); | |
30 | |
31 virtual void InjectChromeVoxIfNeeded( | |
32 content::RenderViewHost* render_view_host) {} | |
33 | |
34 // Called to attach helpers just after additional initialization is performed. | |
35 virtual void OnAttachWebViewHelpers(content::WebContents* contents) {} | |
36 | |
37 // Called when the guest WebContents commits a provisional load in any frame. | |
38 virtual void OnDidCommitProvisionalLoadForFrame(bool is_main_frame) {} | |
39 | |
40 // Called just after additional initialization is performed. | |
41 virtual void OnDidInitialize() {} | |
42 | |
43 // Return a new event if the context menu operation was handled. | |
44 virtual extensions::GuestViewBase::Event* OnHandleContextMenu( | |
45 const content::ContextMenuParams& params); | |
46 | |
47 // Called immediately after the guest WebContents has been destroyed. | |
48 virtual void OnGuestDestroyed() {} | |
49 | |
50 // Called when to set the zoom factor. | |
51 virtual GuestViewBase::Event* OnSetZoom( | |
52 double zoom_factor, | |
53 const std::string& old_zoom_factor, | |
54 const std::string& new_zoom_factor, | |
55 const std::string& event_zoom_change); | |
56 | |
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( | |
62 int request_id, | |
63 const MenuItemVector* items) {} | |
64 | |
65 // Set current_zoom_factor. | |
66 virtual void SetCurrentZoomFactor(double zoom_factor) {} | |
67 | |
68 private: | |
69 DISALLOW_COPY_AND_ASSIGN(WebViewGuestDelegate); | |
70 }; | |
71 | |
72 } // namespace extensions | |
73 | |
74 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_DELEGATE_H_ | |
OLD | NEW |