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

Unified Diff: components/offline_pages/client_policy_controller.h

Issue 1934743003: Implementing client policy and controller. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « components/offline_pages/BUILD.gn ('k') | components/offline_pages/client_policy_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/offline_pages/client_policy_controller.h
diff --git a/components/offline_pages/client_policy_controller.h b/components/offline_pages/client_policy_controller.h
new file mode 100644
index 0000000000000000000000000000000000000000..3e086534ab4264ccf46f5c06ff02271bf0364257
--- /dev/null
+++ b/components/offline_pages/client_policy_controller.h
@@ -0,0 +1,48 @@
+// 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_CLIENT_POLICY_CONTROLLER_H_
+#define COMPONENTS_OFFLINE_PAGES_CLIENT_POLICY_CONTROLLER_H_
+
+#include <stdint.h>
+
+#include <map>
+#include <string>
+
+#include "base/time/time.h"
+#include "components/offline_pages/offline_page_client_policy.h"
+
+namespace offline_pages {
+
+// Currently used for fallbacks like tests.
+static const char kDefaultNamespace[] = "default";
+
+// This is the class which is a singleton for offline page model
+// to get client policies based on namespaces.
+class ClientPolicyController {
+ public:
+ ClientPolicyController();
+ ~ClientPolicyController();
+
+ // Generates a client policy from the input values.
+ static const OfflinePageClientPolicy MakePolicy(
+ const std::string& name_space,
+ LifetimePolicy::LifetimeType lifetime_type,
+ const base::TimeDelta& expiration_period,
+ int page_limit);
+
+ // Get the client policy for |name_space|.
+ const OfflinePageClientPolicy& GetPolicy(const std::string& name_space) const;
+
+ private:
+ // The map from name_space to a client policy. Will be generated
+ // as pre-defined values for now.
+ std::map<std::string, OfflinePageClientPolicy> policies_;
+
+ DISALLOW_COPY_AND_ASSIGN(ClientPolicyController);
+};
+
+} // namespace offline_pages
+
+#endif // COMPONENTS_OFFLINE_PAGES_CLIENT_POLICY_CONTROLLER_H_
« no previous file with comments | « components/offline_pages/BUILD.gn ('k') | components/offline_pages/client_policy_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698