OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
10 #include <atlbase.h> | 10 #include <atlbase.h> |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "chrome/common/plugin_messages.h" | 22 #include "chrome/common/plugin_messages.h" |
23 #include "chrome/common/render_messages.h" | 23 #include "chrome/common/render_messages.h" |
24 #include "chrome/plugin/npobject_proxy.h" | 24 #include "chrome/plugin/npobject_proxy.h" |
25 #include "chrome/plugin/npobject_stub.h" | 25 #include "chrome/plugin/npobject_stub.h" |
26 #include "chrome/plugin/npobject_util.h" | 26 #include "chrome/plugin/npobject_util.h" |
27 #include "chrome/renderer/render_thread.h" | 27 #include "chrome/renderer/render_thread.h" |
28 #include "chrome/renderer/render_view.h" | 28 #include "chrome/renderer/render_view.h" |
29 #include "googleurl/src/gurl.h" | 29 #include "googleurl/src/gurl.h" |
30 #include "grit/generated_resources.h" | 30 #include "grit/generated_resources.h" |
31 #include "net/base/mime_util.h" | 31 #include "net/base/mime_util.h" |
| 32 #include "printing/native_metafile.h" |
32 #include "webkit/api/public/WebDragData.h" | 33 #include "webkit/api/public/WebDragData.h" |
33 #include "webkit/api/public/WebString.h" | 34 #include "webkit/api/public/WebString.h" |
34 #include "webkit/api/public/WebVector.h" | 35 #include "webkit/api/public/WebVector.h" |
35 #include "webkit/glue/webframe.h" | 36 #include "webkit/glue/webframe.h" |
36 #include "webkit/glue/webkit_glue.h" | 37 #include "webkit/glue/webkit_glue.h" |
37 #include "webkit/glue/webplugin.h" | 38 #include "webkit/glue/webplugin.h" |
38 #include "webkit/glue/webview.h" | 39 #include "webkit/glue/webview.h" |
39 | 40 |
40 #if defined(OS_WIN) | |
41 #include "chrome/common/gfx/emf.h" | |
42 #endif | |
43 | |
44 #if defined(OS_POSIX) | 41 #if defined(OS_POSIX) |
45 #include "chrome/common/ipc_channel_posix.h" | 42 #include "chrome/common/ipc_channel_posix.h" |
46 #endif | 43 #endif |
47 | 44 |
48 using WebKit::WebInputEvent; | 45 using WebKit::WebInputEvent; |
49 using WebKit::WebDragData; | 46 using WebKit::WebDragData; |
50 using WebKit::WebVector; | 47 using WebKit::WebVector; |
51 using WebKit::WebString; | 48 using WebKit::WebString; |
52 | 49 |
53 // Proxy for WebPluginResourceClient. The object owns itself after creation, | 50 // Proxy for WebPluginResourceClient. The object owns itself after creation, |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 if (!Send(new PluginMsg_Print(instance_id_, &shared_memory, &size))) | 569 if (!Send(new PluginMsg_Print(instance_id_, &shared_memory, &size))) |
573 return; | 570 return; |
574 | 571 |
575 base::SharedMemory memory(shared_memory, true); | 572 base::SharedMemory memory(shared_memory, true); |
576 if (!memory.Map(size)) { | 573 if (!memory.Map(size)) { |
577 NOTREACHED(); | 574 NOTREACHED(); |
578 return; | 575 return; |
579 } | 576 } |
580 | 577 |
581 #if defined(OS_WIN) | 578 #if defined(OS_WIN) |
582 gfx::Emf emf; | 579 printing::NativeMetafile metafile; |
583 if (!emf.CreateFromData(memory.memory(), size)) { | 580 if (!metafile.CreateFromData(memory.memory(), size)) { |
584 NOTREACHED(); | 581 NOTREACHED(); |
585 return; | 582 return; |
586 } | 583 } |
587 // Playback the buffer. | 584 // Playback the buffer. |
588 emf.Playback(context, NULL); | 585 metafile.Playback(context, NULL); |
589 #else | 586 #else |
590 // TODO(port): plugin printing. | 587 // TODO(port): plugin printing. |
591 NOTIMPLEMENTED(); | 588 NOTIMPLEMENTED(); |
592 #endif | 589 #endif |
593 } | 590 } |
594 | 591 |
595 NPObject* WebPluginDelegateProxy::GetPluginScriptableObject() { | 592 NPObject* WebPluginDelegateProxy::GetPluginScriptableObject() { |
596 if (npobject_) | 593 if (npobject_) |
597 return NPN_RetainObject(npobject_); | 594 return NPN_RetainObject(npobject_); |
598 | 595 |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 plugin_->CancelDocumentLoad(); | 918 plugin_->CancelDocumentLoad(); |
922 } | 919 } |
923 | 920 |
924 void WebPluginDelegateProxy::OnInitiateHTTPRangeRequest( | 921 void WebPluginDelegateProxy::OnInitiateHTTPRangeRequest( |
925 const std::string& url, const std::string& range_info, | 922 const std::string& url, const std::string& range_info, |
926 intptr_t existing_stream, bool notify_needed, intptr_t notify_data) { | 923 intptr_t existing_stream, bool notify_needed, intptr_t notify_data) { |
927 plugin_->InitiateHTTPRangeRequest(url.c_str(), range_info.c_str(), | 924 plugin_->InitiateHTTPRangeRequest(url.c_str(), range_info.c_str(), |
928 existing_stream, notify_needed, | 925 existing_stream, notify_needed, |
929 notify_data); | 926 notify_data); |
930 } | 927 } |
OLD | NEW |