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

Side by Side Diff: chrome/plugin/webplugin_delegate_stub.cc

Issue 6594121: Revert 76553 - Applying factory pattern (through NativeMetafileFactory class)... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/common_param_traits_unittest.cc ('k') | chrome/renderer/mock_printer.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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "chrome/plugin/webplugin_delegate_stub.h" 5 #include "chrome/plugin/webplugin_delegate_stub.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "chrome/common/child_process_logging.h" 10 #include "chrome/common/child_process_logging.h"
11 #include "chrome/common/chrome_switches.h" 11 #include "chrome/common/chrome_switches.h"
12 #include "chrome/common/plugin_messages.h" 12 #include "chrome/common/plugin_messages.h"
13 #include "chrome/plugin/npobject_stub.h" 13 #include "chrome/plugin/npobject_stub.h"
14 #include "chrome/plugin/plugin_channel.h" 14 #include "chrome/plugin/plugin_channel.h"
15 #include "chrome/plugin/plugin_thread.h" 15 #include "chrome/plugin/plugin_thread.h"
16 #include "chrome/plugin/webplugin_proxy.h" 16 #include "chrome/plugin/webplugin_proxy.h"
17 #include "printing/native_metafile.h"
17 #include "third_party/npapi/bindings/npapi.h" 18 #include "third_party/npapi/bindings/npapi.h"
18 #include "third_party/npapi/bindings/npruntime.h" 19 #include "third_party/npapi/bindings/npruntime.h"
19 #include "skia/ext/platform_device.h" 20 #include "skia/ext/platform_device.h"
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h"
21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h"
22 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" 23 #include "webkit/plugins/npapi/webplugin_delegate_impl.h"
23 #include "webkit/glue/webcursor.h" 24 #include "webkit/glue/webcursor.h"
24 25
25 #if defined(OS_WIN)
26 #include "base/scoped_ptr.h"
27 #include "printing/native_metafile_factory.h"
28 #include "printing/native_metafile.h"
29 #endif // defined(OS_WIN)
30
31 #if defined(ENABLE_GPU) 26 #if defined(ENABLE_GPU)
32 #include "app/gfx/gl/gl_context.h" 27 #include "app/gfx/gl/gl_context.h"
33 #endif 28 #endif
34 29
35 using WebKit::WebBindings; 30 using WebKit::WebBindings;
36 using WebKit::WebCursorInfo; 31 using WebKit::WebCursorInfo;
37 using webkit::npapi::WebPlugin; 32 using webkit::npapi::WebPlugin;
38 using webkit::npapi::WebPluginResourceClient; 33 using webkit::npapi::WebPluginResourceClient;
39 34
40 class FinishDestructionTask : public Task { 35 class FinishDestructionTask : public Task {
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 webplugin_->Paint(damaged_rect); 274 webplugin_->Paint(damaged_rect);
280 } 275 }
281 276
282 void WebPluginDelegateStub::OnDidPaint() { 277 void WebPluginDelegateStub::OnDidPaint() {
283 webplugin_->DidPaint(); 278 webplugin_->DidPaint();
284 } 279 }
285 280
286 void WebPluginDelegateStub::OnPrint(base::SharedMemoryHandle* shared_memory, 281 void WebPluginDelegateStub::OnPrint(base::SharedMemoryHandle* shared_memory,
287 uint32* size) { 282 uint32* size) {
288 #if defined(OS_WIN) 283 #if defined(OS_WIN)
289 scoped_ptr<printing::NativeMetafile> metafile( 284 printing::NativeMetafile metafile;
290 printing::NativeMetafileFactory::CreateMetafile()); 285 if (!metafile.CreateDc(NULL, NULL)) {
291 if (!metafile->CreateDc(NULL, NULL)) {
292 NOTREACHED(); 286 NOTREACHED();
293 return; 287 return;
294 } 288 }
295 HDC hdc = metafile->hdc(); 289 HDC hdc = metafile.hdc();
296 skia::PlatformDevice::InitializeDC(hdc); 290 skia::PlatformDevice::InitializeDC(hdc);
297 delegate_->Print(hdc); 291 delegate_->Print(hdc);
298 if (!metafile->CloseDc()) { 292 if (!metafile.CloseDc()) {
299 NOTREACHED(); 293 NOTREACHED();
300 return; 294 return;
301 } 295 }
302 296
303 *size = metafile->GetDataSize(); 297 *size = metafile.GetDataSize();
304 DCHECK(*size); 298 DCHECK(*size);
305 base::SharedMemory shared_buf; 299 base::SharedMemory shared_buf;
306 CreateSharedBuffer(*size, &shared_buf, shared_memory); 300 CreateSharedBuffer(*size, &shared_buf, shared_memory);
307 301
308 // Retrieve a copy of the data. 302 // Retrieve a copy of the data.
309 bool success = metafile->GetData(shared_buf.memory(), *size); 303 bool success = metafile.GetData(shared_buf.memory(), *size);
310 DCHECK(success); 304 DCHECK(success);
311 #else 305 #else
312 // TODO(port): plugin printing. 306 // TODO(port): plugin printing.
313 NOTIMPLEMENTED(); 307 NOTIMPLEMENTED();
314 #endif 308 #endif
315 } 309 }
316 310
317 void WebPluginDelegateStub::OnUpdateGeometry( 311 void WebPluginDelegateStub::OnUpdateGeometry(
318 const PluginMsg_UpdateGeometry_Param& param) { 312 const PluginMsg_UpdateGeometry_Param& param) {
319 webplugin_->UpdateGeometry( 313 webplugin_->UpdateGeometry(
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 webplugin_->OnResourceCreated(resource_id, resource_client); 474 webplugin_->OnResourceCreated(resource_id, resource_client);
481 } 475 }
482 476
483 #if defined(OS_MACOSX) 477 #if defined(OS_MACOSX)
484 void WebPluginDelegateStub::OnSetFakeAcceleratedSurfaceWindowHandle( 478 void WebPluginDelegateStub::OnSetFakeAcceleratedSurfaceWindowHandle(
485 gfx::PluginWindowHandle window) { 479 gfx::PluginWindowHandle window) {
486 delegate_->set_windowed_handle(window); 480 delegate_->set_windowed_handle(window);
487 } 481 }
488 #endif 482 #endif
489 483
OLDNEW
« no previous file with comments | « chrome/common/common_param_traits_unittest.cc ('k') | chrome/renderer/mock_printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698