OLD | NEW |
| (Empty) |
1 # Copyright (c) 2013 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. | |
4 import os | |
5 | |
6 from telemetry.core.chrome import crx_id | |
7 | |
8 class ExtensionPathNonExistentException(Exception): | |
9 pass | |
10 | |
11 class ExtensionToLoad(object): | |
12 def __init__(self, path, is_component=False): | |
13 if not os.path.isdir(path): | |
14 raise ExtensionPathNonExistentException( | |
15 'Extension path not a directory %s' % path) | |
16 self._path = path | |
17 self._is_component = is_component | |
18 | |
19 @property | |
20 def extension_id(self): | |
21 """Unique extension id of this extension.""" | |
22 return crx_id.GetCRXAppID(os.path.abspath(self._path)) | |
23 | |
24 @property | |
25 def path(self): | |
26 """Path to extension directory.""" | |
27 return self._path | |
28 | |
29 @property | |
30 def is_component(self): | |
31 """Whether this extension should be loaded as a component extension.""" | |
32 return self._is_component | |
OLD | NEW |