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

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

Issue 6544028: Create a Factory for NativeMetafile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed styling issues (naming, 80cols) Created 9 years, 10 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
OLDNEW
1 // Copyright (c) 2009 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 "base/scoped_ptr.h"
10 #include "chrome/common/child_process_logging.h" 11 #include "chrome/common/child_process_logging.h"
11 #include "chrome/common/chrome_switches.h" 12 #include "chrome/common/chrome_switches.h"
12 #include "chrome/common/plugin_messages.h" 13 #include "chrome/common/plugin_messages.h"
13 #include "chrome/plugin/npobject_stub.h" 14 #include "chrome/plugin/npobject_stub.h"
14 #include "chrome/plugin/plugin_channel.h" 15 #include "chrome/plugin/plugin_channel.h"
15 #include "chrome/plugin/plugin_thread.h" 16 #include "chrome/plugin/plugin_thread.h"
16 #include "chrome/plugin/webplugin_proxy.h" 17 #include "chrome/plugin/webplugin_proxy.h"
17 #include "printing/native_metafile.h" 18 #include "printing/metafile_factory.h"
vandebo (ex-Chrome) 2011/02/22 22:18:16 NativeMetafile is still used, you should continue
dpapad 2011/02/23 00:44:39 Done.
18 #include "third_party/npapi/bindings/npapi.h" 19 #include "third_party/npapi/bindings/npapi.h"
19 #include "third_party/npapi/bindings/npruntime.h" 20 #include "third_party/npapi/bindings/npruntime.h"
20 #include "skia/ext/platform_device.h" 21 #include "skia/ext/platform_device.h"
21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h"
22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h"
23 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" 24 #include "webkit/plugins/npapi/webplugin_delegate_impl.h"
24 #include "webkit/glue/webcursor.h" 25 #include "webkit/glue/webcursor.h"
25 26
26 #if defined(ENABLE_GPU) 27 #if defined(ENABLE_GPU)
27 #include "app/gfx/gl/gl_context.h" 28 #include "app/gfx/gl/gl_context.h"
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 webplugin_->Paint(damaged_rect); 275 webplugin_->Paint(damaged_rect);
275 } 276 }
276 277
277 void WebPluginDelegateStub::OnDidPaint() { 278 void WebPluginDelegateStub::OnDidPaint() {
278 webplugin_->DidPaint(); 279 webplugin_->DidPaint();
279 } 280 }
280 281
281 void WebPluginDelegateStub::OnPrint(base::SharedMemoryHandle* shared_memory, 282 void WebPluginDelegateStub::OnPrint(base::SharedMemoryHandle* shared_memory,
282 uint32* size) { 283 uint32* size) {
283 #if defined(OS_WIN) 284 #if defined(OS_WIN)
284 printing::NativeMetafile metafile; 285 scoped_ptr<printing::NativeMetafile> metafile(
285 if (!metafile.CreateDc(NULL, NULL)) { 286 printing::MetafileFactory::GetMetafile());
287 if (!metafile->CreateDc(NULL, NULL)) {
286 NOTREACHED(); 288 NOTREACHED();
287 return; 289 return;
288 } 290 }
289 HDC hdc = metafile.hdc(); 291 HDC hdc = metafile->hdc();
290 skia::PlatformDevice::InitializeDC(hdc); 292 skia::PlatformDevice::InitializeDC(hdc);
291 delegate_->Print(hdc); 293 delegate_->Print(hdc);
292 if (!metafile.CloseDc()) { 294 if (!metafile->CloseDc()) {
293 NOTREACHED(); 295 NOTREACHED();
294 return; 296 return;
295 } 297 }
296 298
297 *size = metafile.GetDataSize(); 299 *size = metafile->GetDataSize();
298 DCHECK(*size); 300 DCHECK(*size);
299 base::SharedMemory shared_buf; 301 base::SharedMemory shared_buf;
300 CreateSharedBuffer(*size, &shared_buf, shared_memory); 302 CreateSharedBuffer(*size, &shared_buf, shared_memory);
301 303
302 // Retrieve a copy of the data. 304 // Retrieve a copy of the data.
303 bool success = metafile.GetData(shared_buf.memory(), *size); 305 bool success = metafile->GetData(shared_buf.memory(), *size);
304 DCHECK(success); 306 DCHECK(success);
305 #else 307 #else
306 // TODO(port): plugin printing. 308 // TODO(port): plugin printing.
307 NOTIMPLEMENTED(); 309 NOTIMPLEMENTED();
308 #endif 310 #endif
309 } 311 }
310 312
311 void WebPluginDelegateStub::OnUpdateGeometry( 313 void WebPluginDelegateStub::OnUpdateGeometry(
312 const PluginMsg_UpdateGeometry_Param& param) { 314 const PluginMsg_UpdateGeometry_Param& param) {
313 webplugin_->UpdateGeometry( 315 webplugin_->UpdateGeometry(
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 webplugin_->OnResourceCreated(resource_id, resource_client); 476 webplugin_->OnResourceCreated(resource_id, resource_client);
475 } 477 }
476 478
477 #if defined(OS_MACOSX) 479 #if defined(OS_MACOSX)
478 void WebPluginDelegateStub::OnSetFakeAcceleratedSurfaceWindowHandle( 480 void WebPluginDelegateStub::OnSetFakeAcceleratedSurfaceWindowHandle(
479 gfx::PluginWindowHandle window) { 481 gfx::PluginWindowHandle window) {
480 delegate_->set_windowed_handle(window); 482 delegate_->set_windowed_handle(window);
481 } 483 }
482 #endif 484 #endif
483 485
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698