| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/pdf/pdf_extension_util.h" | 5 #include "chrome/browser/pdf/pdf_extension_util.h" |
| 6 | 6 |
| 7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
| 8 #include "chrome/common/chrome_content_client.h" | 8 #include "chrome/common/chrome_content_client.h" |
| 9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
| 10 #include "chrome/grit/browser_resources.h" | 10 #include "chrome/grit/browser_resources.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 const char kPdfResourceIdentifier[] = "google-chrome-pdf"; | 31 const char kPdfResourceIdentifier[] = "google-chrome-pdf"; |
| 32 #else | 32 #else |
| 33 const char kPdfResourceIdentifier[] = "chromium-pdf"; | 33 const char kPdfResourceIdentifier[] = "chromium-pdf"; |
| 34 #endif | 34 #endif |
| 35 | 35 |
| 36 std::string GetManifest() { | 36 std::string GetManifest() { |
| 37 std::string manifest_contents = | 37 std::string manifest_contents = |
| 38 ResourceBundle::GetSharedInstance().GetRawDataResource( | 38 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 39 IDR_PDF_MANIFEST).as_string(); | 39 IDR_PDF_MANIFEST).as_string(); |
| 40 DCHECK(manifest_contents.find(kNameTag) != std::string::npos); | 40 DCHECK(manifest_contents.find(kNameTag) != std::string::npos); |
| 41 ReplaceFirstSubstringAfterOffset( | 41 base::ReplaceFirstSubstringAfterOffset( |
| 42 &manifest_contents, 0, kNameTag, ChromeContentClient::kPDFPluginName); | 42 &manifest_contents, 0, kNameTag, ChromeContentClient::kPDFPluginName); |
| 43 | 43 |
| 44 DCHECK(manifest_contents.find(kIndexTag) != std::string::npos); | 44 DCHECK(manifest_contents.find(kIndexTag) != std::string::npos); |
| 45 std::string index = switches::PdfMaterialUIEnabled() ? | 45 std::string index = switches::PdfMaterialUIEnabled() ? |
| 46 kMaterialIndex : kRegularIndex; | 46 kMaterialIndex : kRegularIndex; |
| 47 ReplaceSubstringsAfterOffset(&manifest_contents, 0, kIndexTag, index); | 47 base::ReplaceSubstringsAfterOffset(&manifest_contents, 0, kIndexTag, index); |
| 48 return manifest_contents; | 48 return manifest_contents; |
| 49 } | 49 } |
| 50 | 50 |
| 51 } // namespace pdf_extension_util | 51 } // namespace pdf_extension_util |
| OLD | NEW |