| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/pdf/renderer/pepper_pdf_host.h" | 5 #include "components/pdf/renderer/pepper_pdf_host.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "components/pdf/common/pdf_messages.h" | 8 #include "components/pdf/common/pdf_messages.h" |
| 9 #include "components/pdf/renderer/pdf_accessibility_tree.h" | 9 #include "components/pdf/renderer/pdf_accessibility_tree.h" |
| 10 #include "content/public/common/referrer.h" | 10 #include "content/public/common/referrer.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 // static | 50 // static |
| 51 bool PepperPDFHost::InvokePrintingForInstance(PP_Instance instance_id) { | 51 bool PepperPDFHost::InvokePrintingForInstance(PP_Instance instance_id) { |
| 52 return g_print_client_tls.Pointer()->Get() | 52 return g_print_client_tls.Pointer()->Get() |
| 53 ? g_print_client_tls.Pointer()->Get()->Print(instance_id) | 53 ? g_print_client_tls.Pointer()->Get()->Print(instance_id) |
| 54 : false; | 54 : false; |
| 55 } | 55 } |
| 56 | 56 |
| 57 // static | 57 // static |
| 58 void PepperPDFHost::SetPrintClient(PepperPDFHost::PrintClient* client) { | 58 void PepperPDFHost::SetPrintClient(PepperPDFHost::PrintClient* client) { |
| 59 CHECK(!g_print_client_tls.Pointer()->Get()) | 59 // There should only be a single PrintClient for one RenderThread. |
| 60 << "There should only be a single PrintClient for one RenderThread."; | 60 CHECK(!g_print_client_tls.Pointer()->Get()); |
| 61 g_print_client_tls.Pointer()->Set(client); | 61 g_print_client_tls.Pointer()->Set(client); |
| 62 } | 62 } |
| 63 | 63 |
| 64 int32_t PepperPDFHost::OnResourceMessageReceived( | 64 int32_t PepperPDFHost::OnResourceMessageReceived( |
| 65 const IPC::Message& msg, | 65 const IPC::Message& msg, |
| 66 ppapi::host::HostMessageContext* context) { | 66 ppapi::host::HostMessageContext* context) { |
| 67 PPAPI_BEGIN_MESSAGE_MAP(PepperPDFHost, msg) | 67 PPAPI_BEGIN_MESSAGE_MAP(PepperPDFHost, msg) |
| 68 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_PDF_DidStartLoading, | 68 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_PDF_DidStartLoading, |
| 69 OnHostMsgDidStartLoading) | 69 OnHostMsgDidStartLoading) |
| 70 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_PDF_DidStopLoading, | 70 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_PDF_DidStopLoading, |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 } | 235 } |
| 236 } | 236 } |
| 237 | 237 |
| 238 content::RenderFrame* PepperPDFHost::GetRenderFrame() { | 238 content::RenderFrame* PepperPDFHost::GetRenderFrame() { |
| 239 content::PepperPluginInstance* instance = | 239 content::PepperPluginInstance* instance = |
| 240 host_->GetPluginInstance(pp_instance()); | 240 host_->GetPluginInstance(pp_instance()); |
| 241 return instance ? instance->GetRenderFrame() : nullptr; | 241 return instance ? instance->GetRenderFrame() : nullptr; |
| 242 } | 242 } |
| 243 | 243 |
| 244 } // namespace pdf | 244 } // namespace pdf |
| OLD | NEW |