OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef CHROME_COMMON_EXTENSIONS_API_URL_HANDLERS_URL_HANDLERS_PARSER_H_ |
| 6 #define CHROME_COMMON_EXTENSIONS_API_URL_HANDLERS_URL_HANDLERS_PARSER_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "chrome/common/extensions/extension.h" |
| 12 #include "chrome/common/extensions/manifest_handler.h" |
| 13 #include "extensions/common/url_pattern.h" |
| 14 |
| 15 namespace extensions { |
| 16 |
| 17 struct UrlHandlerInfo { |
| 18 UrlHandlerInfo(); |
| 19 ~UrlHandlerInfo(); |
| 20 |
| 21 // ID identifying this handler in the manifest. |
| 22 std::string id; |
| 23 // Handler title to display in all relevant UI. |
| 24 std::string title; |
| 25 // URL patterns associated with this handler. |
| 26 URLPatternSet patterns; |
| 27 |
| 28 // Convenience back-reference to the parent app. |
| 29 const Extension* app; |
| 30 }; |
| 31 |
| 32 struct UrlHandlers : public Extension::ManifestData { |
| 33 UrlHandlers(); |
| 34 virtual ~UrlHandlers(); |
| 35 |
| 36 static const std::vector<UrlHandlerInfo>* GetUrlHandlers( |
| 37 const Extension* extension); |
| 38 |
| 39 std::vector<UrlHandlerInfo> handlers; |
| 40 }; |
| 41 |
| 42 // Parses the "url_handlers" manifest key. |
| 43 class UrlHandlersParser : public ManifestHandler { |
| 44 public: |
| 45 UrlHandlersParser(); |
| 46 virtual ~UrlHandlersParser(); |
| 47 |
| 48 // ManifestHandler API |
| 49 virtual bool Parse(Extension* extension, string16* error) OVERRIDE; |
| 50 |
| 51 private: |
| 52 virtual const std::vector<std::string> Keys() const OVERRIDE; |
| 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(UrlHandlersParser); |
| 55 }; |
| 56 |
| 57 } // namespace extensions |
| 58 |
| 59 #endif // CHROME_COMMON_EXTENSIONS_API_URL_HANDLERS_URL_HANDLERS_PARSER_H_ |
OLD | NEW |