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

Unified Diff: components/offline_pages/client_policy_controller.h

Issue 2364253002: [Offline Pages] Adds new policy bits and reverse lookup. (Closed)
Patch Set: Construction order. 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..3084fc680b5fd2ef3ef75062122753f9c52c2dd3 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,28 @@ 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>& GetNamespacesWithDownloadSupport();
chili 2016/09/23 23:52:43 should these methods be const as well?
dewittj 2016/09/23 23:55:55 Because they are memoizing they are not actually c
chili 2016/09/24 00:00:19 Ah oops forgot about the memoizing bit. darn ^_^
Dmitry Titov 2016/09/24 00:09:29 I think naming-wise, those "get namespaces" method
dewittj 2016/09/26 23:00:31 Done.
+
+ // Returns whether pages for |name_space| are shown in recent tabs UI,
+ // currently only available on NTP.
+ bool IsRecentTab(const std::string& name_space) const;
Dmitry Titov 2016/09/24 00:09:29 What is this feature? Can't understand from the co
dewittj 2016/09/26 23:00:31 Done.
+ const std::vector<std::string>& GetNamespacesForRecentTabs();
+
+ // Returns whether pages for |name_space| should never be shown outside the
+ // tab they were generated in.
+ bool ShouldOnlyBeShownInOriginalTab(const std::string& name_space) const;
Dmitry Titov 2016/09/24 00:09:29 Naming suggestion: IsRestrictedToOriginalTab
dewittj 2016/09/26 23:00:31 Done.
+ const std::vector<std::string>& GetNamespacesToShowInOriginalTab();
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.
+ std::unique_ptr<std::vector<std::string>> download_namespace_cache_;
+ std::unique_ptr<std::vector<std::string>> recent_tab_namespace_cache_;
+ std::unique_ptr<std::vector<std::string>> show_in_original_tab_cache_;
+
DISALLOW_COPY_AND_ASSIGN(ClientPolicyController);
};

Powered by Google App Engine
This is Rietveld 408576698