OLD | NEW |
1 // Copyright (c) 2011 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" | |
19 #include "base/string_split.h" | 18 #include "base/string_split.h" |
20 #include "base/string_util.h" | 19 #include "base/string_util.h" |
21 #include "base/sys_info.h" | 20 #include "base/sys_info.h" |
22 #include "base/utf_string_conversions.h" | 21 #include "base/utf_string_conversions.h" |
23 #include "chrome/common/child_process_logging.h" | 22 #include "chrome/common/child_process_logging.h" |
24 #include "chrome/common/plugin_messages.h" | 23 #include "chrome/common/plugin_messages.h" |
25 #include "chrome/common/render_messages.h" | 24 #include "chrome/common/render_messages.h" |
26 #include "chrome/plugin/npobject_proxy.h" | 25 #include "chrome/plugin/npobject_proxy.h" |
27 #include "chrome/plugin/npobject_stub.h" | 26 #include "chrome/plugin/npobject_stub.h" |
28 #include "chrome/plugin/npobject_util.h" | 27 #include "chrome/plugin/npobject_util.h" |
29 #include "chrome/renderer/command_buffer_proxy.h" | 28 #include "chrome/renderer/command_buffer_proxy.h" |
30 #include "chrome/renderer/plugin_channel_host.h" | 29 #include "chrome/renderer/plugin_channel_host.h" |
31 #include "chrome/renderer/render_thread.h" | 30 #include "chrome/renderer/render_thread.h" |
32 #include "chrome/renderer/render_view.h" | 31 #include "chrome/renderer/render_view.h" |
33 #include "grit/generated_resources.h" | 32 #include "grit/generated_resources.h" |
34 #include "grit/renderer_resources.h" | 33 #include "grit/renderer_resources.h" |
35 #include "ipc/ipc_channel_handle.h" | 34 #include "ipc/ipc_channel_handle.h" |
36 #include "net/base/mime_util.h" | 35 #include "net/base/mime_util.h" |
| 36 #include "printing/native_metafile.h" |
37 #include "skia/ext/platform_canvas.h" | 37 #include "skia/ext/platform_canvas.h" |
38 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" | 38 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" |
39 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" | 39 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" |
40 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragData.h" | 40 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragData.h" |
41 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 41 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
42 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | 42 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h" | 43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h" |
44 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 44 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
45 #include "ui/base/resource/resource_bundle.h" | 45 #include "ui/base/resource/resource_bundle.h" |
46 #include "ui/gfx/blit.h" | 46 #include "ui/gfx/blit.h" |
47 #include "ui/gfx/canvas_skia.h" | 47 #include "ui/gfx/canvas_skia.h" |
48 #include "ui/gfx/native_widget_types.h" | 48 #include "ui/gfx/native_widget_types.h" |
49 #include "ui/gfx/size.h" | 49 #include "ui/gfx/size.h" |
50 #include "webkit/plugins/npapi/webplugin.h" | 50 #include "webkit/plugins/npapi/webplugin.h" |
51 #include "webkit/glue/webkit_glue.h" | 51 #include "webkit/glue/webkit_glue.h" |
52 | 52 |
53 #if defined(OS_POSIX) | 53 #if defined(OS_POSIX) |
54 #include "ipc/ipc_channel_posix.h" | 54 #include "ipc/ipc_channel_posix.h" |
55 #endif | 55 #endif |
56 | 56 |
57 #if defined(OS_WIN) | |
58 #include "printing/native_metafile_factory.h" | |
59 #include "printing/native_metafile.h" | |
60 #endif | |
61 | |
62 using WebKit::WebBindings; | 57 using WebKit::WebBindings; |
63 using WebKit::WebCursorInfo; | 58 using WebKit::WebCursorInfo; |
64 using WebKit::WebDragData; | 59 using WebKit::WebDragData; |
65 using WebKit::WebInputEvent; | 60 using WebKit::WebInputEvent; |
66 using WebKit::WebString; | 61 using WebKit::WebString; |
67 using WebKit::WebVector; | 62 using WebKit::WebVector; |
68 using WebKit::WebView; | 63 using WebKit::WebView; |
69 | 64 |
70 // Proxy for WebPluginResourceClient. The object owns itself after creation, | 65 // Proxy for WebPluginResourceClient. The object owns itself after creation, |
71 // deleting itself after its callback has been called. | 66 // deleting itself after its callback has been called. |
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 if (!Send(new PluginMsg_Print(instance_id_, &shared_memory, &size))) | 919 if (!Send(new PluginMsg_Print(instance_id_, &shared_memory, &size))) |
925 return; | 920 return; |
926 | 921 |
927 base::SharedMemory memory(shared_memory, true); | 922 base::SharedMemory memory(shared_memory, true); |
928 if (!memory.Map(size)) { | 923 if (!memory.Map(size)) { |
929 NOTREACHED(); | 924 NOTREACHED(); |
930 return; | 925 return; |
931 } | 926 } |
932 | 927 |
933 #if defined(OS_WIN) | 928 #if defined(OS_WIN) |
934 scoped_ptr<printing::NativeMetafile> metafile( | 929 printing::NativeMetafile metafile; |
935 printing::NativeMetafileFactory::CreateMetafile()); | 930 if (!metafile.Init(memory.memory(), size)) { |
936 if (!metafile->Init(memory.memory(), size)) { | |
937 NOTREACHED(); | 931 NOTREACHED(); |
938 return; | 932 return; |
939 } | 933 } |
940 // Playback the buffer. | 934 // Playback the buffer. |
941 metafile->Playback(context, NULL); | 935 metafile.Playback(context, NULL); |
942 #else | 936 #else |
943 // TODO(port): plugin printing. | 937 // TODO(port): plugin printing. |
944 NOTIMPLEMENTED(); | 938 NOTIMPLEMENTED(); |
945 #endif | 939 #endif |
946 } | 940 } |
947 | 941 |
948 NPObject* WebPluginDelegateProxy::GetPluginScriptableObject() { | 942 NPObject* WebPluginDelegateProxy::GetPluginScriptableObject() { |
949 if (npobject_) | 943 if (npobject_) |
950 return WebBindings::retainObject(npobject_); | 944 return WebBindings::retainObject(npobject_); |
951 | 945 |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1585 } | 1579 } |
1586 #endif | 1580 #endif |
1587 | 1581 |
1588 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, | 1582 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, |
1589 int resource_id) { | 1583 int resource_id) { |
1590 if (!plugin_) | 1584 if (!plugin_) |
1591 return; | 1585 return; |
1592 | 1586 |
1593 plugin_->URLRedirectResponse(allow, resource_id); | 1587 plugin_->URLRedirectResponse(allow, resource_id); |
1594 } | 1588 } |
OLD | NEW |