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

Unified 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: Minor style fix 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 side-by-side diff with in-line comments
Download patch
Index: chrome/plugin/webplugin_delegate_stub.cc
diff --git a/chrome/plugin/webplugin_delegate_stub.cc b/chrome/plugin/webplugin_delegate_stub.cc
index 6b0f39a47459249fe5ce056f67fcc6e983f01cf1..fe0977159c7b3d7c64f3496304633473115512e8 100644
--- a/chrome/plugin/webplugin_delegate_stub.cc
+++ b/chrome/plugin/webplugin_delegate_stub.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,6 +7,7 @@
#include "build/build_config.h"
#include "base/command_line.h"
+#include "base/scoped_ptr.h"
#include "chrome/common/child_process_logging.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/plugin_messages.h"
@@ -15,6 +16,7 @@
#include "chrome/plugin/plugin_thread.h"
#include "chrome/plugin/webplugin_proxy.h"
#include "printing/native_metafile.h"
+#include "printing/native_metafile_factory.h"
kmadhusu 2011/03/01 19:42:38 Alphabetize the header files. #include "printing/
dpapad 2011/03/01 22:41:24 Done.
#include "third_party/npapi/bindings/npapi.h"
#include "third_party/npapi/bindings/npruntime.h"
#include "skia/ext/platform_device.h"
@@ -281,26 +283,27 @@ void WebPluginDelegateStub::OnDidPaint() {
void WebPluginDelegateStub::OnPrint(base::SharedMemoryHandle* shared_memory,
uint32* size) {
#if defined(OS_WIN)
- printing::NativeMetafile metafile;
- if (!metafile.CreateDc(NULL, NULL)) {
+ scoped_ptr<printing::NativeMetafile> metafile(
+ printing::NativeMetafileFactory::CreateMetafile());
+ if (!metafile->CreateDc(NULL, NULL)) {
NOTREACHED();
return;
}
- HDC hdc = metafile.hdc();
+ HDC hdc = metafile->hdc();
skia::PlatformDevice::InitializeDC(hdc);
delegate_->Print(hdc);
- if (!metafile.CloseDc()) {
+ if (!metafile->CloseDc()) {
NOTREACHED();
return;
}
- *size = metafile.GetDataSize();
+ *size = metafile->GetDataSize();
DCHECK(*size);
base::SharedMemory shared_buf;
CreateSharedBuffer(*size, &shared_buf, shared_memory);
// Retrieve a copy of the data.
- bool success = metafile.GetData(shared_buf.memory(), *size);
+ bool success = metafile->GetData(shared_buf.memory(), *size);
DCHECK(success);
#else
// TODO(port): plugin printing.

Powered by Google App Engine
This is Rietveld 408576698