Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: chrome/common/extensions/api/url_handlers/url_handlers_parser.h

Issue 23847004: "Redirecting URLs to Packaged Apps" implementation: revised (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed an editing error Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
benwells 2013/09/04 23:54:20 Tiny nit: no (c). The style changed from 2012 to
sergeygs 2013/09/05 09:19:03 Shouldn't we do one mass replacement and be done w
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 class GURL;
16
17 namespace extensions {
18
19 struct UrlHandlerInfo {
benwells 2013/09/04 23:54:20 Nit: These should be URLHandlerInfo...
sergeygs 2013/09/05 09:19:03 This is a recurring theme. I've talked to the peop
20 UrlHandlerInfo();
21 ~UrlHandlerInfo();
22
23 // ID identifying this handler in the manifest.
24 std::string id;
25 // Handler title to display in all relevant UI.
26 std::string title;
27 // URL patterns associated with this handler.
28 URLPatternSet patterns;
29 };
30
31 struct UrlHandlers : public Extension::ManifestData {
32 UrlHandlers();
33 virtual ~UrlHandlers();
34
35 // Returns an array of URL handlers |extension| has defined in its manifest.
36 static const std::vector<UrlHandlerInfo>* GetUrlHandlers(
37 const Extension* extension);
38
39 // Determines whether |extension| has at least one URL handler that matches
40 // |url|.
41 static bool CanExtensionHandleUrl(
42 const Extension* extension,
43 const GURL& url);
44
45 // Finds a matching URL handler for |extension|, if any. Returns NULL in none
46 // are found.
47 static const UrlHandlerInfo* FindMatchingUrlHandler(
48 const Extension* extension,
49 const GURL& url);
50
51 std::vector<UrlHandlerInfo> handlers;
52 };
53
54 // Parses the "url_handlers" manifest key.
55 class UrlHandlersParser : public ManifestHandler {
56 public:
57 UrlHandlersParser();
58 virtual ~UrlHandlersParser();
59
60 // ManifestHandler API
61 virtual bool Parse(Extension* extension, string16* error) OVERRIDE;
62
63 private:
64 virtual const std::vector<std::string> Keys() const OVERRIDE;
65
66 DISALLOW_COPY_AND_ASSIGN(UrlHandlersParser);
67 };
68
69 } // namespace extensions
70
71 #endif // CHROME_COMMON_EXTENSIONS_API_URL_HANDLERS_URL_HANDLERS_PARSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698