Index: chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.h |
diff --git a/chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.h b/chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8d0e407253c704abbb900e28c2ac284546414b05 |
--- /dev/null |
+++ b/chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.h |
@@ -0,0 +1,88 @@ |
+// 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 CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_CHROME_WEB_VIEW_GUEST_DELEGATE_H_ |
+#define CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_CHROME_WEB_VIEW_GUEST_DELEGATE_H_ |
+ |
+#include "chrome/browser/guest_view/web_view/web_view_guest.h" |
+#include "extensions/browser/guest_view/web_view/web_view_guest_delegate.h" |
+ |
+#if defined(OS_CHROMEOS) |
+#include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
+#endif |
+ |
+class RenderViewContextMenu; |
+ |
+namespace ui { |
+class SimpleMenuModel; |
+} // namespace ui |
+ |
+class ChromeWebViewGuestDelegate : public extensions::WebViewGuestDelegate { |
+ public : |
+ explicit ChromeWebViewGuestDelegate( |
+ extensions::WebViewGuest* web_view_guest); |
+ virtual ~ChromeWebViewGuestDelegate(); |
+ |
+ // WebViewGuestDelegate implementation. |
+ virtual double GetZoom() OVERRIDE; |
+ virtual void InjectChromeVoxIfNeeded( |
+ content::RenderViewHost* render_view_host) OVERRIDE; |
+ virtual void OnAttachWebViewHelpers(content::WebContents* contents) OVERRIDE; |
+ virtual void OnDidCommitProvisionalLoadForFrame(bool is_main_frame) OVERRIDE; |
+ virtual void OnDidInitialize() OVERRIDE; |
+ virtual void OnGuestDestroyed() OVERRIDE; |
+ virtual extensions::GuestViewBase::Event* OnHandleContextMenu( |
+ const content::ContextMenuParams& params) OVERRIDE; |
+ virtual extensions::GuestViewBase::Event* OnSetZoom( |
+ double zoom_factor, |
+ const std::string& old_zoom_factor, |
+ const std::string& new_zoom_factor, |
+ const std::string& event_zoom_change) OVERRIDE; |
+ virtual void OnShowContextMenu( |
+ int request_id, |
+ const MenuItemVector* items) OVERRIDE; |
+ virtual void SetCurrentZoomFactor(double zoom_factor) OVERRIDE; |
+ |
+ private: |
+ content::WebContents* guest_web_contents() const { |
+ return web_view_guest_->guest_web_contents(); |
+ } |
+ |
+ // Returns the top level items (ignoring submenus) as Value. |
+ static scoped_ptr<base::ListValue> MenuModelToValue( |
+ const ui::SimpleMenuModel& menu_model); |
+ |
+#if defined(OS_CHROMEOS) |
+ // Notification of a change in the state of an accessibility setting. |
+ void OnAccessibilityStatusChanged( |
+ const chromeos::AccessibilityStatusEventDetails& details); |
+#endif |
+ |
+ // A counter to generate a unique request id for a context menu request. |
+ // We only need the ids to be unique for a given WebViewGuest. |
+ int pending_context_menu_request_id_; |
+ |
+ // Set to |true| if ChromeVox was already injected in main frame. |
+ bool chromevox_injected_; |
+ |
+ // Stores the current zoom factor. |
+ double current_zoom_factor_; |
+ |
+ // Holds the RenderViewContextMenu that has been built but yet to be |
+ // shown. This is .Reset() after ShowContextMenu(). |
+ scoped_ptr<RenderViewContextMenu> pending_menu_; |
+ |
+ extensions::WebViewGuest* web_view_guest_; |
+ |
+#if defined(OS_CHROMEOS) |
+ // Subscription to receive notifications on changes to a11y settings. |
+ scoped_ptr<chromeos::AccessibilityStatusSubscription> |
+ accessibility_subscription_; |
+#endif |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ChromeWebViewGuestDelegate); |
+}; |
+ |
+#endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_CHROME_WEB_VIEW_GUEST_DELEGATE_H_ |
+ |