| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "extensions/common/manifest.h" | 5 #include "extensions/common/manifest.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 // An extension installed from two locations will have the location | 27 // An extension installed from two locations will have the location |
| 28 // with the higher rank, as returned by this function. The actual | 28 // with the higher rank, as returned by this function. The actual |
| 29 // integer values may change, and should never be persisted. | 29 // integer values may change, and should never be persisted. |
| 30 int GetLocationRank(Manifest::Location location) { | 30 int GetLocationRank(Manifest::Location location) { |
| 31 const int kInvalidRank = -1; | 31 const int kInvalidRank = -1; |
| 32 int rank = kInvalidRank; // Will CHECK that rank is not kInvalidRank. | 32 int rank = kInvalidRank; // Will CHECK that rank is not kInvalidRank. |
| 33 | 33 |
| 34 switch (location) { | 34 switch (location) { |
| 35 // Component extensions can not be overriden by any other type. | 35 // Component extensions can not be overriden by any other type. |
| 36 case Manifest::COMPONENT: | 36 case Manifest::COMPONENT: |
| 37 rank = 7; | 37 rank = 8; |
| 38 break; | 38 break; |
| 39 | 39 |
| 40 // Policy controlled extensions may not be overridden by any type | 40 // Policy controlled extensions may not be overridden by any type |
| 41 // that is not part of chrome. | 41 // that is not part of chrome. |
| 42 case Manifest::EXTERNAL_POLICY: |
| 43 rank = 7; |
| 44 break; |
| 45 |
| 42 case Manifest::EXTERNAL_POLICY_DOWNLOAD: | 46 case Manifest::EXTERNAL_POLICY_DOWNLOAD: |
| 43 rank = 6; | 47 rank = 6; |
| 44 break; | 48 break; |
| 45 | 49 |
| 46 // A developer-loaded extension should override any installed type | 50 // A developer-loaded extension should override any installed type |
| 47 // that a user can disable. Anything specified on the command-line should | 51 // that a user can disable. Anything specified on the command-line should |
| 48 // override one loaded via the extensions UI. | 52 // override one loaded via the extensions UI. |
| 49 case Manifest::COMMAND_LINE: | 53 case Manifest::COMMAND_LINE: |
| 50 rank = 5; | 54 rank = 5; |
| 51 break; | 55 break; |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 Feature* feature = FeatureProvider::GetByName("manifest")->GetFeature(key); | 252 Feature* feature = FeatureProvider::GetByName("manifest")->GetFeature(key); |
| 249 if (!feature) | 253 if (!feature) |
| 250 return true; | 254 return true; |
| 251 | 255 |
| 252 return feature->IsAvailableToManifest( | 256 return feature->IsAvailableToManifest( |
| 253 extension_id_, type_, Feature::ConvertLocation(location_), | 257 extension_id_, type_, Feature::ConvertLocation(location_), |
| 254 GetManifestVersion()).is_available(); | 258 GetManifestVersion()).is_available(); |
| 255 } | 259 } |
| 256 | 260 |
| 257 } // namespace extensions | 261 } // namespace extensions |
| OLD | NEW |