| OLD | NEW |
| 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 #define PEPPER_APIS_ENABLED 1 | 5 #define PEPPER_APIS_ENABLED 1 |
| 6 | 6 |
| 7 #include "chrome/renderer/webplugin_delegate_pepper.h" | 7 #include "chrome/renderer/webplugin_delegate_pepper.h" |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 const unsigned char* pdf_buffer, int buffer_size, int page_number, HDC dc, | 107 const unsigned char* pdf_buffer, int buffer_size, int page_number, HDC dc, |
| 108 int dpi_x, int dpi_y, int bounds_origin_x, int bounds_origin_y, | 108 int dpi_x, int dpi_y, int bounds_origin_x, int bounds_origin_y, |
| 109 int bounds_width, int bounds_height, bool fit_to_bounds, | 109 int bounds_width, int bounds_height, bool fit_to_bounds, |
| 110 bool stretch_to_bounds, bool keep_aspect_ratio, bool center_in_bounds); | 110 bool stretch_to_bounds, bool keep_aspect_ratio, bool center_in_bounds); |
| 111 #endif // defined(OS_WIN) | 111 #endif // defined(OS_WIN) |
| 112 | 112 |
| 113 WebPluginDelegatePepper* WebPluginDelegatePepper::Create( | 113 WebPluginDelegatePepper* WebPluginDelegatePepper::Create( |
| 114 const FilePath& filename, | 114 const FilePath& filename, |
| 115 const std::string& mime_type, | 115 const std::string& mime_type, |
| 116 const base::WeakPtr<RenderView>& render_view) { | 116 const base::WeakPtr<RenderView>& render_view) { |
| 117 scoped_refptr<NPAPI::PluginLib> plugin_lib = | 117 scoped_refptr<NPAPI::PluginLib> plugin_lib( |
| 118 NPAPI::PluginLib::CreatePluginLib(filename); | 118 NPAPI::PluginLib::CreatePluginLib(filename)); |
| 119 if (plugin_lib.get() == NULL) | 119 if (plugin_lib.get() == NULL) |
| 120 return NULL; | 120 return NULL; |
| 121 | 121 |
| 122 NPError err = plugin_lib->NP_Initialize(); | 122 NPError err = plugin_lib->NP_Initialize(); |
| 123 if (err != NPERR_NO_ERROR) | 123 if (err != NPERR_NO_ERROR) |
| 124 return NULL; | 124 return NULL; |
| 125 | 125 |
| 126 scoped_refptr<NPAPI::PluginInstance> instance = | 126 scoped_refptr<NPAPI::PluginInstance> instance( |
| 127 plugin_lib->CreateInstance(mime_type); | 127 plugin_lib->CreateInstance(mime_type)); |
| 128 return new WebPluginDelegatePepper(render_view, | 128 return new WebPluginDelegatePepper(render_view, |
| 129 instance.get()); | 129 instance.get()); |
| 130 } | 130 } |
| 131 | 131 |
| 132 void WebPluginDelegatePepper::didChooseFile( | 132 void WebPluginDelegatePepper::didChooseFile( |
| 133 const WebKit::WebVector<WebKit::WebString>& file_names) { | 133 const WebKit::WebVector<WebKit::WebString>& file_names) { |
| 134 if (file_names.isEmpty()) { | 134 if (file_names.isEmpty()) { |
| 135 current_choose_file_callback_(NULL, 0, current_choose_file_user_data_); | 135 current_choose_file_callback_(NULL, 0, current_choose_file_user_data_); |
| 136 } else { | 136 } else { |
| 137 // Construct a bunch of 8-bit strings for the callback. | 137 // Construct a bunch of 8-bit strings for the callback. |
| (...skipping 1622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1760 CGRect bounds; | 1760 CGRect bounds; |
| 1761 bounds.origin.x = dest_rect.x(); | 1761 bounds.origin.x = dest_rect.x(); |
| 1762 bounds.origin.y = canvas_height - dest_rect.y() - dest_rect.height(); | 1762 bounds.origin.y = canvas_height - dest_rect.y() - dest_rect.height(); |
| 1763 bounds.size.width = dest_rect.width(); | 1763 bounds.size.width = dest_rect.width(); |
| 1764 bounds.size.height = dest_rect.height(); | 1764 bounds.size.height = dest_rect.height(); |
| 1765 | 1765 |
| 1766 CGContextDrawImage(canvas, bounds, image); | 1766 CGContextDrawImage(canvas, bounds, image); |
| 1767 CGContextRestoreGState(canvas); | 1767 CGContextRestoreGState(canvas); |
| 1768 } | 1768 } |
| 1769 #endif // defined(OS_MACOSX) | 1769 #endif // defined(OS_MACOSX) |
| OLD | NEW |