| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/extensions/extension.h" | 5 #include "chrome/common/extensions/extension.h" |
| 6 | 6 |
| 7 #include "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
| 8 #include "base/base64.h" |
| 8 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 9 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 10 #include "base/file_path.h" | 11 #include "base/file_path.h" |
| 11 #include "base/file_util.h" | 12 #include "base/file_util.h" |
| 12 #include "base/logging.h" | 13 #include "base/logging.h" |
| 13 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 14 #include "base/stl_util-inl.h" | 15 #include "base/stl_util-inl.h" |
| 15 #include "base/third_party/nss/blapi.h" | 16 #include "base/third_party/nss/blapi.h" |
| 16 #include "base/third_party/nss/sha256.h" | 17 #include "base/third_party/nss/sha256.h" |
| 17 #include "chrome/common/chrome_constants.h" | 18 #include "chrome/common/chrome_constants.h" |
| 18 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
| 19 #include "chrome/common/extensions/extension_constants.h" | 20 #include "chrome/common/extensions/extension_constants.h" |
| 20 #include "chrome/common/extensions/extension_error_reporter.h" | 21 #include "chrome/common/extensions/extension_error_reporter.h" |
| 21 #include "chrome/common/extensions/extension_error_utils.h" | 22 #include "chrome/common/extensions/extension_error_utils.h" |
| 22 #include "chrome/common/extensions/extension_l10n_util.h" | 23 #include "chrome/common/extensions/extension_l10n_util.h" |
| 23 #include "chrome/common/extensions/user_script.h" | 24 #include "chrome/common/extensions/user_script.h" |
| 24 #include "chrome/common/notification_service.h" | 25 #include "chrome/common/notification_service.h" |
| 25 #include "chrome/common/url_constants.h" | 26 #include "chrome/common/url_constants.h" |
| 26 #include "net/base/base64.h" | |
| 27 | 27 |
| 28 #if defined(OS_WIN) | 28 #if defined(OS_WIN) |
| 29 #include "base/registry.h" | 29 #include "base/registry.h" |
| 30 #endif | 30 #endif |
| 31 | 31 |
| 32 namespace keys = extension_manifest_keys; | 32 namespace keys = extension_manifest_keys; |
| 33 namespace values = extension_manifest_values; | 33 namespace values = extension_manifest_values; |
| 34 namespace errors = extension_manifest_errors; | 34 namespace errors = extension_manifest_errors; |
| 35 | 35 |
| 36 namespace { | 36 namespace { |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 if (end_pos == std::string::npos) | 536 if (end_pos == std::string::npos) |
| 537 return false; | 537 return false; |
| 538 if (start_pos >= end_pos) | 538 if (start_pos >= end_pos) |
| 539 return false; | 539 return false; |
| 540 | 540 |
| 541 working = working.substr(start_pos, end_pos - start_pos); | 541 working = working.substr(start_pos, end_pos - start_pos); |
| 542 if (working.length() == 0) | 542 if (working.length() == 0) |
| 543 return false; | 543 return false; |
| 544 } | 544 } |
| 545 | 545 |
| 546 return net::Base64Decode(working, output); | 546 return base::Base64Decode(working, output); |
| 547 } | 547 } |
| 548 | 548 |
| 549 bool Extension::ProducePEM(const std::string& input, | 549 bool Extension::ProducePEM(const std::string& input, |
| 550 std::string* output) { | 550 std::string* output) { |
| 551 CHECK(output); | 551 CHECK(output); |
| 552 if (input.length() == 0) | 552 if (input.length() == 0) |
| 553 return false; | 553 return false; |
| 554 | 554 |
| 555 return net::Base64Encode(input, output); | 555 return base::Base64Encode(input, output); |
| 556 } | 556 } |
| 557 | 557 |
| 558 bool Extension::FormatPEMForFileOutput(const std::string input, | 558 bool Extension::FormatPEMForFileOutput(const std::string input, |
| 559 std::string* output, | 559 std::string* output, |
| 560 bool is_public) { | 560 bool is_public) { |
| 561 CHECK(output); | 561 CHECK(output); |
| 562 if (input.length() == 0) | 562 if (input.length() == 0) |
| 563 return false; | 563 return false; |
| 564 *output = ""; | 564 *output = ""; |
| 565 output->append(kKeyBeginHeaderMarker); | 565 output->append(kKeyBeginHeaderMarker); |
| (...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1250 UserScript::PatternList::const_iterator pattern = | 1250 UserScript::PatternList::const_iterator pattern = |
| 1251 content_script->url_patterns().begin(); | 1251 content_script->url_patterns().begin(); |
| 1252 for (; pattern != content_script->url_patterns().end(); ++pattern) { | 1252 for (; pattern != content_script->url_patterns().end(); ++pattern) { |
| 1253 if (pattern->match_subdomains() && pattern->host().empty()) | 1253 if (pattern->match_subdomains() && pattern->host().empty()) |
| 1254 return true; | 1254 return true; |
| 1255 } | 1255 } |
| 1256 } | 1256 } |
| 1257 | 1257 |
| 1258 return false; | 1258 return false; |
| 1259 } | 1259 } |
| OLD | NEW |