OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/webplugin_delegate_proxy.h" | 5 #include "content/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 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 #include "ui/gfx/size.h" | 47 #include "ui/gfx/size.h" |
48 #include "webkit/plugins/npapi/webplugin.h" | 48 #include "webkit/plugins/npapi/webplugin.h" |
49 #include "webkit/plugins/sad_plugin.h" | 49 #include "webkit/plugins/sad_plugin.h" |
50 #include "webkit/glue/webkit_glue.h" | 50 #include "webkit/glue/webkit_glue.h" |
51 | 51 |
52 #if defined(OS_POSIX) | 52 #if defined(OS_POSIX) |
53 #include "ipc/ipc_channel_posix.h" | 53 #include "ipc/ipc_channel_posix.h" |
54 #endif | 54 #endif |
55 | 55 |
56 #if defined(OS_WIN) | 56 #if defined(OS_WIN) |
57 #include "printing/native_metafile_factory.h" | 57 #include "printing/metafile_impl.h" |
58 #include "printing/native_metafile.h" | |
59 #endif | 58 #endif |
60 | 59 |
61 using WebKit::WebBindings; | 60 using WebKit::WebBindings; |
62 using WebKit::WebCursorInfo; | 61 using WebKit::WebCursorInfo; |
63 using WebKit::WebDragData; | 62 using WebKit::WebDragData; |
64 using WebKit::WebInputEvent; | 63 using WebKit::WebInputEvent; |
65 using WebKit::WebString; | 64 using WebKit::WebString; |
66 using WebKit::WebView; | 65 using WebKit::WebView; |
67 | 66 |
68 // Proxy for WebPluginResourceClient. The object owns itself after creation, | 67 // Proxy for WebPluginResourceClient. The object owns itself after creation, |
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
916 if (!Send(new PluginMsg_Print(instance_id_, &shared_memory, &size))) | 915 if (!Send(new PluginMsg_Print(instance_id_, &shared_memory, &size))) |
917 return; | 916 return; |
918 | 917 |
919 base::SharedMemory memory(shared_memory, true); | 918 base::SharedMemory memory(shared_memory, true); |
920 if (!memory.Map(size)) { | 919 if (!memory.Map(size)) { |
921 NOTREACHED(); | 920 NOTREACHED(); |
922 return; | 921 return; |
923 } | 922 } |
924 | 923 |
925 #if defined(OS_WIN) | 924 #if defined(OS_WIN) |
926 scoped_ptr<printing::NativeMetafile> metafile( | 925 printing::NativeMetafile metafile; |
927 printing::NativeMetafileFactory::Create()); | 926 if (!metafile.InitFromData(memory.memory(), size)) { |
928 if (!metafile->InitFromData(memory.memory(), size)) { | |
929 NOTREACHED(); | 927 NOTREACHED(); |
930 return; | 928 return; |
931 } | 929 } |
932 // Playback the buffer. | 930 // Playback the buffer. |
933 metafile->Playback(context, NULL); | 931 metafile.Playback(context, NULL); |
934 #else | 932 #else |
935 // TODO(port): plugin printing. | 933 // TODO(port): plugin printing. |
936 NOTIMPLEMENTED(); | 934 NOTIMPLEMENTED(); |
937 #endif | 935 #endif |
938 } | 936 } |
939 | 937 |
940 NPObject* WebPluginDelegateProxy::GetPluginScriptableObject() { | 938 NPObject* WebPluginDelegateProxy::GetPluginScriptableObject() { |
941 if (npobject_) | 939 if (npobject_) |
942 return WebBindings::retainObject(npobject_); | 940 return WebBindings::retainObject(npobject_); |
943 | 941 |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1388 } | 1386 } |
1389 #endif | 1387 #endif |
1390 | 1388 |
1391 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, | 1389 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, |
1392 int resource_id) { | 1390 int resource_id) { |
1393 if (!plugin_) | 1391 if (!plugin_) |
1394 return; | 1392 return; |
1395 | 1393 |
1396 plugin_->URLRedirectResponse(allow, resource_id); | 1394 plugin_->URLRedirectResponse(allow, resource_id); |
1397 } | 1395 } |
OLD | NEW |