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

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

Issue 496873006: Move core web_view code to extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove dependency of web_view_internal_api.h Created 6 years, 3 months 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
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/guest_view/web_view/web_view_guest.h" 8 #include "chrome/browser/extensions/api/web_view/web_view_internal_api.h"
9 #include "chrome/browser/guest_view/web_view/web_view_find_helper.h"
10 #include "extensions/browser/guest_view/web_view/web_view_guest.h"
9 #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"
10 12
11 #if defined(OS_CHROMEOS) 13 #if defined(OS_CHROMEOS)
12 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" 14 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
13 #endif 15 #endif
14 16
15 class RenderViewContextMenu; 17 class RenderViewContextMenu;
16 18
17 namespace ui { 19 namespace ui {
18 class SimpleMenuModel; 20 class SimpleMenuModel;
19 } // namespace ui 21 } // namespace ui
20 22
21 class ChromeWebViewGuestDelegate : public extensions::WebViewGuestDelegate { 23 class ChromeWebViewGuestDelegate : public extensions::WebViewGuestDelegate {
22 public : 24 public :
23 explicit ChromeWebViewGuestDelegate( 25 explicit ChromeWebViewGuestDelegate(
24 extensions::WebViewGuest* web_view_guest); 26 extensions::WebViewGuest* web_view_guest);
25 virtual ~ChromeWebViewGuestDelegate(); 27 virtual ~ChromeWebViewGuestDelegate();
26 28
27 // WebViewGuestDelegate implementation. 29 // WebViewGuestDelegate implementation.
30 virtual void Find(
31 const base::string16& search_text,
32 const blink::WebFindOptions& options,
33 extensions::WebViewInternalFindFunction* find_function)
34 OVERRIDE;
35 virtual void FindReply(content::WebContents* source,
36 int request_id,
37 int number_of_matches,
38 const gfx::Rect& selection_rect,
39 int active_match_ordinal,
40 bool final_update) OVERRIDE;
28 virtual double GetZoom() OVERRIDE; 41 virtual double GetZoom() OVERRIDE;
29 virtual bool HandleContextMenu( 42 virtual bool HandleContextMenu(
30 const content::ContextMenuParams& params) OVERRIDE; 43 const content::ContextMenuParams& params) OVERRIDE;
31 virtual void OnAttachWebViewHelpers(content::WebContents* contents) OVERRIDE; 44 virtual void OnAttachWebViewHelpers(content::WebContents* contents) OVERRIDE;
45 virtual void OnEmbedderDestroyed() OVERRIDE;
32 virtual void OnDidCommitProvisionalLoadForFrame(bool is_main_frame) OVERRIDE; 46 virtual void OnDidCommitProvisionalLoadForFrame(bool is_main_frame) OVERRIDE;
33 virtual void OnDidInitialize() OVERRIDE; 47 virtual void OnDidInitialize() OVERRIDE;
34 virtual void OnDocumentLoadedInFrame( 48 virtual void OnDocumentLoadedInFrame(
35 content::RenderFrameHost* render_frame_host) OVERRIDE; 49 content::RenderFrameHost* render_frame_host) OVERRIDE;
36 virtual void OnGuestDestroyed() OVERRIDE; 50 virtual void OnGuestDestroyed() OVERRIDE;
51 virtual void OnRenderProcessGone() OVERRIDE;
37 virtual void OnSetZoom(double zoom_factor) OVERRIDE; 52 virtual void OnSetZoom(double zoom_factor) OVERRIDE;
38 virtual void OnShowContextMenu( 53 virtual void OnShowContextMenu(
39 int request_id, 54 int request_id,
40 const MenuItemVector* items) OVERRIDE; 55 const MenuItemVector* items) OVERRIDE;
56 virtual void StopFinding(content::StopFindAction) OVERRIDE;
41 57
42 private: 58 private:
59 friend void extensions::WebViewFindHelper::DispatchFindUpdateEvent(
60 bool canceled,
61 bool final_update);
62
43 content::WebContents* guest_web_contents() const { 63 content::WebContents* guest_web_contents() const {
44 return web_view_guest_->guest_web_contents(); 64 return web_view_guest()->guest_web_contents();
45 } 65 }
46 66
47 // Returns the top level items (ignoring submenus) as Value. 67 // Returns the top level items (ignoring submenus) as Value.
48 static scoped_ptr<base::ListValue> MenuModelToValue( 68 static scoped_ptr<base::ListValue> MenuModelToValue(
49 const ui::SimpleMenuModel& menu_model); 69 const ui::SimpleMenuModel& menu_model);
50 70
51 void InjectChromeVoxIfNeeded(content::RenderViewHost* render_view_host); 71 void InjectChromeVoxIfNeeded(content::RenderViewHost* render_view_host);
52 72
53 #if defined(OS_CHROMEOS) 73 #if defined(OS_CHROMEOS)
54 // Notification of a change in the state of an accessibility setting. 74 // Notification of a change in the state of an accessibility setting.
55 void OnAccessibilityStatusChanged( 75 void OnAccessibilityStatusChanged(
56 const chromeos::AccessibilityStatusEventDetails& details); 76 const chromeos::AccessibilityStatusEventDetails& details);
57 #endif 77 #endif
58 78
79 // Handles find requests and replies for the webview find API.
80 extensions::WebViewFindHelper find_helper_;
81
59 // A counter to generate a unique request id for a context menu request. 82 // A counter to generate a unique request id for a context menu request.
60 // We only need the ids to be unique for a given WebViewGuest. 83 // We only need the ids to be unique for a given WebViewGuest.
61 int pending_context_menu_request_id_; 84 int pending_context_menu_request_id_;
62 85
63 // Set to |true| if ChromeVox was already injected in main frame. 86 // Set to |true| if ChromeVox was already injected in main frame.
64 bool chromevox_injected_; 87 bool chromevox_injected_;
65 88
66 // Stores the current zoom factor. 89 // Stores the current zoom factor.
67 double current_zoom_factor_; 90 double current_zoom_factor_;
68 91
69 // Holds the RenderViewContextMenu that has been built but yet to be 92 // Holds the RenderViewContextMenu that has been built but yet to be
70 // shown. This is .Reset() after ShowContextMenu(). 93 // shown. This is .Reset() after ShowContextMenu().
71 scoped_ptr<RenderViewContextMenu> pending_menu_; 94 scoped_ptr<RenderViewContextMenu> pending_menu_;
72 95
73 extensions::WebViewGuest* web_view_guest_;
74
75 #if defined(OS_CHROMEOS) 96 #if defined(OS_CHROMEOS)
76 // Subscription to receive notifications on changes to a11y settings. 97 // Subscription to receive notifications on changes to a11y settings.
77 scoped_ptr<chromeos::AccessibilityStatusSubscription> 98 scoped_ptr<chromeos::AccessibilityStatusSubscription>
78 accessibility_subscription_; 99 accessibility_subscription_;
79 #endif 100 #endif
80 101
81 DISALLOW_COPY_AND_ASSIGN(ChromeWebViewGuestDelegate); 102 DISALLOW_COPY_AND_ASSIGN(ChromeWebViewGuestDelegate);
82 }; 103 };
83 104
84 #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_CHROME_WEB_VIEW_GUEST_DELEGATE_H_ 105 #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_CHROME_WEB_VIEW_GUEST_DELEGATE_H_
85 106
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698