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 CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_CHROME_WEB_VIEW_GUEST_DELEGATE_H_ | 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_ | 6 #define CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_CHROME_WEB_VIEW_GUEST_DELEGATE_H_ |
7 | 7 |
8 #include "chrome/browser/extensions/api/web_view/chrome_web_view_internal_api.h" | 8 #include "chrome/browser/extensions/api/web_view/chrome_web_view_internal_api.h" |
9 #include "extensions/browser/guest_view/web_view/web_view_guest.h" | 9 #include "extensions/browser/guest_view/web_view/web_view_guest.h" |
10 #include "extensions/browser/guest_view/web_view/web_view_guest_delegate.h" | 10 #include "extensions/browser/guest_view/web_view/web_view_guest_delegate.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 namespace extensions { | 22 namespace extensions { |
23 | 23 |
24 class ChromeWebViewGuestDelegate : public WebViewGuestDelegate { | 24 class ChromeWebViewGuestDelegate : public WebViewGuestDelegate { |
25 public : | 25 public : |
26 explicit ChromeWebViewGuestDelegate(WebViewGuest* web_view_guest); | 26 explicit ChromeWebViewGuestDelegate(WebViewGuest* web_view_guest); |
27 ~ChromeWebViewGuestDelegate() override; | 27 ~ChromeWebViewGuestDelegate() override; |
28 | 28 |
29 // WebViewGuestDelegate implementation. | 29 // WebViewGuestDelegate implementation. |
30 bool HandleContextMenu(const content::ContextMenuParams& params) override; | 30 bool HandleContextMenu(const content::ContextMenuParams& params) override; |
31 void OnAttachWebViewHelpers(content::WebContents* contents) override; | 31 void OnAttachWebViewHelpers(content::WebContents* contents) override; |
| 32 void OnDidInitialize() override; |
32 void OnGuestDestroyed() override; | 33 void OnGuestDestroyed() override; |
33 void OnShowContextMenu(int request_id, const MenuItemVector* items) override; | 34 void OnShowContextMenu(int request_id, const MenuItemVector* items) override; |
34 | 35 |
35 WebViewGuest* web_view_guest() const { return web_view_guest_; } | 36 WebViewGuest* web_view_guest() const { return web_view_guest_; } |
36 | 37 |
37 private: | 38 private: |
38 content::WebContents* guest_web_contents() const { | 39 content::WebContents* guest_web_contents() const { |
39 return web_view_guest()->web_contents(); | 40 return web_view_guest()->web_contents(); |
40 } | 41 } |
41 | 42 |
42 // Returns the top level items (ignoring submenus) as Value. | 43 // Returns the top level items (ignoring submenus) as Value. |
43 static scoped_ptr<base::ListValue> MenuModelToValue( | 44 static scoped_ptr<base::ListValue> MenuModelToValue( |
44 const ui::SimpleMenuModel& menu_model); | 45 const ui::SimpleMenuModel& menu_model); |
45 | 46 |
| 47 void InjectChromeVoxIfNeeded(content::RenderViewHost* render_view_host); |
| 48 |
| 49 #if defined(OS_CHROMEOS) |
| 50 // Notification of a change in the state of an accessibility setting. |
| 51 void OnAccessibilityStatusChanged( |
| 52 const chromeos::AccessibilityStatusEventDetails& details); |
| 53 #endif |
| 54 |
46 // A counter to generate a unique request id for a context menu request. | 55 // A counter to generate a unique request id for a context menu request. |
47 // We only need the ids to be unique for a given WebViewGuest. | 56 // We only need the ids to be unique for a given WebViewGuest. |
48 int pending_context_menu_request_id_; | 57 int pending_context_menu_request_id_; |
49 | 58 |
| 59 // Set to |true| if ChromeVox was already injected in main frame. |
| 60 bool chromevox_injected_; |
| 61 |
50 // Holds the RenderViewContextMenuBase that has been built but yet to be | 62 // Holds the RenderViewContextMenuBase that has been built but yet to be |
51 // shown. This is .reset() after ShowContextMenu(). | 63 // shown. This is .reset() after ShowContextMenu(). |
52 scoped_ptr<RenderViewContextMenuBase> pending_menu_; | 64 scoped_ptr<RenderViewContextMenuBase> pending_menu_; |
53 | 65 |
| 66 #if defined(OS_CHROMEOS) |
| 67 // Subscription to receive notifications on changes to a11y settings. |
| 68 scoped_ptr<chromeos::AccessibilityStatusSubscription> |
| 69 accessibility_subscription_; |
| 70 #endif |
| 71 |
54 WebViewGuest* const web_view_guest_; | 72 WebViewGuest* const web_view_guest_; |
55 | 73 |
56 // This is used to ensure pending tasks will not fire after this object is | 74 // This is used to ensure pending tasks will not fire after this object is |
57 // destroyed. | 75 // destroyed. |
58 base::WeakPtrFactory<ChromeWebViewGuestDelegate> weak_ptr_factory_; | 76 base::WeakPtrFactory<ChromeWebViewGuestDelegate> weak_ptr_factory_; |
59 | 77 |
60 DISALLOW_COPY_AND_ASSIGN(ChromeWebViewGuestDelegate); | 78 DISALLOW_COPY_AND_ASSIGN(ChromeWebViewGuestDelegate); |
61 }; | 79 }; |
62 | 80 |
63 } // namespace extensions | 81 } // namespace extensions |
64 | 82 |
65 #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_CHROME_WEB_VIEW_GUEST_DELEGATE_H_ | 83 #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_CHROME_WEB_VIEW_GUEST_DELEGATE_H_ |
| 84 |
OLD | NEW |