Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(340)

Side by Side Diff: chrome/common/chrome_content_client.cc

Issue 96233002: Add a PDF component extension (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/common/chrome_content_client.h" 5 #include "chrome/common/chrome_content_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/cpu.h" 8 #include "base/cpu.h"
9 #include "base/debug/crash_logging.h" 9 #include "base/debug/crash_logging.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) && \ 55 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) && \
56 !defined(WIDEVINE_CDM_IS_COMPONENT) 56 !defined(WIDEVINE_CDM_IS_COMPONENT)
57 #include "chrome/common/widevine_cdm_constants.h" 57 #include "chrome/common/widevine_cdm_constants.h"
58 #endif 58 #endif
59 59
60 namespace { 60 namespace {
61 61
62 const char kPDFPluginMimeType[] = "application/pdf"; 62 const char kPDFPluginMimeType[] = "application/pdf";
63 const char kPDFPluginExtension[] = "pdf"; 63 const char kPDFPluginExtension[] = "pdf";
64 const char kPDFPluginDescription[] = "Portable Document Format"; 64 const char kPDFPluginDescription[] = "Portable Document Format";
65 const char kPDFPluginPrintPreviewMimeType 65 const char kPDFPluginPrintPreviewMimeType[] =
66 [] = "application/x-google-chrome-print-preview-pdf"; 66 "application/x-google-chrome-print-preview-pdf";
67 const char kPDFPluginOutOfProcessMimeType[] =
68 "application/x-google-chrome-pdf";
67 const uint32 kPDFPluginPermissions = ppapi::PERMISSION_PRIVATE | 69 const uint32 kPDFPluginPermissions = ppapi::PERMISSION_PRIVATE |
68 ppapi::PERMISSION_DEV; 70 ppapi::PERMISSION_DEV;
69 71
70 const char kNaClPluginMimeType[] = "application/x-nacl"; 72 const char kNaClPluginMimeType[] = "application/x-nacl";
71 const char kNaClPluginExtension[] = ""; 73 const char kNaClPluginExtension[] = "";
72 const char kNaClPluginDescription[] = "Native Client Executable"; 74 const char kNaClPluginDescription[] = "Native Client Executable";
73 const uint32 kNaClPluginPermissions = ppapi::PERMISSION_PRIVATE | 75 const uint32 kNaClPluginPermissions = ppapi::PERMISSION_PRIVATE |
74 ppapi::PERMISSION_DEV; 76 ppapi::PERMISSION_DEV;
75 77
76 const char kPnaclPluginMimeType[] = "application/x-pnacl"; 78 const char kPnaclPluginMimeType[] = "application/x-pnacl";
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 // but (on Linux) this function is always called once before we're sandboxed. 144 // but (on Linux) this function is always called once before we're sandboxed.
143 // So the first time through test if the file is available and then skip the 145 // So the first time through test if the file is available and then skip the
144 // check on subsequent calls if yes. 146 // check on subsequent calls if yes.
145 static bool skip_pdf_file_check = false; 147 static bool skip_pdf_file_check = false;
146 base::FilePath path; 148 base::FilePath path;
147 if (PathService::Get(chrome::FILE_PDF_PLUGIN, &path)) { 149 if (PathService::Get(chrome::FILE_PDF_PLUGIN, &path)) {
148 if (skip_pdf_file_check || base::PathExists(path)) { 150 if (skip_pdf_file_check || base::PathExists(path)) {
149 content::PepperPluginInfo pdf; 151 content::PepperPluginInfo pdf;
150 pdf.path = path; 152 pdf.path = path;
151 pdf.name = ChromeContentClient::kPDFPluginName; 153 pdf.name = ChromeContentClient::kPDFPluginName;
152 content::WebPluginMimeType pdf_mime_type(kPDFPluginMimeType,
153 kPDFPluginExtension,
154 kPDFPluginDescription);
155 content::WebPluginMimeType print_preview_pdf_mime_type(
156 kPDFPluginPrintPreviewMimeType,
157 kPDFPluginExtension,
158 kPDFPluginDescription);
159 pdf.mime_types.push_back(pdf_mime_type);
160 pdf.mime_types.push_back(print_preview_pdf_mime_type);
161 pdf.permissions = kPDFPluginPermissions;
162 if (CommandLine::ForCurrentProcess()->HasSwitch( 154 if (CommandLine::ForCurrentProcess()->HasSwitch(
163 switches::kOutOfProcessPdf)) { 155 switches::kOutOfProcessPdf)) {
164 pdf.is_out_of_process = true; 156 pdf.is_out_of_process = true;
157 content::WebPluginMimeType pdf_mime_type(kPDFPluginOutOfProcessMimeType,
158 kPDFPluginExtension,
159 kPDFPluginDescription);
160 pdf.mime_types.push_back(pdf_mime_type);
161 // TODO(raymes): Make print preview work with out of process PDF.
162 } else {
163 content::WebPluginMimeType pdf_mime_type(kPDFPluginMimeType,
164 kPDFPluginExtension,
165 kPDFPluginDescription);
166 content::WebPluginMimeType print_preview_pdf_mime_type(
167 kPDFPluginPrintPreviewMimeType,
168 kPDFPluginExtension,
169 kPDFPluginDescription);
170 pdf.mime_types.push_back(pdf_mime_type);
171 pdf.mime_types.push_back(print_preview_pdf_mime_type);
165 } 172 }
173 pdf.permissions = kPDFPluginPermissions;
166 plugins->push_back(pdf); 174 plugins->push_back(pdf);
167 175
168 skip_pdf_file_check = true; 176 skip_pdf_file_check = true;
169 } 177 }
170 } 178 }
171 179
172 // Handle Native Client just like the PDF plugin. This means that it is 180 // Handle Native Client just like the PDF plugin. This means that it is
173 // enabled by default for the non-portable case. This allows apps installed 181 // enabled by default for the non-portable case. This allows apps installed
174 // from the Chrome Web Store to use NaCl even if the command line switch 182 // from the Chrome Web Store to use NaCl even if the command line switch
175 // isn't set. For other uses of NaCl we check for the command line switch. 183 // isn't set. For other uses of NaCl we check for the command line switch.
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 *sandbox_profile_resource_id = IDR_NACL_SANDBOX_PROFILE; 565 *sandbox_profile_resource_id = IDR_NACL_SANDBOX_PROFILE;
558 return true; 566 return true;
559 } 567 }
560 return false; 568 return false;
561 } 569 }
562 570
563 std::string ChromeContentClient::GetCarbonInterposePath() const { 571 std::string ChromeContentClient::GetCarbonInterposePath() const {
564 return std::string(kInterposeLibraryPath); 572 return std::string(kInterposeLibraryPath);
565 } 573 }
566 #endif 574 #endif
OLDNEW
« no previous file with comments | « chrome/browser/resources/pdf/pdf.js ('k') | chrome/common/extensions/api/_manifest_features.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698