| OLD | NEW |
| 1 // Copyright (c) 2010 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 "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/native_metafile.h" |
| 38 #include "printing/native_metafile_factory.h" |
| 37 #include "skia/ext/platform_canvas.h" | 39 #include "skia/ext/platform_canvas.h" |
| 38 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" | 40 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" |
| 39 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" | 41 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" |
| 40 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragData.h" | 42 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragData.h" |
| 41 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| 42 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | 44 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
| 43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h" | 45 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h" |
| 44 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 46 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 45 #include "ui/base/resource/resource_bundle.h" | 47 #include "ui/base/resource/resource_bundle.h" |
| 46 #include "ui/gfx/blit.h" | 48 #include "ui/gfx/blit.h" |
| (...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 919 if (!Send(new PluginMsg_Print(instance_id_, &shared_memory, &size))) | 921 if (!Send(new PluginMsg_Print(instance_id_, &shared_memory, &size))) |
| 920 return; | 922 return; |
| 921 | 923 |
| 922 base::SharedMemory memory(shared_memory, true); | 924 base::SharedMemory memory(shared_memory, true); |
| 923 if (!memory.Map(size)) { | 925 if (!memory.Map(size)) { |
| 924 NOTREACHED(); | 926 NOTREACHED(); |
| 925 return; | 927 return; |
| 926 } | 928 } |
| 927 | 929 |
| 928 #if defined(OS_WIN) | 930 #if defined(OS_WIN) |
| 929 printing::NativeMetafile metafile; | 931 scoped_ptr<printing::NativeMetafile> metafile( |
| 930 if (!metafile.Init(memory.memory(), size)) { | 932 printing::NativeMetafileFactory::CreateMetafile()); |
| 933 if (!metafile->Init(memory.memory(), size)) { |
| 931 NOTREACHED(); | 934 NOTREACHED(); |
| 932 return; | 935 return; |
| 933 } | 936 } |
| 934 // Playback the buffer. | 937 // Playback the buffer. |
| 935 metafile.Playback(context, NULL); | 938 metafile->Playback(context, NULL); |
| 936 #else | 939 #else |
| 937 // TODO(port): plugin printing. | 940 // TODO(port): plugin printing. |
| 938 NOTIMPLEMENTED(); | 941 NOTIMPLEMENTED(); |
| 939 #endif | 942 #endif |
| 940 } | 943 } |
| 941 | 944 |
| 942 NPObject* WebPluginDelegateProxy::GetPluginScriptableObject() { | 945 NPObject* WebPluginDelegateProxy::GetPluginScriptableObject() { |
| 943 if (npobject_) | 946 if (npobject_) |
| 944 return WebBindings::retainObject(npobject_); | 947 return WebBindings::retainObject(npobject_); |
| 945 | 948 |
| (...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1579 } | 1582 } |
| 1580 #endif | 1583 #endif |
| 1581 | 1584 |
| 1582 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, | 1585 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, |
| 1583 int resource_id) { | 1586 int resource_id) { |
| 1584 if (!plugin_) | 1587 if (!plugin_) |
| 1585 return; | 1588 return; |
| 1586 | 1589 |
| 1587 plugin_->URLRedirectResponse(allow, resource_id); | 1590 plugin_->URLRedirectResponse(allow, resource_id); |
| 1588 } | 1591 } |
| OLD | NEW |