Chromium Code Reviews| 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..8b498c44942d9b3ee5d8c13139753a9d439ce53e |
| --- /dev/null |
| +++ b/components/offline_pages/client_policy_controller.h |
| @@ -0,0 +1,54 @@ |
| +// 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/memory/singleton.h" |
| +#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 kDefaultPolicy[] = "defaultPolicy"; |
| + |
| +// This is the class which is a singleton for offline page model |
| +// to get client policies based on name_spaces. |
|
fgorski
2016/05/02 23:10:31
namespaces
romax
2016/05/03 00:29:24
Done.
|
| +class ClientPolicyController { |
| + public: |
| + static ClientPolicyController* GetInstance(); |
| + |
| + const OfflinePageClientPolicy& GetPolicy(const std::string& name_space); |
|
fgorski
2016/05/02 23:10:32
name_space) const;
Add documentation:
* use |name
romax
2016/05/03 00:29:24
Done.
|
| + |
| + static const OfflinePageClientPolicy MakePolicy( |
|
fgorski
2016/05/02 23:10:31
put static methods first.
Add documentation.
romax
2016/05/03 00:29:24
Done.
|
| + const std::string& name_space, |
| + LifetimePolicy::LifetimeType lifetime_type, |
| + const base::TimeDelta& expire_period, |
|
fgorski
2016/05/02 23:10:31
nit: expiration_period
romax
2016/05/03 00:29:24
Done.
|
| + int page_limit); |
|
fgorski
2016/05/02 23:10:31
is this max number of pages?
romax
2016/05/03 00:29:24
yes
|
| + |
| + protected: |
| + ClientPolicyController(); |
| + virtual ~ClientPolicyController(); |
| + |
| + private: |
| + friend struct base::DefaultSingletonTraits<ClientPolicyController>; |
|
fgorski
2016/05/02 23:10:31
having read lines 5-12 in the https://code.google.
romax
2016/05/03 00:29:24
Acknowledged.
|
| + |
| + static ClientPolicyController* controller_; |
| + |
| + // 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_ |