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

Side by Side Diff: chrome/renderer/webplugin_delegate_proxy.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/renderer/webplugin_delegate_proxy.h" 5 #include "chrome/renderer/webplugin_delegate_proxy.h"
6 6
7 #if defined(TOOLKIT_USES_GTK) 7 #if defined(TOOLKIT_USES_GTK)
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #endif 9 #endif
10 10
11 #include <algorithm> 11 #include <algorithm>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/file_util.h" 15 #include "base/file_util.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/ref_counted.h" 17 #include "base/ref_counted.h"
18 #include "base/scoped_ptr.h"
18 #include "base/string_split.h" 19 #include "base/string_split.h"
19 #include "base/string_util.h" 20 #include "base/string_util.h"
20 #include "base/sys_info.h" 21 #include "base/sys_info.h"
21 #include "base/utf_string_conversions.h" 22 #include "base/utf_string_conversions.h"
22 #include "chrome/common/child_process_logging.h" 23 #include "chrome/common/child_process_logging.h"
23 #include "chrome/common/plugin_messages.h" 24 #include "chrome/common/plugin_messages.h"
24 #include "chrome/common/render_messages.h" 25 #include "chrome/common/render_messages.h"
25 #include "chrome/plugin/npobject_proxy.h" 26 #include "chrome/plugin/npobject_proxy.h"
26 #include "chrome/plugin/npobject_stub.h" 27 #include "chrome/plugin/npobject_stub.h"
27 #include "chrome/plugin/npobject_util.h" 28 #include "chrome/plugin/npobject_util.h"
28 #include "chrome/renderer/command_buffer_proxy.h" 29 #include "chrome/renderer/command_buffer_proxy.h"
29 #include "chrome/renderer/plugin_channel_host.h" 30 #include "chrome/renderer/plugin_channel_host.h"
30 #include "chrome/renderer/render_thread.h" 31 #include "chrome/renderer/render_thread.h"
31 #include "chrome/renderer/render_view.h" 32 #include "chrome/renderer/render_view.h"
32 #include "grit/generated_resources.h" 33 #include "grit/generated_resources.h"
33 #include "grit/renderer_resources.h" 34 #include "grit/renderer_resources.h"
34 #include "ipc/ipc_channel_handle.h" 35 #include "ipc/ipc_channel_handle.h"
35 #include "net/base/mime_util.h" 36 #include "net/base/mime_util.h"
36 #include "printing/native_metafile.h" 37 #include "printing/metafile_factory.h"
vandebo (ex-Chrome) 2011/02/22 22:18:16 Still used.
dpapad 2011/02/23 00:44:39 Done.
37 #include "skia/ext/platform_canvas.h" 38 #include "skia/ext/platform_canvas.h"
38 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" 39 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h"
39 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" 40 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h"
40 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragData.h" 41 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragData.h"
41 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 42 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
42 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" 43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h" 44 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h"
44 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 45 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
45 #include "ui/base/resource/resource_bundle.h" 46 #include "ui/base/resource/resource_bundle.h"
46 #include "ui/gfx/blit.h" 47 #include "ui/gfx/blit.h"
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 if (!Send(new PluginMsg_Print(instance_id_, &shared_memory, &size))) 920 if (!Send(new PluginMsg_Print(instance_id_, &shared_memory, &size)))
920 return; 921 return;
921 922
922 base::SharedMemory memory(shared_memory, true); 923 base::SharedMemory memory(shared_memory, true);
923 if (!memory.Map(size)) { 924 if (!memory.Map(size)) {
924 NOTREACHED(); 925 NOTREACHED();
925 return; 926 return;
926 } 927 }
927 928
928 #if defined(OS_WIN) 929 #if defined(OS_WIN)
929 printing::NativeMetafile metafile; 930 scoped_ptr<printing::NativeMetafile> metafile(
930 if (!metafile.Init(memory.memory(), size)) { 931 printing::MetafileFactory::GetMetafile());
932 if (!metafile->Init(memory.memory(), size)) {
931 NOTREACHED(); 933 NOTREACHED();
932 return; 934 return;
933 } 935 }
934 // Playback the buffer. 936 // Playback the buffer.
935 metafile.Playback(context, NULL); 937 metafile->Playback(context, NULL);
936 #else 938 #else
937 // TODO(port): plugin printing. 939 // TODO(port): plugin printing.
938 NOTIMPLEMENTED(); 940 NOTIMPLEMENTED();
939 #endif 941 #endif
940 } 942 }
941 943
942 NPObject* WebPluginDelegateProxy::GetPluginScriptableObject() { 944 NPObject* WebPluginDelegateProxy::GetPluginScriptableObject() {
943 if (npobject_) 945 if (npobject_)
944 return WebBindings::retainObject(npobject_); 946 return WebBindings::retainObject(npobject_);
945 947
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
1579 } 1581 }
1580 #endif 1582 #endif
1581 1583
1582 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, 1584 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow,
1583 int resource_id) { 1585 int resource_id) {
1584 if (!plugin_) 1586 if (!plugin_)
1585 return; 1587 return;
1586 1588
1587 plugin_->URLRedirectResponse(allow, resource_id); 1589 plugin_->URLRedirectResponse(allow, resource_id);
1588 } 1590 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698