1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 from path_util
import AssertIsValid
8 _EXTENSION_TYPES
= {'extensions': 'extension', 'apps': 'platform_app'}
12 return ('apps', 'extensions')
15 def GetExtensionTypes():
16 return ('platform_app', 'extension')
19 def ExtractPlatformFromURL(url
):
20 '''Returns 'apps' or 'extensions' depending on the URL.
23 platform
= url
.split('/', 1)[0]
24 if platform
not in GetPlatforms():
29 def PluralToSingular(platform
):
30 '''Converts 'apps' to 'app' and 'extensions' to 'extension'.
32 assert platform
in GetPlatforms(), platform
36 def PlatformToExtensionType(platform
):
37 assert platform
in GetPlatforms(), platform
38 return _EXTENSION_TYPES
[platform
]