| 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 "chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.h" | 5 #include "chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.h" |
| 6 | 6 |
| 7 #include "chrome/browser/download/download_stats.h" | 7 #include "chrome/browser/download/download_stats.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/browser_finder.h" | 9 #include "chrome/browser/ui/browser_finder.h" |
| 10 #include "chrome/browser/ui/browser_window.h" | 10 #include "chrome/browser/ui/browser_window.h" |
| 11 #include "chrome/browser/ui/location_bar/location_bar.h" | 11 #include "chrome/browser/ui/location_bar/location_bar.h" |
| 12 #include "chrome/browser/ui/pdf/pdf_unsupported_feature.h" | |
| 13 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" | 12 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
| 14 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_gues
t.h" | 13 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_gues
t.h" |
| 15 | 14 |
| 16 namespace { | 15 namespace { |
| 17 | 16 |
| 18 content::WebContents* GetWebContentsToUse( | 17 content::WebContents* GetWebContentsToUse( |
| 19 content::WebContents* web_contents) { | 18 content::WebContents* web_contents) { |
| 20 // If we're viewing the PDF in a MimeHandlerViewGuest, use its embedder | 19 // If we're viewing the PDF in a MimeHandlerViewGuest, use its embedder |
| 21 // WebContents. | 20 // WebContents. |
| 22 auto guest_view = | 21 auto guest_view = |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 int content_restrictions) { | 55 int content_restrictions) { |
| 57 CoreTabHelper* core_tab_helper = | 56 CoreTabHelper* core_tab_helper = |
| 58 CoreTabHelper::FromWebContents(GetWebContentsToUse(contents)); | 57 CoreTabHelper::FromWebContents(GetWebContentsToUse(contents)); |
| 59 // |core_tab_helper| is NULL for WebViewGuest. | 58 // |core_tab_helper| is NULL for WebViewGuest. |
| 60 if (core_tab_helper) | 59 if (core_tab_helper) |
| 61 core_tab_helper->UpdateContentRestrictions(content_restrictions); | 60 core_tab_helper->UpdateContentRestrictions(content_restrictions); |
| 62 } | 61 } |
| 63 | 62 |
| 64 void ChromePDFWebContentsHelperClient::OnPDFHasUnsupportedFeature( | 63 void ChromePDFWebContentsHelperClient::OnPDFHasUnsupportedFeature( |
| 65 content::WebContents* contents) { | 64 content::WebContents* contents) { |
| 66 PDFHasUnsupportedFeature(GetWebContentsToUse(contents)); | 65 // There is no more Adobe pluging for PDF so there is not much we can do in |
| 66 // this case. Maybe simply download the file. |
| 67 } | 67 } |
| 68 | 68 |
| 69 void ChromePDFWebContentsHelperClient::OnSaveURL( | 69 void ChromePDFWebContentsHelperClient::OnSaveURL( |
| 70 content::WebContents* contents) { | 70 content::WebContents* contents) { |
| 71 RecordDownloadSource(DOWNLOAD_INITIATED_BY_PDF_SAVE); | 71 RecordDownloadSource(DOWNLOAD_INITIATED_BY_PDF_SAVE); |
| 72 } | 72 } |
| OLD | NEW |