Chromium Code Reviews| 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/memory/singleton.h" | |
| 14 #include "base/time/time.h" | |
| 15 #include "components/offline_pages/offline_page_client_policy.h" | |
| 16 | |
| 17 namespace offline_pages { | |
| 18 | |
| 19 // Currently used for fallbacks like tests. | |
| 20 static const char kDefaultPolicy[] = "defaultPolicy"; | |
| 21 | |
| 22 // This is the class which is a singleton for offline page model | |
| 23 // to get client policies based on name_spaces. | |
|
fgorski
2016/05/02 23:10:31
namespaces
romax
2016/05/03 00:29:24
Done.
| |
| 24 class ClientPolicyController { | |
| 25 public: | |
| 26 static ClientPolicyController* GetInstance(); | |
| 27 | |
| 28 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.
| |
| 29 | |
| 30 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.
| |
| 31 const std::string& name_space, | |
| 32 LifetimePolicy::LifetimeType lifetime_type, | |
| 33 const base::TimeDelta& expire_period, | |
|
fgorski
2016/05/02 23:10:31
nit: expiration_period
romax
2016/05/03 00:29:24
Done.
| |
| 34 int page_limit); | |
|
fgorski
2016/05/02 23:10:31
is this max number of pages?
romax
2016/05/03 00:29:24
yes
| |
| 35 | |
| 36 protected: | |
| 37 ClientPolicyController(); | |
| 38 virtual ~ClientPolicyController(); | |
| 39 | |
| 40 private: | |
| 41 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.
| |
| 42 | |
| 43 static ClientPolicyController* controller_; | |
| 44 | |
| 45 // The map from name_space to a client policy. Will be generated | |
| 46 // as pre-defined values for now. | |
| 47 std::map<std::string, OfflinePageClientPolicy> policies_; | |
| 48 | |
| 49 DISALLOW_COPY_AND_ASSIGN(ClientPolicyController); | |
| 50 }; | |
| 51 | |
| 52 } // namespace offline_pages | |
| 53 | |
| 54 #endif // COMPONENTS_OFFLINE_PAGES_CLIENT_POLICY_CONTROLLER_H_ | |
| OLD | NEW |