Chromium Code Reviews| Index: chrome/common/extensions/docs/server2/resource_fetcher.py |
| diff --git a/chrome/common/extensions/docs/server2/resource_fetcher.py b/chrome/common/extensions/docs/server2/resource_fetcher.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..157fbfa74c5f3dc267b1048efdeb97237ad3a9e8 |
| --- /dev/null |
| +++ b/chrome/common/extensions/docs/server2/resource_fetcher.py |
| @@ -0,0 +1,25 @@ |
| +# Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +import logging |
|
Aaron Boodman
2012/05/24 06:10:23
not used
cduvall
2012/05/25 20:02:23
Done.
|
| + |
| +SUBVERSION_URL = 'http://src.chromium.org/viewvc/chrome/' |
| +TRUNK_URL = SUBVERSION_URL + 'trunk/' |
| +BRANCH_URL = SUBVERSION_URL + 'branches/' |
| + |
| +class SubversionFetcher(object): |
| + """Class to fetch code from src.chromium.org. |
| + """ |
| + def __init__(self, urlfetch): |
| + self.urlfetch = urlfetch |
| + |
| + def _GetURLFromBranch(self, branch): |
| + if branch == 'trunk': |
| + return TRUNK_URL |
| + return BRANCH_URL + branch + '/' |
| + |
| + def FetchResource(self, branch, path): |
| + url = self._GetURLFromBranch(branch) + path |
| + result = self.urlfetch.fetch(url) |
| + return result |