OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 #ifndef COMPONENTS_OFFLINE_PAGES_CLIENT_POLICY_CONTROLLER_H_ |
| 6 #define COMPONENTS_OFFLINE_PAGES_CLIENT_POLICY_CONTROLLER_H_ |
| 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include <map> |
| 11 #include <string> |
| 12 |
| 13 #include "base/time/time.h" |
| 14 #include "components/offline_pages/offline_page_client_policy.h" |
| 15 |
| 16 namespace offline_pages { |
| 17 |
| 18 // Currently used for fallbacks like tests. |
| 19 static const char kDefaultNamespace[] = "default"; |
| 20 |
| 21 // This is the class which is a singleton for offline page model |
| 22 // to get client policies based on namespaces. |
| 23 class ClientPolicyController { |
| 24 public: |
| 25 ClientPolicyController(); |
| 26 ~ClientPolicyController(); |
| 27 |
| 28 // Generates a client policy from the input values. |
| 29 static const OfflinePageClientPolicy MakePolicy( |
| 30 const std::string& name_space, |
| 31 LifetimePolicy::LifetimeType lifetime_type, |
| 32 const base::TimeDelta& expiration_period, |
| 33 int page_limit); |
| 34 |
| 35 // Get the client policy for |name_space|. |
| 36 const OfflinePageClientPolicy& GetPolicy(const std::string& name_space) const; |
| 37 |
| 38 private: |
| 39 // The map from name_space to a client policy. Will be generated |
| 40 // as pre-defined values for now. |
| 41 std::map<std::string, OfflinePageClientPolicy> policies_; |
| 42 |
| 43 DISALLOW_COPY_AND_ASSIGN(ClientPolicyController); |
| 44 }; |
| 45 |
| 46 } // namespace offline_pages |
| 47 |
| 48 #endif // COMPONENTS_OFFLINE_PAGES_CLIENT_POLICY_CONTROLLER_H_ |
OLD | NEW |