Chromium Code Reviews| 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 "components/pdf/common/pdf_messages.h" | 7 #include "components/pdf/common/pdf_messages.h" |
| 8 #include "content/public/common/referrer.h" | 8 #include "content/public/common/referrer.h" |
| 9 #include "content/public/renderer/pepper_plugin_instance.h" | 9 #include "content/public/renderer/pepper_plugin_instance.h" |
| 10 #include "content/public/renderer/render_thread.h" | 10 #include "content/public/renderer/render_thread.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 146 } | 146 } |
| 147 | 147 |
| 148 int32_t PepperPDFHost::OnHostMsgSaveAs( | 148 int32_t PepperPDFHost::OnHostMsgSaveAs( |
| 149 ppapi::host::HostMessageContext* context) { | 149 ppapi::host::HostMessageContext* context) { |
| 150 content::PepperPluginInstance* instance = | 150 content::PepperPluginInstance* instance = |
| 151 host_->GetPluginInstance(pp_instance()); | 151 host_->GetPluginInstance(pp_instance()); |
| 152 if (!instance) | 152 if (!instance) |
| 153 return PP_ERROR_FAILED; | 153 return PP_ERROR_FAILED; |
| 154 GURL url = instance->GetPluginURL(); | 154 GURL url = instance->GetPluginURL(); |
| 155 content::RenderView* render_view = instance->GetRenderView(); | 155 content::RenderView* render_view = instance->GetRenderView(); |
| 156 blink::WebLocalFrame* frame = | 156 content::Referrer referrer; |
| 157 render_view->GetWebView()->mainFrame()->toWebLocalFrame(); | 157 referrer.url = url; |
|
jochen (gone - plz use gerrit)
2015/12/09 15:41:33
can you still use the document's referrerPolicy?
Lei Zhang
2015/12/09 17:21:15
In my limited testing, the document's referrer pol
jochen (gone - plz use gerrit)
2015/12/10 15:34:05
hum, yeah.
so in the future, we'll be able to set
Lei Zhang
2015/12/10 21:57:38
Done.
| |
| 158 content::Referrer referrer = content::Referrer::SanitizeForRequest( | 158 referrer = content::Referrer::SanitizeForRequest(url, referrer); |
| 159 url, content::Referrer(frame->document().url(), | |
| 160 frame->document().referrerPolicy())); | |
| 161 render_view->Send( | 159 render_view->Send( |
| 162 new PDFHostMsg_PDFSaveURLAs(render_view->GetRoutingID(), url, referrer)); | 160 new PDFHostMsg_PDFSaveURLAs(render_view->GetRoutingID(), url, referrer)); |
| 163 return PP_OK; | 161 return PP_OK; |
| 164 } | 162 } |
| 165 | 163 |
| 166 int32_t PepperPDFHost::OnHostMsgSetSelectedText( | 164 int32_t PepperPDFHost::OnHostMsgSetSelectedText( |
| 167 ppapi::host::HostMessageContext* context, | 165 ppapi::host::HostMessageContext* context, |
| 168 const base::string16& selected_text) { | 166 const base::string16& selected_text) { |
| 169 content::PepperPluginInstance* instance = | 167 content::PepperPluginInstance* instance = |
| 170 host_->GetPluginInstance(pp_instance()); | 168 host_->GetPluginInstance(pp_instance()); |
| 171 if (!instance) | 169 if (!instance) |
| 172 return PP_ERROR_FAILED; | 170 return PP_ERROR_FAILED; |
| 173 instance->SetSelectedText(selected_text); | 171 instance->SetSelectedText(selected_text); |
| 174 return PP_OK; | 172 return PP_OK; |
| 175 } | 173 } |
| 176 | 174 |
| 177 int32_t PepperPDFHost::OnHostMsgSetLinkUnderCursor( | 175 int32_t PepperPDFHost::OnHostMsgSetLinkUnderCursor( |
| 178 ppapi::host::HostMessageContext* context, | 176 ppapi::host::HostMessageContext* context, |
| 179 const std::string& url) { | 177 const std::string& url) { |
| 180 content::PepperPluginInstance* instance = | 178 content::PepperPluginInstance* instance = |
| 181 host_->GetPluginInstance(pp_instance()); | 179 host_->GetPluginInstance(pp_instance()); |
| 182 if (!instance) | 180 if (!instance) |
| 183 return PP_ERROR_FAILED; | 181 return PP_ERROR_FAILED; |
| 184 instance->SetLinkUnderCursor(url); | 182 instance->SetLinkUnderCursor(url); |
| 185 return PP_OK; | 183 return PP_OK; |
| 186 } | 184 } |
| 187 | 185 |
| 188 } // namespace pdf | 186 } // namespace pdf |
| OLD | NEW |