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

Unified Diff: components/offline_pages/offline_page_client_policy.h

Issue 1934743003: Implementing client policy and controller. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed macro and singleton. Addressed comments. Created 4 years, 8 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: components/offline_pages/offline_page_client_policy.h
diff --git a/components/offline_pages/offline_page_client_policy.h b/components/offline_pages/offline_page_client_policy.h
new file mode 100644
index 0000000000000000000000000000000000000000..ad426216150cd4de5dcf5bdb3f51f1c1e2abb538
--- /dev/null
+++ b/components/offline_pages/offline_page_client_policy.h
@@ -0,0 +1,55 @@
+// Copyright 2016 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 COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_CLIENT_POLICY_H_
+#define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_CLIENT_POLICY_H_
+
+#include <stdint.h>
+
+#include <string>
+
+#include "base/time/time.h"
+
+namespace offline_pages {
+
+static const int kUnlimitedPages = 0;
+
+// The struct describing the lifetime policy of offline pages.
+// The following behaviors are controlled by policy:
+// a. Persistency of the offline page.
+// b. Expiration time of an offline page
+// c. Limit of number of pages offline.
+struct LifetimePolicy {
+ // Type of the client, indicating where the archived page would be saved
+ // and whether it could be kept indefinitely.
+ enum class LifetimeType {
+ TEMPORARY,
+ PERSISTENT,
+ };
+
+ // Type of the page generated by the client.
+ LifetimeType lifetime_type;
+
+ // The time before the page expires.
fgorski 2016/05/03 04:43:07 s/before/after which/
romax 2016/05/03 17:42:22 Done.
+ base::TimeDelta expiration_period;
+
+ // The maximum number of pages allowed to be saved by the namespace.
+ // kUnlimitedPages (defined above) means no limit set.
+ int page_limit;
+};
+
+// The struct describing policies for various namespaces (Bookmark, Last-N etc.)
+// used by offline page model. The name_space is supposed to be key, so that
+// it's sufficient to compare name_space only when doing comparisons.
+struct OfflinePageClientPolicy {
+ // Namespace to which the policy applied.
+ std::string name_space;
+
+ // Policy to control the lifetime of a page generated by this namespace.
+ LifetimePolicy lifetime_policy;
+};
+
+} // namespace offline_pages
+
+#endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_CLIENT_POLICY_H_

Powered by Google App Engine
This is Rietveld 408576698