Suppress tabs permission warning if there is already a browsingHistory warning.
[chromium-blink-merge.git] / chrome / common / extensions / docs / server2 / handler.py
blob8e5cae8a0d15a672b97674e8d9d5a6558864c87f
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
3 # found in the LICENSE file.
5 from cron_servlet import CronServlet
6 from instance_servlet import InstanceServlet
7 from patch_servlet import PatchServlet
8 from servlet import Servlet, Request, Response
9 from test_servlet import TestServlet
11 _DEFAULT_SERVLET = InstanceServlet.GetConstructor()
12 _SERVLETS = {
13 'cron': CronServlet,
14 'patch': PatchServlet,
15 'test': TestServlet,
18 class Handler(Servlet):
19 def Get(self):
20 path = self._request.path
22 if path.startswith('_'):
23 servlet_path = path[1:]
24 if not '/' in servlet_path:
25 servlet_path += '/'
26 servlet_name, servlet_path = servlet_path.split('/', 1)
27 servlet = _SERVLETS.get(servlet_name)
28 if servlet is None:
29 return Response.NotFound('"%s" servlet not found' % servlet_path)
30 else:
31 servlet_path = path
32 servlet = _DEFAULT_SERVLET
34 return servlet(
35 Request(servlet_path, self._request.host, self._request.headers)).Get()