OLD | NEW |
1 // Copyright (c) 2011 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/chrome_ppb_pdf_impl.h" | 5 #include "chrome/renderer/chrome_ppb_pdf_impl.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/common/render_messages.h" |
10 #include "content/common/view_messages.h" | 11 #include "content/common/view_messages.h" |
| 12 #include "content/renderer/pepper_plugin_delegate_impl.h" |
11 #include "content/renderer/render_thread.h" | 13 #include "content/renderer/render_thread.h" |
12 #include "grit/webkit_resources.h" | 14 #include "grit/webkit_resources.h" |
13 #include "grit/webkit_strings.h" | 15 #include "grit/webkit_strings.h" |
14 #include "ppapi/c/pp_resource.h" | 16 #include "ppapi/c/pp_resource.h" |
15 #include "ppapi/c/private/ppb_pdf.h" | 17 #include "ppapi/c/private/ppb_pdf.h" |
16 #include "ppapi/shared_impl/resource.h" | 18 #include "ppapi/shared_impl/resource.h" |
17 #include "ppapi/shared_impl/resource_tracker.h" | 19 #include "ppapi/shared_impl/resource_tracker.h" |
18 #include "ppapi/shared_impl/tracker_base.h" | 20 #include "ppapi/shared_impl/tracker_base.h" |
19 #include "ppapi/shared_impl/var.h" | 21 #include "ppapi/shared_impl/var.h" |
20 #include "skia/ext/platform_canvas.h" | 22 #include "skia/ext/platform_canvas.h" |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 void HasUnsupportedFeature(PP_Instance instance_id) { | 315 void HasUnsupportedFeature(PP_Instance instance_id) { |
314 webkit::ppapi::PluginInstance* instance = | 316 webkit::ppapi::PluginInstance* instance = |
315 webkit::ppapi::ResourceTracker::Get()->GetInstance(instance_id); | 317 webkit::ppapi::ResourceTracker::Get()->GetInstance(instance_id); |
316 if (!instance) | 318 if (!instance) |
317 return; | 319 return; |
318 | 320 |
319 // Only want to show an info bar if the pdf is the whole tab. | 321 // Only want to show an info bar if the pdf is the whole tab. |
320 if (!instance->IsFullPagePlugin()) | 322 if (!instance->IsFullPagePlugin()) |
321 return; | 323 return; |
322 | 324 |
323 instance->delegate()->HasUnsupportedFeature(); | 325 PepperPluginDelegateImpl* pepper_delegate = |
| 326 static_cast<PepperPluginDelegateImpl*>(instance->delegate()); |
| 327 |
| 328 RenderThread::current()->Send( |
| 329 new ChromeViewHostMsg_PDFHasUnsupportedFeature( |
| 330 pepper_delegate->GetRoutingId())); |
324 } | 331 } |
325 | 332 |
326 void SaveAs(PP_Instance instance_id) { | 333 void SaveAs(PP_Instance instance_id) { |
327 webkit::ppapi::PluginInstance* instance = | 334 webkit::ppapi::PluginInstance* instance = |
328 webkit::ppapi::ResourceTracker::Get()->GetInstance(instance_id); | 335 webkit::ppapi::ResourceTracker::Get()->GetInstance(instance_id); |
329 if (!instance) | 336 if (!instance) |
330 return; | 337 return; |
331 instance->delegate()->SaveURLAs(instance->plugin_url()); | 338 instance->delegate()->SaveURLAs(instance->plugin_url()); |
332 } | 339 } |
333 | 340 |
(...skipping 12 matching lines...) Expand all Loading... |
346 &SaveAs | 353 &SaveAs |
347 }; | 354 }; |
348 | 355 |
349 // static | 356 // static |
350 const PPB_PDF* PPB_PDF_Impl::GetInterface() { | 357 const PPB_PDF* PPB_PDF_Impl::GetInterface() { |
351 return &ppb_pdf; | 358 return &ppb_pdf; |
352 } | 359 } |
353 | 360 |
354 } // namespace chrome | 361 } // namespace chrome |
355 | 362 |
OLD | NEW |