Chromium Code Reviews| 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 CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_CHROME_WEB_VIEW_GUEST_DELEGATE_H_ | |
| 6 #define CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_CHROME_WEB_VIEW_GUEST_DELEGATE_H_ | |
| 7 | |
| 8 #include "chrome/browser/guest_view/web_view/web_view_guest.h" | |
| 9 #include "extensions/browser/guest_view/web_view/web_view_guest_delegate.h" | |
| 10 | |
| 11 #if defined(OS_CHROMEOS) | |
| 12 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | |
| 13 #endif | |
| 14 | |
| 15 class RenderViewContextMenu; | |
| 16 | |
| 17 namespace ui { | |
| 18 class SimpleMenuModel; | |
| 19 } // namespace ui | |
| 20 | |
| 21 class ChromeWebViewGuestDelegate : public extensions::WebViewGuestDelegate { | |
| 22 public : | |
| 23 explicit ChromeWebViewGuestDelegate( | |
| 24 const extensions::WebViewGuest& web_view_guest); | |
|
Fady Samuel
2014/08/18 20:11:22
I feel like this should be a pointer to allow for
Xi Han
2014/08/18 22:23:57
Done.
| |
| 25 virtual ~ChromeWebViewGuestDelegate(); | |
| 26 | |
| 27 // WebViewGuestDelegate implementation. | |
| 28 virtual void OnDidInitialize() OVERRIDE; | |
|
Fady Samuel
2014/08/18 20:11:22
Huge nitpick: Could we please put this in alphabet
Xi Han
2014/08/18 22:23:57
Done.
| |
| 29 virtual void OnAttachWebViewHelpers(content::WebContents* contents) OVERRIDE; | |
| 30 virtual extensions::GuestViewBase::Event* OnHandleContextMenu( | |
| 31 const content::ContextMenuParams& params) OVERRIDE; | |
| 32 virtual double GetZoomLevel() OVERRIDE; | |
| 33 virtual void OnDidCommitProvisionalLoadForFrame(bool is_main_frame) OVERRIDE; | |
| 34 virtual void OnSetZoom(double zoom_factor) OVERRIDE; | |
| 35 virtual void OnShowContextMenu( | |
| 36 int request_id, | |
| 37 const MenuItemVector* items) OVERRIDE; | |
| 38 virtual void OnGuestDestroyed() OVERRIDE; | |
| 39 virtual void InjectChromeVoxIfNeeded( | |
| 40 content::RenderViewHost* render_view_host) OVERRIDE; | |
| 41 | |
| 42 private: | |
| 43 content::WebContents* guest_web_contents() const { | |
| 44 return web_view_guest_.guest_web_contents(); | |
| 45 } | |
| 46 | |
| 47 // Returns the top level items (ignoring submenus) as Value. | |
| 48 static scoped_ptr<base::ListValue> MenuModelToValue( | |
| 49 const ui::SimpleMenuModel& menu_model); | |
| 50 | |
| 51 #if defined(OS_CHROMEOS) | |
| 52 // Notification of a change in the state of an accessibility setting. | |
| 53 void OnAccessibilityStatusChanged( | |
| 54 const chromeos::AccessibilityStatusEventDetails& details); | |
| 55 #endif | |
| 56 | |
| 57 // A counter to generate a unique request id for a context menu request. | |
| 58 // We only need the ids to be unique for a given WebViewGuest. | |
| 59 int pending_context_menu_request_id_; | |
| 60 | |
| 61 // Set to |true| if ChromeVox was already injected in main frame. | |
| 62 bool chromevox_injected_; | |
| 63 | |
| 64 // Stores the current zoom factor. | |
| 65 double current_zoom_factor_; | |
| 66 | |
| 67 // Holds the RenderViewContextMenu that has been built but yet to be | |
| 68 // shown. This is .Reset() after ShowContextMenu(). | |
| 69 scoped_ptr<RenderViewContextMenu> pending_menu_; | |
| 70 | |
| 71 const extensions::WebViewGuest& web_view_guest_; | |
| 72 | |
| 73 #if defined(OS_CHROMEOS) | |
| 74 // Subscription to receive notifications on changes to a11y settings. | |
| 75 scoped_ptr<chromeos::AccessibilityStatusSubscription> | |
| 76 accessibility_subscription_; | |
| 77 #endif | |
| 78 | |
| 79 DISALLOW_COPY_AND_ASSIGN(ChromeWebViewGuestDelegate); | |
| 80 }; | |
| 81 | |
| 82 #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_CHROME_WEB_VIEW_GUEST_DELEGATE_H_ | |
| 83 | |
| OLD | NEW |