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

Unified Diff: content/common/background_fetch/background_fetch_types.h

Issue 2762573003: Implement BackgroundFetchManager.fetch() and struct traits (Closed)
Patch Set: First round of comments Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: content/common/background_fetch/background_fetch_types.h
diff --git a/content/common/background_fetch/background_fetch_types.h b/content/common/background_fetch/background_fetch_types.h
new file mode 100644
index 0000000000000000000000000000000000000000..27c520b58471197ab4b4c0c962ef76e67b730b9f
--- /dev/null
+++ b/content/common/background_fetch/background_fetch_types.h
@@ -0,0 +1,64 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_COMMON_BACKGROUND_FETCH_BACKGROUND_FETCH_TYPES_H_
+#define CONTENT_COMMON_BACKGROUND_FETCH_BACKGROUND_FETCH_TYPES_H_
+
+#include <stdint.h>
+#include <string>
+#include <vector>
+
+#include "content/common/content_export.h"
+
+namespace content {
+
+// Represents the definition of an icon developers can optionally provide with a
+// Background Fetch fetch. Analogous to the following structure in the spec:
+// https://wicg.github.io/background-fetch/#background-fetch-manager
+//
+// Parsing of the icon definitions as well as fetching an appropriate icon will
+// be done by Blink in the renderer process. The browser process is expected to
+// treat these values as opaque strings.
+struct CONTENT_EXPORT IconDefinition {
+ IconDefinition();
+ IconDefinition(const IconDefinition& other);
+ ~IconDefinition();
+
+ std::string src;
+ std::string sizes;
+ std::string type;
+};
+
+// Represents the optional options a developer can provide when starting a new
+// Background Fetch fetch. Analogous to the following structure in the spec:
+// https://wicg.github.io/background-fetch/#background-fetch-manager
+struct CONTENT_EXPORT BackgroundFetchOptions {
+ BackgroundFetchOptions();
+ BackgroundFetchOptions(const BackgroundFetchOptions& other);
+ ~BackgroundFetchOptions();
+
+ std::vector<IconDefinition> icons;
+ std::string title;
+ int64_t total_download_size = 0;
+};
+
+// Represents the information associated with a Background Fetch registration.
+// Analogous to the following structure in the spec:
+// https://wicg.github.io/background-fetch/#background-fetch-registration
+struct CONTENT_EXPORT BackgroundFetchRegistration {
+ BackgroundFetchRegistration();
+ BackgroundFetchRegistration(const BackgroundFetchRegistration& other);
+ ~BackgroundFetchRegistration();
+
+ std::string tag;
+ std::vector<IconDefinition> icons;
+ std::string title;
+ int64_t total_download_size = 0;
+
+ // TODO(peter): Support the `activeFetches` member of the specification.
+};
+
+} // namespace content
+
+#endif // CONTENT_COMMON_BACKGROUND_FETCH_BACKGROUND_FETCH_TYPES_H_

Powered by Google App Engine
This is Rietveld 408576698