Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(375)

Unified Diff: components/offline_pages/client_policy_controller.h

Issue 2364253002: [Offline Pages] Adds new policy bits and reverse lookup. (Closed)
Patch Set: Rename. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
index 55da43d5965dda98ea0196399521d4ac3126ea70..2d89cc923d5a36555eaba0c2f1108abcbee19e2b 100644
--- a/components/offline_pages/client_policy_controller.h
+++ b/components/offline_pages/client_policy_controller.h
@@ -8,7 +8,9 @@
#include <stdint.h>
#include <map>
+#include <memory>
#include <string>
+#include <vector>
#include "base/time/time.h"
#include "components/offline_pages/offline_page_client_policy.h"
@@ -38,12 +40,29 @@ class ClientPolicyController {
// Returns whether pages for |name_space| are shown in Download UI.
bool IsSupportedByDownload(const std::string& name_space) const;
+ const std::vector<std::string>& GetNamespacesSupportedByDownload() const;
+
+ // Returns whether pages for |name_space| are shown in recent tabs UI,
+ // currently only available on NTP.
+ bool IsShownAsRecentlyVisitedSite(const std::string& name_space) const;
+ const std::vector<std::string>& GetNamespacesShownAsRecentlyVisitedSite()
+ const;
+
+ // Returns whether pages for |name_space| should never be shown outside the
+ // tab they were generated in.
+ bool IsRestrictedToOriginalTab(const std::string& name_space) const;
+ const std::vector<std::string>& GetNamespacesRestrictedToOriginalTab() const;
private:
// The map from name_space to a client policy. Will be generated
// as pre-defined values for now.
std::map<std::string, OfflinePageClientPolicy> policies_;
+ // Memoizing results.
+ mutable std::unique_ptr<std::vector<std::string>> download_namespace_cache_;
+ mutable std::unique_ptr<std::vector<std::string>> recent_tab_namespace_cache_;
+ mutable std::unique_ptr<std::vector<std::string>> show_in_original_tab_cache_;
+
DISALLOW_COPY_AND_ASSIGN(ClientPolicyController);
};
« no previous file with comments | « chrome/browser/android/offline_pages/offline_page_utils.cc ('k') | components/offline_pages/client_policy_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698