blob: bccc652a851c453ae0b3399ce32c7ab45d672668 [file] [log] [blame]
[email protected]7ee2e882012-06-04 08:54:101// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]f430b5712009-08-21 21:46:312// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
tfarinabccc34c72015-02-27 21:32:155#ifndef CONTENT_COMMON_APPCACHE_INTERFACES_H_
6#define CONTENT_COMMON_APPCACHE_INTERFACES_H_
[email protected]f430b5712009-08-21 21:46:317
avia9aa7a82015-12-25 03:06:318#include <stdint.h>
9
[email protected]7e8e3dd2009-09-18 01:05:0910#include <string>
[email protected]ad677772013-06-29 14:18:3811
[email protected]57999812013-02-24 05:40:5212#include "base/files/file_path.h"
Nicholas Verne8a13f0052017-12-01 00:39:1913#include "content/common/appcache.mojom.h"
[email protected]98d6d4562014-06-25 20:57:5514#include "content/public/common/appcache_info.h"
Anantanarayanan Iyengar2130d272017-09-01 18:21:1415#include "mojo/public/cpp/system/message_pipe.h"
[email protected]f430b5712009-08-21 21:46:3116
[email protected]edfe7fab2010-11-28 13:11:5217namespace net {
[email protected]7e8e3dd2009-09-18 01:05:0918class URLRequest;
[email protected]ad677772013-06-29 14:18:3819}
[email protected]f430b5712009-08-21 21:46:3120
[email protected]98d6d4562014-06-25 20:57:5521namespace content {
[email protected]f430b5712009-08-21 21:46:3122
23// Defines constants, types, and abstract classes used in the main
24// process and in child processes.
25
Nicholas Verne8a13f0052017-12-01 00:39:1926using mojom::AppCacheEventID;
27using mojom::AppCacheErrorReason;
28using mojom::AppCacheResourceInfo;
29using mojom::AppCacheErrorDetails;
[email protected]f430b5712009-08-21 21:46:3130
[email protected]653889b2013-02-18 15:42:4331// Temporarily renumber them in wierd way, to help remove LOG_TIP from WebKit
[email protected]45c6f682014-06-13 00:52:3432enum AppCacheLogLevel {
pfeldman2bcbc1222017-01-21 06:08:5433 APPCACHE_LOG_VERBOSE,
34 APPCACHE_LOG_INFO,
35 APPCACHE_LOG_WARNING,
36 APPCACHE_LOG_ERROR
[email protected]53c570b2010-06-18 02:02:0537};
38
[email protected]45c6f682014-06-13 00:52:3439enum AppCacheNamespaceType {
[email protected]10f110fa2014-06-15 23:32:4640 APPCACHE_FALLBACK_NAMESPACE,
41 APPCACHE_INTERCEPT_NAMESPACE,
42 APPCACHE_NETWORK_NAMESPACE
[email protected]e2cadec82011-12-13 02:00:5343};
44
[email protected]98d6d4562014-06-25 20:57:5545struct CONTENT_EXPORT AppCacheNamespace {
46 AppCacheNamespace(); // Type is APPCACHE_FALLBACK_NAMESPACE by default.
47 AppCacheNamespace(AppCacheNamespaceType type, const GURL& url,
48 const GURL& target, bool is_pattern);
[email protected]98d6d4562014-06-25 20:57:5549 ~AppCacheNamespace();
[email protected]e2cadec82011-12-13 02:00:5350
[email protected]34e7dc62013-03-30 00:32:4251 bool IsMatch(const GURL& url) const;
52
[email protected]45c6f682014-06-13 00:52:3453 AppCacheNamespaceType type;
[email protected]e2cadec82011-12-13 02:00:5354 GURL namespace_url;
55 GURL target_url;
[email protected]34e7dc62013-03-30 00:32:4256 bool is_pattern;
[email protected]e2cadec82011-12-13 02:00:5357};
58
[email protected]19251af2010-05-13 18:24:4659// Interface used by backend (browser-process) to talk to frontend (renderer).
[email protected]98d6d4562014-06-25 20:57:5560class CONTENT_EXPORT AppCacheFrontend {
[email protected]f430b5712009-08-21 21:46:3161 public:
[email protected]ec5c1922010-07-28 03:14:3762 virtual void OnCacheSelected(
[email protected]98d6d4562014-06-25 20:57:5563 int host_id, const AppCacheInfo& info) = 0;
[email protected]f430b5712009-08-21 21:46:3164 virtual void OnStatusChanged(const std::vector<int>& host_ids,
[email protected]45c6f682014-06-13 00:52:3465 AppCacheStatus status) = 0;
[email protected]f430b5712009-08-21 21:46:3166 virtual void OnEventRaised(const std::vector<int>& host_ids,
[email protected]45c6f682014-06-13 00:52:3467 AppCacheEventID event_id) = 0;
[email protected]697af4a2010-05-25 21:15:3168 virtual void OnProgressEventRaised(const std::vector<int>& host_ids,
69 const GURL& url,
70 int num_total, int num_complete) = 0;
[email protected]45c6f682014-06-13 00:52:3471 virtual void OnErrorEventRaised(
72 const std::vector<int>& host_ids,
[email protected]98d6d4562014-06-25 20:57:5573 const AppCacheErrorDetails& details) = 0;
[email protected]5c7d5982010-07-12 09:12:5974 virtual void OnContentBlocked(int host_id,
75 const GURL& manifest_url) = 0;
[email protected]45c6f682014-06-13 00:52:3476 virtual void OnLogMessage(int host_id, AppCacheLogLevel log_level,
[email protected]53c570b2010-06-18 02:02:0577 const std::string& message) = 0;
Anantanarayanan Iyengar2130d272017-09-01 18:21:1478 // In the network service world, we pass the URLLoaderFactory instance to be
79 // used to issue subresource requeste in the |loader_factory_pipe_handle|
80 // parameter.
81 virtual void OnSetSubresourceFactory(
82 int host_id,
John Abd-El-Malekb165dc52018-01-18 17:12:1883 network::mojom::URLLoaderFactoryPtr url_loader_factory) = 0;
Anantanarayanan Iyengar2130d272017-09-01 18:21:1484
[email protected]f430b5712009-08-21 21:46:3185 virtual ~AppCacheFrontend() {}
86};
87
[email protected]7e8e3dd2009-09-18 01:05:0988// Useful string constants.
[email protected]98d6d4562014-06-25 20:57:5589CONTENT_EXPORT extern const char kHttpGETMethod[];
90CONTENT_EXPORT extern const char kHttpHEADMethod[];
[email protected]7e8e3dd2009-09-18 01:05:0991
[email protected]98d6d4562014-06-25 20:57:5592CONTENT_EXPORT bool IsSchemeSupportedForAppCache(const GURL& url);
93CONTENT_EXPORT bool IsMethodSupportedForAppCache(
94 const std::string& method);
[email protected]7e8e3dd2009-09-18 01:05:0995
[email protected]f430b5712009-08-21 21:46:3196} // namespace
97
tfarinabccc34c72015-02-27 21:32:1598#endif // CONTENT_COMMON_APPCACHE_INTERFACES_H_