Index: extensions/browser/guest_view/web_view/web_view_guest_delegate.h |
diff --git a/extensions/browser/guest_view/web_view/web_view_guest_delegate.h b/extensions/browser/guest_view/web_view/web_view_guest_delegate.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d4f7501a3437ebb40adba7af617c97be83f12891 |
--- /dev/null |
+++ b/extensions/browser/guest_view/web_view/web_view_guest_delegate.h |
@@ -0,0 +1,74 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_DELEGATE_H_ |
+#define EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_DELEGATE_H_ |
+ |
+#include "chrome/common/extensions/api/web_view_internal.h" |
+#include "extensions/browser/guest_view/guest_view_base.h" |
+ |
+namespace content { |
+class RenderViewHost; |
+class WebContents; |
+} |
+ |
+namespace extensions { |
+ |
+namespace webview_api = api::web_view_internal; |
+ |
+// A delegate class of WebViewGuest that are not a part of chrome. |
+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.
|
+ public : |
+ WebViewGuestDelegate(); |
+ virtual ~WebViewGuestDelegate(); |
+ |
+ typedef std::vector<linked_ptr<webview_api::ContextMenuItem> > MenuItemVector; |
+ |
+ // Returns the current zoom factor. |
+ virtual double GetZoom(); |
+ |
+ virtual void InjectChromeVoxIfNeeded( |
+ content::RenderViewHost* render_view_host) {} |
+ |
+ // Called to attach helpers just after additional initialization is performed. |
+ virtual void OnAttachWebViewHelpers(content::WebContents* contents) {} |
+ |
+ // Called when the guest WebContents commits a provisional load in any frame. |
+ virtual void OnDidCommitProvisionalLoadForFrame(bool is_main_frame) {} |
+ |
+ // Called just after additional initialization is performed. |
+ virtual void OnDidInitialize() {} |
+ |
+ // Return a new event if the context menu operation was handled. |
+ virtual extensions::GuestViewBase::Event* OnHandleContextMenu( |
+ const content::ContextMenuParams& params); |
+ |
+ // Called immediately after the guest WebContents has been destroyed. |
+ virtual void OnGuestDestroyed() {} |
+ |
+ // Called when to set the zoom factor. |
+ virtual GuestViewBase::Event* OnSetZoom( |
+ double zoom_factor, |
+ const std::string& old_zoom_factor, |
+ const std::string& new_zoom_factor, |
+ const std::string& event_zoom_change); |
+ |
+ // Shows the context menu for the guest. |
+ // |items| acts as a filter. This restricts the current context's default |
+ // menu items to contain only the items from |items|. |
+ // |items| == NULL means no filtering will be applied. |
+ virtual void OnShowContextMenu( |
+ int request_id, |
+ const MenuItemVector* items) {} |
+ |
+ // Set current_zoom_factor. |
+ virtual void SetCurrentZoomFactor(double zoom_factor) {} |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(WebViewGuestDelegate); |
+}; |
+ |
+} // namespace extensions |
+ |
+#endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_DELEGATE_H_ |