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

Side by Side Diff: components/plugins/renderer/webview_plugin.h

Issue 2923433002: Move ExecuteScript method from WebFrame to WebLocalFrame. (Closed)
Patch Set: Tweaked a comment in WebViewPlugin::WebViewHelper::main_frame [as suggested in CR feedback] Created 3 years, 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_ 5 #ifndef COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_
6 #define COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_ 6 #define COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_
7 7
8 #include <list> 8 #include <list>
9 #include <memory> 9 #include <memory>
10 10
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/sequenced_task_runner_helpers.h" 12 #include "base/sequenced_task_runner_helpers.h"
13 #include "content/public/renderer/render_view_observer.h" 13 #include "content/public/renderer/render_view_observer.h"
14 #include "third_party/WebKit/public/platform/WebCursorInfo.h" 14 #include "third_party/WebKit/public/platform/WebCursorInfo.h"
15 #include "third_party/WebKit/public/platform/WebString.h" 15 #include "third_party/WebKit/public/platform/WebString.h"
16 #include "third_party/WebKit/public/platform/WebURLResponse.h" 16 #include "third_party/WebKit/public/platform/WebURLResponse.h"
17 #include "third_party/WebKit/public/web/WebFrameClient.h" 17 #include "third_party/WebKit/public/web/WebFrameClient.h"
18 #include "third_party/WebKit/public/web/WebKit.h" 18 #include "third_party/WebKit/public/web/WebKit.h"
19 #include "third_party/WebKit/public/web/WebPlugin.h" 19 #include "third_party/WebKit/public/web/WebPlugin.h"
20 #include "third_party/WebKit/public/web/WebViewClient.h" 20 #include "third_party/WebKit/public/web/WebViewClient.h"
21 21
22 namespace blink { 22 namespace blink {
23 class WebLocalFrame;
23 class WebMouseEvent; 24 class WebMouseEvent;
24 } 25 }
25 26
26 namespace content { 27 namespace content {
27 class RenderView; 28 class RenderView;
28 struct WebPreferences; 29 struct WebPreferences;
29 } 30 }
30 31
31 // This class implements the WebPlugin interface by forwarding drawing and 32 // This class implements the WebPlugin interface by forwarding drawing and
32 // handling input events to a WebView. 33 // handling input events to a WebView.
(...skipping 28 matching lines...) Expand all
61 62
62 // Convenience method to set up a new WebViewPlugin using |preferences| 63 // Convenience method to set up a new WebViewPlugin using |preferences|
63 // and displaying |html_data|. |url| should be a (fake) data:text/html URL; 64 // and displaying |html_data|. |url| should be a (fake) data:text/html URL;
64 // it is only used for navigation and never actually resolved. 65 // it is only used for navigation and never actually resolved.
65 static WebViewPlugin* Create(content::RenderView* render_view, 66 static WebViewPlugin* Create(content::RenderView* render_view,
66 Delegate* delegate, 67 Delegate* delegate,
67 const content::WebPreferences& preferences, 68 const content::WebPreferences& preferences,
68 const std::string& html_data, 69 const std::string& html_data,
69 const GURL& url); 70 const GURL& url);
70 71
71 blink::WebView* web_view() { return web_view_helper_.web_view(); } 72 blink::WebLocalFrame* main_frame() { return web_view_helper_.main_frame(); }
72 73
73 const blink::WebString& old_title() const { return old_title_; } 74 const blink::WebString& old_title() const { return old_title_; }
74 75
75 // When loading a plugin document (i.e. a full page plugin not embedded in 76 // When loading a plugin document (i.e. a full page plugin not embedded in
76 // another page), we save all data that has been received, and replay it with 77 // another page), we save all data that has been received, and replay it with
77 // this method on the actual plugin. 78 // this method on the actual plugin.
78 void ReplayReceivedData(blink::WebPlugin* plugin); 79 void ReplayReceivedData(blink::WebPlugin* plugin);
79 80
80 // WebPlugin methods: 81 // WebPlugin methods:
81 blink::WebPluginContainer* Container() const override; 82 blink::WebPluginContainer* Container() const override;
(...skipping 27 matching lines...) Expand all
109 void DidFinishLoading() override; 110 void DidFinishLoading() override;
110 void DidFailLoading(const blink::WebURLError& error) override; 111 void DidFailLoading(const blink::WebURLError& error) override;
111 112
112 private: 113 private:
113 friend class base::DeleteHelper<WebViewPlugin>; 114 friend class base::DeleteHelper<WebViewPlugin>;
114 WebViewPlugin(content::RenderView* render_view, 115 WebViewPlugin(content::RenderView* render_view,
115 Delegate* delegate, 116 Delegate* delegate,
116 const content::WebPreferences& preferences); 117 const content::WebPreferences& preferences);
117 ~WebViewPlugin() override; 118 ~WebViewPlugin() override;
118 119
120 blink::WebView* web_view() { return web_view_helper_.web_view(); }
121
119 // content::RenderViewObserver methods: 122 // content::RenderViewObserver methods:
120 void OnDestruct() override {} 123 void OnDestruct() override {}
121 void OnZoomLevelChanged() override; 124 void OnZoomLevelChanged() override;
122 125
123 void UpdatePluginForNewGeometry(const blink::WebRect& window_rect, 126 void UpdatePluginForNewGeometry(const blink::WebRect& window_rect,
124 const blink::WebRect& unobscured_rect); 127 const blink::WebRect& unobscured_rect);
125 128
126 // Manages its own lifetime. 129 // Manages its own lifetime.
127 Delegate* delegate_; 130 Delegate* delegate_;
128 131
(...skipping 15 matching lines...) Expand all
144 147
145 // A helper that handles interaction from WebViewPlugin's internal WebView. 148 // A helper that handles interaction from WebViewPlugin's internal WebView.
146 class WebViewHelper : public blink::WebViewClient, 149 class WebViewHelper : public blink::WebViewClient,
147 public blink::WebFrameClient { 150 public blink::WebFrameClient {
148 public: 151 public:
149 WebViewHelper(WebViewPlugin* plugin, 152 WebViewHelper(WebViewPlugin* plugin,
150 const content::WebPreferences& preferences); 153 const content::WebPreferences& preferences);
151 ~WebViewHelper() override; 154 ~WebViewHelper() override;
152 155
153 blink::WebView* web_view() { return web_view_; } 156 blink::WebView* web_view() { return web_view_; }
157 blink::WebLocalFrame* main_frame();
154 158
155 // WebViewClient methods: 159 // WebViewClient methods:
156 bool AcceptsLoadDrops() override; 160 bool AcceptsLoadDrops() override;
157 bool CanHandleGestureEvent() override; 161 bool CanHandleGestureEvent() override;
158 bool CanUpdateLayout() override; 162 bool CanUpdateLayout() override;
159 163
160 // WebWidgetClient methods: 164 // WebWidgetClient methods:
161 void SetToolTipText(const blink::WebString&, 165 void SetToolTipText(const blink::WebString&,
162 blink::WebTextDirection) override; 166 blink::WebTextDirection) override;
163 void StartDragging(blink::WebReferrerPolicy, 167 void StartDragging(blink::WebReferrerPolicy,
(...skipping 19 matching lines...) Expand all
183 // Owned by us, deleted via |close()|. 187 // Owned by us, deleted via |close()|.
184 blink::WebView* web_view_; 188 blink::WebView* web_view_;
185 }; 189 };
186 WebViewHelper web_view_helper_; 190 WebViewHelper web_view_helper_;
187 191
188 // Should be invalidated when destroy() is called. 192 // Should be invalidated when destroy() is called.
189 base::WeakPtrFactory<WebViewPlugin> weak_factory_; 193 base::WeakPtrFactory<WebViewPlugin> weak_factory_;
190 }; 194 };
191 195
192 #endif // COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_ 196 #endif // COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_
OLDNEW
« no previous file with comments | « components/plugins/renderer/loadable_plugin_placeholder.cc ('k') | components/plugins/renderer/webview_plugin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698