Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(797)

Side by Side Diff: chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.h

Issue 787813004: Move ZoomController out of ChromeWebViewGuestDelegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix incorrect wording in comment. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "components/ui/zoom/zoom_observer.h"
10 #include "extensions/browser/guest_view/web_view/web_view_guest.h" 9 #include "extensions/browser/guest_view/web_view/web_view_guest.h"
11 #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"
12 11
13 #if defined(OS_CHROMEOS) 12 #if defined(OS_CHROMEOS)
14 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" 13 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
15 #endif 14 #endif
16 15
17 class RenderViewContextMenuBase; 16 class RenderViewContextMenuBase;
18 17
19 namespace ui { 18 namespace ui {
20 class SimpleMenuModel; 19 class SimpleMenuModel;
21 } // namespace ui 20 } // namespace ui
22 21
23 namespace extensions { 22 namespace extensions {
24 23
25 class ChromeWebViewGuestDelegate : public WebViewGuestDelegate, 24 class ChromeWebViewGuestDelegate : public WebViewGuestDelegate {
26 public ui_zoom::ZoomObserver {
27 public : 25 public :
28 explicit ChromeWebViewGuestDelegate(WebViewGuest* web_view_guest); 26 explicit ChromeWebViewGuestDelegate(WebViewGuest* web_view_guest);
29 ~ChromeWebViewGuestDelegate() override; 27 ~ChromeWebViewGuestDelegate() override;
30 28
31 // WebViewGuestDelegate implementation. 29 // WebViewGuestDelegate implementation.
32 double GetZoom() override;
33 bool HandleContextMenu(const content::ContextMenuParams& params) override; 30 bool HandleContextMenu(const content::ContextMenuParams& params) override;
34 void OnAttachWebViewHelpers(content::WebContents* contents) override; 31 void OnAttachWebViewHelpers(content::WebContents* contents) override;
35 void OnDidAttachToEmbedder() override;
36 void OnDidCommitProvisionalLoadForFrame(bool is_main_frame) override; 32 void OnDidCommitProvisionalLoadForFrame(bool is_main_frame) override;
37 void OnDidInitialize() override; 33 void OnDidInitialize() override;
38 void OnDocumentLoadedInFrame( 34 void OnDocumentLoadedInFrame(
39 content::RenderFrameHost* render_frame_host) override; 35 content::RenderFrameHost* render_frame_host) override;
40 void OnEmbedderWillBeDestroyed() override;
41 void OnGuestDestroyed() override; 36 void OnGuestDestroyed() override;
42 void OnSetZoom(double zoom_factor) override;
43 void OnShowContextMenu(int request_id, const MenuItemVector* items) override; 37 void OnShowContextMenu(int request_id, const MenuItemVector* items) override;
44 38
45 // ZoomObserver implementation.
46 void OnZoomChanged(
47 const ui_zoom::ZoomController::ZoomChangedEventData& data) override;
48
49 WebViewGuest* web_view_guest() const { return web_view_guest_; } 39 WebViewGuest* web_view_guest() const { return web_view_guest_; }
50 40
51 private: 41 private:
52 content::WebContents* guest_web_contents() const { 42 content::WebContents* guest_web_contents() const {
53 return web_view_guest()->web_contents(); 43 return web_view_guest()->web_contents();
54 } 44 }
55 45
56 // Returns the top level items (ignoring submenus) as Value. 46 // Returns the top level items (ignoring submenus) as Value.
57 static scoped_ptr<base::ListValue> MenuModelToValue( 47 static scoped_ptr<base::ListValue> MenuModelToValue(
58 const ui::SimpleMenuModel& menu_model); 48 const ui::SimpleMenuModel& menu_model);
59 49
60 void InjectChromeVoxIfNeeded(content::RenderViewHost* render_view_host); 50 void InjectChromeVoxIfNeeded(content::RenderViewHost* render_view_host);
61 51
62 #if defined(OS_CHROMEOS) 52 #if defined(OS_CHROMEOS)
63 // Notification of a change in the state of an accessibility setting. 53 // Notification of a change in the state of an accessibility setting.
64 void OnAccessibilityStatusChanged( 54 void OnAccessibilityStatusChanged(
65 const chromeos::AccessibilityStatusEventDetails& details); 55 const chromeos::AccessibilityStatusEventDetails& details);
66 #endif 56 #endif
67 57
68 // A counter to generate a unique request id for a context menu request. 58 // A counter to generate a unique request id for a context menu request.
69 // We only need the ids to be unique for a given WebViewGuest. 59 // We only need the ids to be unique for a given WebViewGuest.
70 int pending_context_menu_request_id_; 60 int pending_context_menu_request_id_;
71 61
72 // Set to |true| if ChromeVox was already injected in main frame. 62 // Set to |true| if ChromeVox was already injected in main frame.
73 bool chromevox_injected_; 63 bool chromevox_injected_;
74 64
75 // Stores the current zoom factor.
76 double current_zoom_factor_;
77
78 // Holds the RenderViewContextMenuBase that has been built but yet to be 65 // Holds the RenderViewContextMenuBase that has been built but yet to be
79 // shown. This is .reset() after ShowContextMenu(). 66 // shown. This is .reset() after ShowContextMenu().
80 scoped_ptr<RenderViewContextMenuBase> pending_menu_; 67 scoped_ptr<RenderViewContextMenuBase> pending_menu_;
81 68
82 #if defined(OS_CHROMEOS) 69 #if defined(OS_CHROMEOS)
83 // Subscription to receive notifications on changes to a11y settings. 70 // Subscription to receive notifications on changes to a11y settings.
84 scoped_ptr<chromeos::AccessibilityStatusSubscription> 71 scoped_ptr<chromeos::AccessibilityStatusSubscription>
85 accessibility_subscription_; 72 accessibility_subscription_;
86 #endif 73 #endif
87 74
88 WebViewGuest* const web_view_guest_; 75 WebViewGuest* const web_view_guest_;
89 76
90 // This is used to ensure pending tasks will not fire after this object is 77 // This is used to ensure pending tasks will not fire after this object is
91 // destroyed. 78 // destroyed.
92 base::WeakPtrFactory<ChromeWebViewGuestDelegate> weak_ptr_factory_; 79 base::WeakPtrFactory<ChromeWebViewGuestDelegate> weak_ptr_factory_;
93 80
94 DISALLOW_COPY_AND_ASSIGN(ChromeWebViewGuestDelegate); 81 DISALLOW_COPY_AND_ASSIGN(ChromeWebViewGuestDelegate);
95 }; 82 };
96 83
97 } // namespace extensions 84 } // namespace extensions
98 85
99 #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_CHROME_WEB_VIEW_GUEST_DELEGATE_H_ 86 #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_CHROME_WEB_VIEW_GUEST_DELEGATE_H_
100 87
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698