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

Side by Side Diff: content/renderer/pepper/pepper_webplugin_impl.cc

Issue 63253002: Rename WebKit namespace to blink (part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "content/renderer/pepper/pepper_webplugin_impl.h" 5 #include "content/renderer/pepper/pepper_webplugin_impl.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/debug/crash_logging.h" 9 #include "base/debug/crash_logging.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 14 matching lines...) Expand all
25 #include "third_party/WebKit/public/web/WebDocument.h" 25 #include "third_party/WebKit/public/web/WebDocument.h"
26 #include "third_party/WebKit/public/web/WebElement.h" 26 #include "third_party/WebKit/public/web/WebElement.h"
27 #include "third_party/WebKit/public/web/WebFrame.h" 27 #include "third_party/WebKit/public/web/WebFrame.h"
28 #include "third_party/WebKit/public/web/WebPluginContainer.h" 28 #include "third_party/WebKit/public/web/WebPluginContainer.h"
29 #include "third_party/WebKit/public/web/WebPluginParams.h" 29 #include "third_party/WebKit/public/web/WebPluginParams.h"
30 #include "third_party/WebKit/public/web/WebPrintParams.h" 30 #include "third_party/WebKit/public/web/WebPrintParams.h"
31 #include "third_party/WebKit/public/web/WebPrintScalingOption.h" 31 #include "third_party/WebKit/public/web/WebPrintScalingOption.h"
32 #include "url/gurl.h" 32 #include "url/gurl.h"
33 33
34 using ppapi::NPObjectVar; 34 using ppapi::NPObjectVar;
35 using WebKit::WebCanvas; 35 using blink::WebCanvas;
36 using WebKit::WebPlugin; 36 using blink::WebPlugin;
37 using WebKit::WebPluginContainer; 37 using blink::WebPluginContainer;
38 using WebKit::WebPluginParams; 38 using blink::WebPluginParams;
39 using WebKit::WebPoint; 39 using blink::WebPoint;
40 using WebKit::WebPrintParams; 40 using blink::WebPrintParams;
41 using WebKit::WebRect; 41 using blink::WebRect;
42 using WebKit::WebSize; 42 using blink::WebSize;
43 using WebKit::WebString; 43 using blink::WebString;
44 using WebKit::WebURL; 44 using blink::WebURL;
45 using WebKit::WebVector; 45 using blink::WebVector;
46 46
47 namespace content { 47 namespace content {
48 48
49 struct PepperWebPluginImpl::InitData { 49 struct PepperWebPluginImpl::InitData {
50 scoped_refptr<PluginModule> module; 50 scoped_refptr<PluginModule> module;
51 base::WeakPtr<RenderViewImpl> render_view; 51 base::WeakPtr<RenderViewImpl> render_view;
52 std::vector<std::string> arg_names; 52 std::vector<std::string> arg_names;
53 std::vector<std::string> arg_values; 53 std::vector<std::string> arg_values;
54 GURL url; 54 GURL url;
55 }; 55 };
(...skipping 15 matching lines...) Expand all
71 } 71 }
72 init_data_->url = params.url; 72 init_data_->url = params.url;
73 73
74 // Set subresource URL for crash reporting. 74 // Set subresource URL for crash reporting.
75 base::debug::SetCrashKeyValue("subresource_url", init_data_->url.spec()); 75 base::debug::SetCrashKeyValue("subresource_url", init_data_->url.spec());
76 } 76 }
77 77
78 PepperWebPluginImpl::~PepperWebPluginImpl() { 78 PepperWebPluginImpl::~PepperWebPluginImpl() {
79 } 79 }
80 80
81 WebKit::WebPluginContainer* PepperWebPluginImpl::container() const { 81 blink::WebPluginContainer* PepperWebPluginImpl::container() const {
82 return container_; 82 return container_;
83 } 83 }
84 84
85 bool PepperWebPluginImpl::initialize(WebPluginContainer* container) { 85 bool PepperWebPluginImpl::initialize(WebPluginContainer* container) {
86 // The plugin delegate may have gone away. 86 // The plugin delegate may have gone away.
87 instance_ = init_data_->module->CreateInstance( 87 instance_ = init_data_->module->CreateInstance(
88 init_data_->render_view.get(), container, init_data_->url); 88 init_data_->render_view.get(), container, init_data_->url);
89 if (!instance_.get()) 89 if (!instance_.get())
90 return false; 90 return false;
91 91
92 // Enable script objects for this plugin. 92 // Enable script objects for this plugin.
93 container->allowScriptObjects(); 93 container->allowScriptObjects();
94 94
95 bool success = instance_->Initialize(init_data_->arg_names, 95 bool success = instance_->Initialize(init_data_->arg_names,
96 init_data_->arg_values, 96 init_data_->arg_values,
97 full_frame_); 97 full_frame_);
98 if (!success) { 98 if (!success) {
99 instance_->Delete(); 99 instance_->Delete();
100 instance_ = NULL; 100 instance_ = NULL;
101 101
102 WebKit::WebPlugin* replacement_plugin = 102 blink::WebPlugin* replacement_plugin =
103 GetContentClient()->renderer()->CreatePluginReplacement( 103 GetContentClient()->renderer()->CreatePluginReplacement(
104 init_data_->render_view.get(), init_data_->module->path()); 104 init_data_->render_view.get(), init_data_->module->path());
105 if (!replacement_plugin || !replacement_plugin->initialize(container)) 105 if (!replacement_plugin || !replacement_plugin->initialize(container))
106 return false; 106 return false;
107 107
108 container->setPlugin(replacement_plugin); 108 container->setPlugin(replacement_plugin);
109 return true; 109 return true;
110 } 110 }
111 111
112 init_data_.reset(); 112 init_data_.reset();
(...skipping 27 matching lines...) Expand all
140 return NULL; 140 return NULL;
141 141
142 scoped_refptr<NPObjectVar> object(NPObjectVar::FromPPVar(instance_object_)); 142 scoped_refptr<NPObjectVar> object(NPObjectVar::FromPPVar(instance_object_));
143 // If there's an InstanceObject, tell the Instance's MessageChannel to pass 143 // If there's an InstanceObject, tell the Instance's MessageChannel to pass
144 // any non-postMessage calls to it. 144 // any non-postMessage calls to it.
145 if (object.get()) { 145 if (object.get()) {
146 instance_->message_channel().SetPassthroughObject(object->np_object()); 146 instance_->message_channel().SetPassthroughObject(object->np_object());
147 } 147 }
148 NPObject* message_channel_np_object(instance_->message_channel().np_object()); 148 NPObject* message_channel_np_object(instance_->message_channel().np_object());
149 // The object is expected to be retained before it is returned. 149 // The object is expected to be retained before it is returned.
150 WebKit::WebBindings::retainObject(message_channel_np_object); 150 blink::WebBindings::retainObject(message_channel_np_object);
151 return message_channel_np_object; 151 return message_channel_np_object;
152 } 152 }
153 153
154 NPP PepperWebPluginImpl::pluginNPP() { 154 NPP PepperWebPluginImpl::pluginNPP() {
155 return instance_->instanceNPP(); 155 return instance_->instanceNPP();
156 } 156 }
157 157
158 bool PepperWebPluginImpl::getFormValue(WebString& value) { 158 bool PepperWebPluginImpl::getFormValue(WebString& value) {
159 return false; 159 return false;
160 } 160 }
(...skipping 21 matching lines...) Expand all
182 instance_->SetWebKitFocus(focused); 182 instance_->SetWebKitFocus(focused);
183 } 183 }
184 184
185 void PepperWebPluginImpl::updateVisibility(bool visible) { 185 void PepperWebPluginImpl::updateVisibility(bool visible) {
186 } 186 }
187 187
188 bool PepperWebPluginImpl::acceptsInputEvents() { 188 bool PepperWebPluginImpl::acceptsInputEvents() {
189 return true; 189 return true;
190 } 190 }
191 191
192 bool PepperWebPluginImpl::handleInputEvent(const WebKit::WebInputEvent& event, 192 bool PepperWebPluginImpl::handleInputEvent(const blink::WebInputEvent& event,
193 WebKit::WebCursorInfo& cursor_info) { 193 blink::WebCursorInfo& cursor_info) {
194 if (instance_->FlashIsFullscreenOrPending()) 194 if (instance_->FlashIsFullscreenOrPending())
195 return false; 195 return false;
196 return instance_->HandleInputEvent(event, &cursor_info); 196 return instance_->HandleInputEvent(event, &cursor_info);
197 } 197 }
198 198
199 void PepperWebPluginImpl::didReceiveResponse( 199 void PepperWebPluginImpl::didReceiveResponse(
200 const WebKit::WebURLResponse& response) { 200 const blink::WebURLResponse& response) {
201 DCHECK(!instance_->document_loader()); 201 DCHECK(!instance_->document_loader());
202 instance_->HandleDocumentLoad(response); 202 instance_->HandleDocumentLoad(response);
203 } 203 }
204 204
205 void PepperWebPluginImpl::didReceiveData(const char* data, int data_length) { 205 void PepperWebPluginImpl::didReceiveData(const char* data, int data_length) {
206 WebKit::WebURLLoaderClient* document_loader = instance_->document_loader(); 206 blink::WebURLLoaderClient* document_loader = instance_->document_loader();
207 if (document_loader) 207 if (document_loader)
208 document_loader->didReceiveData(NULL, data, data_length, 0); 208 document_loader->didReceiveData(NULL, data, data_length, 0);
209 } 209 }
210 210
211 void PepperWebPluginImpl::didFinishLoading() { 211 void PepperWebPluginImpl::didFinishLoading() {
212 WebKit::WebURLLoaderClient* document_loader = instance_->document_loader(); 212 blink::WebURLLoaderClient* document_loader = instance_->document_loader();
213 if (document_loader) 213 if (document_loader)
214 document_loader->didFinishLoading(NULL, 0.0); 214 document_loader->didFinishLoading(NULL, 0.0);
215 } 215 }
216 216
217 void PepperWebPluginImpl::didFailLoading(const WebKit::WebURLError& error) { 217 void PepperWebPluginImpl::didFailLoading(const blink::WebURLError& error) {
218 WebKit::WebURLLoaderClient* document_loader = instance_->document_loader(); 218 blink::WebURLLoaderClient* document_loader = instance_->document_loader();
219 if (document_loader) 219 if (document_loader)
220 document_loader->didFail(NULL, error); 220 document_loader->didFail(NULL, error);
221 } 221 }
222 222
223 void PepperWebPluginImpl::didFinishLoadingFrameRequest( 223 void PepperWebPluginImpl::didFinishLoadingFrameRequest(
224 const WebKit::WebURL& url, 224 const blink::WebURL& url,
225 void* notify_data) { 225 void* notify_data) {
226 } 226 }
227 227
228 void PepperWebPluginImpl::didFailLoadingFrameRequest( 228 void PepperWebPluginImpl::didFailLoadingFrameRequest(
229 const WebKit::WebURL& url, 229 const blink::WebURL& url,
230 void* notify_data, 230 void* notify_data,
231 const WebKit::WebURLError& error) { 231 const blink::WebURLError& error) {
232 } 232 }
233 233
234 bool PepperWebPluginImpl::hasSelection() const { 234 bool PepperWebPluginImpl::hasSelection() const {
235 return !selectionAsText().isEmpty(); 235 return !selectionAsText().isEmpty();
236 } 236 }
237 237
238 WebString PepperWebPluginImpl::selectionAsText() const { 238 WebString PepperWebPluginImpl::selectionAsText() const {
239 return instance_->GetSelectedText(false); 239 return instance_->GetSelectedText(false);
240 } 240 }
241 241
242 WebString PepperWebPluginImpl::selectionAsMarkup() const { 242 WebString PepperWebPluginImpl::selectionAsMarkup() const {
243 return instance_->GetSelectedText(true); 243 return instance_->GetSelectedText(true);
244 } 244 }
245 245
246 WebURL PepperWebPluginImpl::linkAtPosition(const WebPoint& position) const { 246 WebURL PepperWebPluginImpl::linkAtPosition(const WebPoint& position) const {
247 return GURL(instance_->GetLinkAtPosition(position)); 247 return GURL(instance_->GetLinkAtPosition(position));
248 } 248 }
249 249
250 void PepperWebPluginImpl::setZoomLevel(double level, bool text_only) { 250 void PepperWebPluginImpl::setZoomLevel(double level, bool text_only) {
251 instance_->Zoom(content::ZoomLevelToZoomFactor(level), text_only); 251 instance_->Zoom(content::ZoomLevelToZoomFactor(level), text_only);
252 } 252 }
253 253
254 bool PepperWebPluginImpl::startFind(const WebKit::WebString& search_text, 254 bool PepperWebPluginImpl::startFind(const blink::WebString& search_text,
255 bool case_sensitive, 255 bool case_sensitive,
256 int identifier) { 256 int identifier) {
257 return instance_->StartFind(search_text, case_sensitive, identifier); 257 return instance_->StartFind(search_text, case_sensitive, identifier);
258 } 258 }
259 259
260 void PepperWebPluginImpl::selectFindResult(bool forward) { 260 void PepperWebPluginImpl::selectFindResult(bool forward) {
261 instance_->SelectFindResult(forward); 261 instance_->SelectFindResult(forward);
262 } 262 }
263 263
264 void PepperWebPluginImpl::stopFind() { 264 void PepperWebPluginImpl::stopFind() {
265 instance_->StopFind(); 265 instance_->StopFind();
266 } 266 }
267 267
268 bool PepperWebPluginImpl::supportsPaginatedPrint() { 268 bool PepperWebPluginImpl::supportsPaginatedPrint() {
269 return instance_->SupportsPrintInterface(); 269 return instance_->SupportsPrintInterface();
270 } 270 }
271 271
272 bool PepperWebPluginImpl::isPrintScalingDisabled() { 272 bool PepperWebPluginImpl::isPrintScalingDisabled() {
273 return instance_->IsPrintScalingDisabled(); 273 return instance_->IsPrintScalingDisabled();
274 } 274 }
275 275
276 int PepperWebPluginImpl::printBegin(const WebPrintParams& print_params) { 276 int PepperWebPluginImpl::printBegin(const WebPrintParams& print_params) {
277 return instance_->PrintBegin(print_params); 277 return instance_->PrintBegin(print_params);
278 } 278 }
279 279
280 bool PepperWebPluginImpl::printPage(int page_number, 280 bool PepperWebPluginImpl::printPage(int page_number,
281 WebKit::WebCanvas* canvas) { 281 blink::WebCanvas* canvas) {
282 return instance_->PrintPage(page_number, canvas); 282 return instance_->PrintPage(page_number, canvas);
283 } 283 }
284 284
285 void PepperWebPluginImpl::printEnd() { 285 void PepperWebPluginImpl::printEnd() {
286 return instance_->PrintEnd(); 286 return instance_->PrintEnd();
287 } 287 }
288 288
289 bool PepperWebPluginImpl::canRotateView() { 289 bool PepperWebPluginImpl::canRotateView() {
290 return instance_->CanRotateView(); 290 return instance_->CanRotateView();
291 } 291 }
292 292
293 void PepperWebPluginImpl::rotateView(RotationType type) { 293 void PepperWebPluginImpl::rotateView(RotationType type) {
294 instance_->RotateView(type); 294 instance_->RotateView(type);
295 } 295 }
296 296
297 bool PepperWebPluginImpl::isPlaceholder() { 297 bool PepperWebPluginImpl::isPlaceholder() {
298 return false; 298 return false;
299 } 299 }
300 300
301 } // namespace content 301 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_webplugin_impl.h ('k') | content/renderer/pepper/pepper_websocket_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698