Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_OFFLINE_PAGES_CLIENT_POLICY_CONTROLLER_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_CLIENT_POLICY_CONTROLLER_H_ |
| 6 #define COMPONENTS_OFFLINE_PAGES_CLIENT_POLICY_CONTROLLER_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_CLIENT_POLICY_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "components/offline_pages/offline_page_client_policy.h" | 14 #include "components/offline_pages/offline_page_client_policy.h" |
| 15 | 15 |
| 16 namespace offline_pages { | 16 namespace offline_pages { |
| 17 | 17 |
| 18 // This is the class which is a singleton for offline page model | 18 // This is the class which is a singleton for offline page model |
| 19 // to get client policies based on namespaces. | 19 // to get client policies based on namespaces. |
| 20 class ClientPolicyController { | 20 class ClientPolicyController { |
| 21 public: | 21 public: |
| 22 ClientPolicyController(); | 22 ClientPolicyController(); |
| 23 ~ClientPolicyController(); | 23 ~ClientPolicyController(); |
| 24 | 24 |
| 25 // Generates a client policy from the input values. | 25 // Generates a client policy from the input values. |
| 26 static const OfflinePageClientPolicy MakePolicy( | 26 static const OfflinePageClientPolicy MakePolicy( |
| 27 const std::string& name_space, | 27 const std::string& name_space, |
| 28 LifetimePolicy::LifetimeType lifetime_type, | 28 LifetimePolicy::LifetimeType lifetime_type, |
| 29 const base::TimeDelta& expiration_period, | 29 const base::TimeDelta& expiration_period, |
| 30 size_t page_limit); | 30 size_t page_limit, |
| 31 size_t pages_allowed_per_url); | |
|
chili
2016/06/20 18:17:47
just curious, and for my information... do we see
| |
| 31 | 32 |
| 32 // Get the client policy for |name_space|. | 33 // Get the client policy for |name_space|. |
| 33 const OfflinePageClientPolicy& GetPolicy(const std::string& name_space) const; | 34 const OfflinePageClientPolicy& GetPolicy(const std::string& name_space) const; |
| 34 | 35 |
| 35 private: | 36 private: |
| 36 // The map from name_space to a client policy. Will be generated | 37 // The map from name_space to a client policy. Will be generated |
| 37 // as pre-defined values for now. | 38 // as pre-defined values for now. |
| 38 std::map<std::string, OfflinePageClientPolicy> policies_; | 39 std::map<std::string, OfflinePageClientPolicy> policies_; |
| 39 | 40 |
| 40 DISALLOW_COPY_AND_ASSIGN(ClientPolicyController); | 41 DISALLOW_COPY_AND_ASSIGN(ClientPolicyController); |
| 41 }; | 42 }; |
| 42 | 43 |
| 43 } // namespace offline_pages | 44 } // namespace offline_pages |
| 44 | 45 |
| 45 #endif // COMPONENTS_OFFLINE_PAGES_CLIENT_POLICY_CONTROLLER_H_ | 46 #endif // COMPONENTS_OFFLINE_PAGES_CLIENT_POLICY_CONTROLLER_H_ |
| OLD | NEW |