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_CORE_CLIENT_POLICY_CONTROLLER_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_CLIENT_POLICY_CONTROLLER_H_ |
6 #define COMPONENTS_OFFLINE_PAGES_CORE_CLIENT_POLICY_CONTROLLER_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_CORE_CLIENT_POLICY_CONTROLLER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 // currently only available on NTP. | 49 // currently only available on NTP. |
50 bool IsShownAsRecentlyVisitedSite(const std::string& name_space) const; | 50 bool IsShownAsRecentlyVisitedSite(const std::string& name_space) const; |
51 const std::vector<std::string>& GetNamespacesShownAsRecentlyVisitedSite() | 51 const std::vector<std::string>& GetNamespacesShownAsRecentlyVisitedSite() |
52 const; | 52 const; |
53 | 53 |
54 // Returns whether pages for |name_space| should never be shown outside the | 54 // Returns whether pages for |name_space| should never be shown outside the |
55 // tab they were generated in. | 55 // tab they were generated in. |
56 bool IsRestrictedToOriginalTab(const std::string& name_space) const; | 56 bool IsRestrictedToOriginalTab(const std::string& name_space) const; |
57 const std::vector<std::string>& GetNamespacesRestrictedToOriginalTab() const; | 57 const std::vector<std::string>& GetNamespacesRestrictedToOriginalTab() const; |
58 | 58 |
| 59 bool IsDisabledWhenPrefetchDisabled(const std::string& name_space) const; |
| 60 const std::vector<std::string>& GetNamespacesDisabledWhenPrefetchDisabled() |
| 61 const; |
| 62 |
59 void AddPolicyForTest(const std::string& name_space, | 63 void AddPolicyForTest(const std::string& name_space, |
60 const OfflinePageClientPolicyBuilder& builder); | 64 const OfflinePageClientPolicyBuilder& builder); |
61 | 65 |
62 private: | 66 private: |
63 // The map from name_space to a client policy. Will be generated | 67 // The map from name_space to a client policy. Will be generated |
64 // as pre-defined values for now. | 68 // as pre-defined values for now. |
65 std::map<std::string, OfflinePageClientPolicy> policies_; | 69 std::map<std::string, OfflinePageClientPolicy> policies_; |
66 | 70 |
67 // Memoizing results. | 71 // Memoizing results. |
68 mutable std::unique_ptr<std::vector<std::string>> download_namespace_cache_; | 72 mutable std::unique_ptr<std::vector<std::string>> download_namespace_cache_; |
69 mutable std::unique_ptr<std::vector<std::string>> recent_tab_namespace_cache_; | 73 mutable std::unique_ptr<std::vector<std::string>> recent_tab_namespace_cache_; |
70 mutable std::unique_ptr<std::vector<std::string>> show_in_original_tab_cache_; | 74 mutable std::unique_ptr<std::vector<std::string>> show_in_original_tab_cache_; |
| 75 mutable std::unique_ptr<std::vector<std::string>> |
| 76 disabled_when_prefetch_disabled_cache_; |
71 | 77 |
72 DISALLOW_COPY_AND_ASSIGN(ClientPolicyController); | 78 DISALLOW_COPY_AND_ASSIGN(ClientPolicyController); |
73 }; | 79 }; |
74 | 80 |
75 } // namespace offline_pages | 81 } // namespace offline_pages |
76 | 82 |
77 #endif // COMPONENTS_OFFLINE_PAGES_CORE_CLIENT_POLICY_CONTROLLER_H_ | 83 #endif // COMPONENTS_OFFLINE_PAGES_CORE_CLIENT_POLICY_CONTROLLER_H_ |
OLD | NEW |