| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/pepper/pepper_pdf_host.h" | 5 #include "chrome/renderer/pepper/pepper_pdf_host.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/common/render_messages.h" | 8 #include "chrome/common/render_messages.h" |
| 9 #include "chrome/renderer/printing/print_web_view_helper.h" | 9 #include "chrome/renderer/printing/print_web_view_helper.h" |
| 10 #include "content/public/common/referrer.h" | 10 #include "content/public/common/referrer.h" |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 return PP_OK; | 199 return PP_OK; |
| 200 } | 200 } |
| 201 | 201 |
| 202 int32_t PepperPDFHost::OnHostMsgHasUnsupportedFeature( | 202 int32_t PepperPDFHost::OnHostMsgHasUnsupportedFeature( |
| 203 ppapi::host::HostMessageContext* context) { | 203 ppapi::host::HostMessageContext* context) { |
| 204 content::PepperPluginInstance* instance = | 204 content::PepperPluginInstance* instance = |
| 205 host_->GetPluginInstance(pp_instance()); | 205 host_->GetPluginInstance(pp_instance()); |
| 206 if (!instance) | 206 if (!instance) |
| 207 return PP_ERROR_FAILED; | 207 return PP_ERROR_FAILED; |
| 208 | 208 |
| 209 // Only want to show an info bar if the pdf is the whole tab. | |
| 210 if (!instance->IsFullPagePlugin()) | |
| 211 return PP_OK; | |
| 212 | |
| 213 blink::WebView* view = | 209 blink::WebView* view = |
| 214 instance->GetContainer()->element().document().frame()->view(); | 210 instance->GetContainer()->element().document().frame()->view(); |
| 215 content::RenderView* render_view = content::RenderView::FromWebView(view); | 211 content::RenderView* render_view = content::RenderView::FromWebView(view); |
| 216 render_view->Send(new ChromeViewHostMsg_PDFHasUnsupportedFeature( | 212 render_view->Send(new ChromeViewHostMsg_PDFHasUnsupportedFeature( |
| 217 render_view->GetRoutingID())); | 213 render_view->GetRoutingID())); |
| 218 return PP_OK; | 214 return PP_OK; |
| 219 } | 215 } |
| 220 | 216 |
| 221 int32_t PepperPDFHost::OnHostMsgPrint( | 217 int32_t PepperPDFHost::OnHostMsgPrint( |
| 222 ppapi::host::HostMessageContext* context) { | 218 ppapi::host::HostMessageContext* context) { |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 | 384 |
| 389 const SkBitmap* bitmap = &skia::GetTopDevice(*canvas)->accessBitmap(false); | 385 const SkBitmap* bitmap = &skia::GetTopDevice(*canvas)->accessBitmap(false); |
| 390 pixels_to_write.copyPixelsTo( | 386 pixels_to_write.copyPixelsTo( |
| 391 bitmap->getPixels(), bitmap->getSize(), bitmap->rowBytes()); | 387 bitmap->getPixels(), bitmap->getSize(), bitmap->rowBytes()); |
| 392 | 388 |
| 393 if (needs_unmapping) | 389 if (needs_unmapping) |
| 394 image_data->Unmap(); | 390 image_data->Unmap(); |
| 395 | 391 |
| 396 return true; | 392 return true; |
| 397 } | 393 } |
| OLD | NEW |