Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / content / browser / appcache / appcache_manifest_parser.h
blob19685f8e705e587ab8af224bb4e3b3f4169fa1c2
1 // Copyright 2014 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 // This is a port of ManifestParser.h from WebKit/WebCore/loader/appcache.
7 /*
8 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
20 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
27 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_MANIFEST_PARSER_H_
33 #define CONTENT_BROWSER_APPCACHE_APPCACHE_MANIFEST_PARSER_H_
35 #include <string>
36 #include <vector>
38 #include "base/containers/hash_tables.h"
39 #include "content/common/appcache_interfaces.h"
40 #include "content/common/content_export.h"
42 class GURL;
44 namespace content {
46 struct CONTENT_EXPORT AppCacheManifest {
47 AppCacheManifest();
48 ~AppCacheManifest();
50 base::hash_set<std::string> explicit_urls;
51 AppCacheNamespaceVector intercept_namespaces;
52 AppCacheNamespaceVector fallback_namespaces;
53 AppCacheNamespaceVector online_whitelist_namespaces;
54 bool online_whitelist_all;
55 bool did_ignore_intercept_namespaces;
58 enum ParseMode {
59 PARSE_MANIFEST_PER_STANDARD,
60 PARSE_MANIFEST_ALLOWING_INTERCEPTS
63 CONTENT_EXPORT bool ParseManifest(
64 const GURL& manifest_url,
65 const char* data,
66 int length,
67 ParseMode parse_mode,
68 AppCacheManifest& manifest);
70 } // namespace content
72 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_MANIFEST_PARSER_H_