| 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 "chrome/browser/ui/zoom/zoom_observer.h" | 9 #include "components/ui/zoom/zoom_observer.h" |
| 10 #include "extensions/browser/guest_view/web_view/web_view_guest.h" | 10 #include "extensions/browser/guest_view/web_view/web_view_guest.h" |
| 11 #include "extensions/browser/guest_view/web_view/web_view_guest_delegate.h" | 11 #include "extensions/browser/guest_view/web_view/web_view_guest_delegate.h" |
| 12 | 12 |
| 13 #if defined(OS_CHROMEOS) | 13 #if defined(OS_CHROMEOS) |
| 14 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 14 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 15 #endif | 15 #endif |
| 16 | 16 |
| 17 class RenderViewContextMenuBase; | 17 class RenderViewContextMenuBase; |
| 18 | 18 |
| 19 namespace ui { | 19 namespace ui { |
| 20 class SimpleMenuModel; | 20 class SimpleMenuModel; |
| 21 } // namespace ui | 21 } // namespace ui |
| 22 | 22 |
| 23 namespace extensions { | 23 namespace extensions { |
| 24 | 24 |
| 25 class ChromeWebViewGuestDelegate : public WebViewGuestDelegate, | 25 class ChromeWebViewGuestDelegate : public WebViewGuestDelegate, |
| 26 public ZoomObserver { | 26 public components::ZoomObserver { |
| 27 public : | 27 public : |
| 28 explicit ChromeWebViewGuestDelegate(WebViewGuest* web_view_guest); | 28 explicit ChromeWebViewGuestDelegate(WebViewGuest* web_view_guest); |
| 29 ~ChromeWebViewGuestDelegate() override; | 29 ~ChromeWebViewGuestDelegate() override; |
| 30 | 30 |
| 31 // WebViewGuestDelegate implementation. | 31 // WebViewGuestDelegate implementation. |
| 32 double GetZoom() override; | 32 double GetZoom() override; |
| 33 bool HandleContextMenu(const content::ContextMenuParams& params) override; | 33 bool HandleContextMenu(const content::ContextMenuParams& params) override; |
| 34 void OnAttachWebViewHelpers(content::WebContents* contents) override; | 34 void OnAttachWebViewHelpers(content::WebContents* contents) override; |
| 35 void OnDidAttachToEmbedder() override; | 35 void OnDidAttachToEmbedder() override; |
| 36 void OnDidCommitProvisionalLoadForFrame(bool is_main_frame) override; | 36 void OnDidCommitProvisionalLoadForFrame(bool is_main_frame) override; |
| 37 void OnDidInitialize() override; | 37 void OnDidInitialize() override; |
| 38 void OnDocumentLoadedInFrame( | 38 void OnDocumentLoadedInFrame( |
| 39 content::RenderFrameHost* render_frame_host) override; | 39 content::RenderFrameHost* render_frame_host) override; |
| 40 void OnEmbedderWillBeDestroyed() override; | 40 void OnEmbedderWillBeDestroyed() override; |
| 41 void OnGuestDestroyed() override; | 41 void OnGuestDestroyed() override; |
| 42 void OnSetZoom(double zoom_factor) override; | 42 void OnSetZoom(double zoom_factor) override; |
| 43 void OnShowContextMenu(int request_id, const MenuItemVector* items) override; | 43 void OnShowContextMenu(int request_id, const MenuItemVector* items) override; |
| 44 | 44 |
| 45 // ZoomObserver implementation. | 45 // ZoomObserver implementation. |
| 46 void OnZoomChanged(const ZoomController::ZoomChangedEventData& data) override; | 46 void OnZoomChanged( |
| 47 const components::ZoomController::ZoomChangedEventData& data) override; |
| 47 | 48 |
| 48 WebViewGuest* web_view_guest() const { return web_view_guest_; } | 49 WebViewGuest* web_view_guest() const { return web_view_guest_; } |
| 49 | 50 |
| 50 private: | 51 private: |
| 51 content::WebContents* guest_web_contents() const { | 52 content::WebContents* guest_web_contents() const { |
| 52 return web_view_guest()->web_contents(); | 53 return web_view_guest()->web_contents(); |
| 53 } | 54 } |
| 54 | 55 |
| 55 // Returns the top level items (ignoring submenus) as Value. | 56 // Returns the top level items (ignoring submenus) as Value. |
| 56 static scoped_ptr<base::ListValue> MenuModelToValue( | 57 static scoped_ptr<base::ListValue> MenuModelToValue( |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // destroyed. | 91 // destroyed. |
| 91 base::WeakPtrFactory<ChromeWebViewGuestDelegate> weak_ptr_factory_; | 92 base::WeakPtrFactory<ChromeWebViewGuestDelegate> weak_ptr_factory_; |
| 92 | 93 |
| 93 DISALLOW_COPY_AND_ASSIGN(ChromeWebViewGuestDelegate); | 94 DISALLOW_COPY_AND_ASSIGN(ChromeWebViewGuestDelegate); |
| 94 }; | 95 }; |
| 95 | 96 |
| 96 } // namespace extensions | 97 } // namespace extensions |
| 97 | 98 |
| 98 #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_CHROME_WEB_VIEW_GUEST_DELEGATE_H_ | 99 #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_CHROME_WEB_VIEW_GUEST_DELEGATE_H_ |
| 99 | 100 |
| OLD | NEW |