| OLD | NEW |
| 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/extensions/features/feature.h" | 5 #include "chrome/common/extensions/features/feature.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| 11 #include "base/stringprintf.h" | 11 #include "base/stringprintf.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
| 14 | 14 |
| 15 using chrome::VersionInfo; | 15 using chrome::VersionInfo; |
| 16 using extensions::Extension; | 16 using extensions::Extension; |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 struct Mappings { | 20 struct Mappings { |
| 21 Mappings() { | 21 Mappings() { |
| 22 extension_types["extension"] = Extension::TYPE_EXTENSION; | 22 extension_types["extension"] = Extension::TYPE_EXTENSION; |
| 23 extension_types["theme"] = Extension::TYPE_THEME; | 23 extension_types["theme"] = Extension::TYPE_THEME; |
| 24 extension_types["packaged_app"] = Extension::TYPE_PACKAGED_APP; | 24 extension_types["packaged_app"] |
| 25 = Extension::TYPE_LEGACY_PACKAGED_APP; |
| 25 extension_types["hosted_app"] = Extension::TYPE_HOSTED_APP; | 26 extension_types["hosted_app"] = Extension::TYPE_HOSTED_APP; |
| 26 extension_types["platform_app"] = Extension::TYPE_PLATFORM_APP; | 27 extension_types["platform_app"] = Extension::TYPE_PLATFORM_APP; |
| 27 | 28 |
| 28 contexts["blessed_extension"] = | 29 contexts["blessed_extension"] = |
| 29 extensions::Feature::BLESSED_EXTENSION_CONTEXT; | 30 extensions::Feature::BLESSED_EXTENSION_CONTEXT; |
| 30 contexts["unblessed_extension"] = | 31 contexts["unblessed_extension"] = |
| 31 extensions::Feature::UNBLESSED_EXTENSION_CONTEXT; | 32 extensions::Feature::UNBLESSED_EXTENSION_CONTEXT; |
| 32 contexts["content_script"] = extensions::Feature::CONTENT_SCRIPT_CONTEXT; | 33 contexts["content_script"] = extensions::Feature::CONTENT_SCRIPT_CONTEXT; |
| 33 contexts["web_page"] = extensions::Feature::WEB_PAGE_CONTEXT; | 34 contexts["web_page"] = extensions::Feature::WEB_PAGE_CONTEXT; |
| 34 | 35 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 139 |
| 139 // Gets a human-readable name for the given extension type. | 140 // Gets a human-readable name for the given extension type. |
| 140 std::string GetDisplayTypeName(Extension::Type type) { | 141 std::string GetDisplayTypeName(Extension::Type type) { |
| 141 switch (type) { | 142 switch (type) { |
| 142 case Extension::TYPE_UNKNOWN: | 143 case Extension::TYPE_UNKNOWN: |
| 143 return "unknown"; | 144 return "unknown"; |
| 144 case Extension::TYPE_EXTENSION: | 145 case Extension::TYPE_EXTENSION: |
| 145 return "extension"; | 146 return "extension"; |
| 146 case Extension::TYPE_HOSTED_APP: | 147 case Extension::TYPE_HOSTED_APP: |
| 147 return "hosted app"; | 148 return "hosted app"; |
| 148 case Extension::TYPE_PACKAGED_APP: | 149 case Extension::TYPE_LEGACY_PACKAGED_APP: |
| 149 return "legacy packaged app"; | 150 return "legacy packaged app"; |
| 150 case Extension::TYPE_PLATFORM_APP: | 151 case Extension::TYPE_PLATFORM_APP: |
| 151 return "packaged app"; | 152 return "packaged app"; |
| 152 case Extension::TYPE_THEME: | 153 case Extension::TYPE_THEME: |
| 153 return "theme"; | 154 return "theme"; |
| 154 case Extension::TYPE_USER_SCRIPT: | 155 case Extension::TYPE_USER_SCRIPT: |
| 155 return "user script"; | 156 return "user script"; |
| 156 } | 157 } |
| 157 | 158 |
| 158 NOTREACHED(); | 159 NOTREACHED(); |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 GetChannelName(channel_).c_str(), | 393 GetChannelName(channel_).c_str(), |
| 393 GetChannelName(GetCurrentChannel()).c_str()); | 394 GetChannelName(GetCurrentChannel()).c_str()); |
| 394 } | 395 } |
| 395 | 396 |
| 396 NOTREACHED(); | 397 NOTREACHED(); |
| 397 return ""; | 398 return ""; |
| 398 } | 399 } |
| 399 | 400 |
| 400 | 401 |
| 401 } // namespace extensions | 402 } // namespace extensions |
| OLD | NEW |