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

Unified Diff: components/ntp_snippets/category_factory.h

Issue 2568033005: [NTP::SectionOrder] Replace CategoryFactory with a category ranker. (Closed)
Patch Set: rebase. Created 4 years 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
« no previous file with comments | « components/ntp_snippets/category.cc ('k') | components/ntp_snippets/category_factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/ntp_snippets/category_factory.h
diff --git a/components/ntp_snippets/category_factory.h b/components/ntp_snippets/category_factory.h
deleted file mode 100644
index c3941eaea2f31949c00d11fac2e87bff6ce17732..0000000000000000000000000000000000000000
--- a/components/ntp_snippets/category_factory.h
+++ /dev/null
@@ -1,61 +0,0 @@
-// 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_NTP_SNIPPETS_CATEGORY_FACTORY_H_
-#define COMPONENTS_NTP_SNIPPETS_CATEGORY_FACTORY_H_
-
-#include <map>
-#include <string>
-#include <vector>
-
-#include "base/macros.h"
-#include "components/ntp_snippets/category.h"
-
-namespace ntp_snippets {
-
-// Creates and orders Category instances.
-class CategoryFactory {
- public:
- CategoryFactory();
- ~CategoryFactory();
-
- // Creates a category from a KnownCategory value. The passed |known_category|
- // must not be one of the special values (LOCAL_CATEGORIES_COUNT or
- // REMOTE_CATEGORIES_OFFSET).
- Category FromKnownCategory(KnownCategories known_category);
-
- // Creates a category from a category identifier delivered by the server.
- // |remote_category| must be positive.
- // Note that remote categories are ordered in the order in which they were
- // first created by calling this method.
- Category FromRemoteCategory(int remote_category);
-
- // Creates a category from an ID as returned by |Category::id()|.
- // |id| must be a non-negative value.
- Category FromIDValue(int id);
-
- // Compares the given categories according to a strict ordering, returning
- // true if and only if |left| is strictly less than |right|.
- // This method satisfies the "Compare" contract required by sort algorithms.
- // The order is determined as follows: All local categories go first, in a
- // specific order hard-coded in the |CategoryFactory| constructor. All remote
- // categories follow in the order in which they were first created through
- // |FromRemoteCategory|.
- bool CompareCategories(const Category& left, const Category& right) const;
-
- private:
- bool CategoryExists(int id);
- void AddKnownCategory(KnownCategories known_category);
- Category InternalFromID(int id);
-
- // Stores all known categories in the order which is also returned by
- // |CompareCategories|.
- std::vector<Category> ordered_categories_;
-
- DISALLOW_COPY_AND_ASSIGN(CategoryFactory);
-};
-
-} // namespace ntp_snippets
-
-#endif // COMPONENTS_NTP_SNIPPETS_CATEGORY_FACTORY_H_
« no previous file with comments | « components/ntp_snippets/category.cc ('k') | components/ntp_snippets/category_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698