| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 return true; | 549 return true; |
| 550 if (a == "net") | 550 if (a == "net") |
| 551 return b != "com"; | 551 return b != "com"; |
| 552 if (a == "org") | 552 if (a == "org") |
| 553 return b != "com" && b != "net"; | 553 return b != "com" && b != "net"; |
| 554 return false; | 554 return false; |
| 555 } | 555 } |
| 556 | 556 |
| 557 // static | 557 // static |
| 558 std::vector<std::string> Extension::GetDistinctHosts( | 558 std::vector<std::string> Extension::GetDistinctHosts( |
| 559 const URLPatternList& host_patterns, bool include_rcd) { | 559 const URLPatternList& host_patterns, |
| 560 bool include_rcd) { |
| 560 // Use a vector to preserve order (also faster than a map on small sets). | 561 // Use a vector to preserve order (also faster than a map on small sets). |
| 561 // Each item is a host split into two parts: host without RCDs and | 562 // Each item is a host split into two parts: host without RCDs and |
| 562 // current best RCD. | 563 // current best RCD. |
| 563 typedef std::vector<std::pair<std::string, std::string> > HostVector; | 564 typedef std::vector<std::pair<std::string, std::string> > HostVector; |
| 564 HostVector hosts_best_rcd; | 565 HostVector hosts_best_rcd; |
| 565 for (size_t i = 0; i < host_patterns.size(); ++i) { | 566 for (size_t i = 0; i < host_patterns.size(); ++i) { |
| 566 std::string host = host_patterns[i].host(); | 567 std::string host = host_patterns[i].host(); |
| 567 | 568 |
| 568 // Add the subdomain wildcard back to the host, if necessary. | 569 // Add the subdomain wildcard back to the host, if necessary. |
| 569 if (host_patterns[i].match_subdomains()) | 570 if (host_patterns[i].match_subdomains()) |
| (...skipping 2379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2949 | 2950 |
| 2950 UninstalledExtensionInfo::~UninstalledExtensionInfo() {} | 2951 UninstalledExtensionInfo::~UninstalledExtensionInfo() {} |
| 2951 | 2952 |
| 2952 | 2953 |
| 2953 UnloadedExtensionInfo::UnloadedExtensionInfo( | 2954 UnloadedExtensionInfo::UnloadedExtensionInfo( |
| 2954 const Extension* extension, | 2955 const Extension* extension, |
| 2955 Reason reason) | 2956 Reason reason) |
| 2956 : reason(reason), | 2957 : reason(reason), |
| 2957 already_disabled(false), | 2958 already_disabled(false), |
| 2958 extension(extension) {} | 2959 extension(extension) {} |
| OLD | NEW |