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

Side by Side Diff: components/ntp_snippets/category_factory.cc

Issue 2368583002: [NTP Snippets] Cleanups from clang-tidy (Closed)
Patch Set: rebase Created 4 years, 2 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 unified diff | Download patch
OLDNEW
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 #include "components/ntp_snippets/category_factory.h" 5 #include "components/ntp_snippets/category_factory.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 13 matching lines...) Expand all
24 AddKnownCategory(KnownCategories::DOWNLOADS); 24 AddKnownCategory(KnownCategories::DOWNLOADS);
25 AddKnownCategory(KnownCategories::RECENT_TABS); 25 AddKnownCategory(KnownCategories::RECENT_TABS);
26 AddKnownCategory(KnownCategories::FOREIGN_TABS); 26 AddKnownCategory(KnownCategories::FOREIGN_TABS);
27 AddKnownCategory(KnownCategories::BOOKMARKS); 27 AddKnownCategory(KnownCategories::BOOKMARKS);
28 AddKnownCategory(KnownCategories::PHYSICAL_WEB_PAGES); 28 AddKnownCategory(KnownCategories::PHYSICAL_WEB_PAGES);
29 29
30 DCHECK_EQ(static_cast<size_t>(KnownCategories::LOCAL_CATEGORIES_COUNT), 30 DCHECK_EQ(static_cast<size_t>(KnownCategories::LOCAL_CATEGORIES_COUNT),
31 ordered_categories_.size()); 31 ordered_categories_.size());
32 } 32 }
33 33
34 CategoryFactory::~CategoryFactory() {} 34 CategoryFactory::~CategoryFactory() = default;
35 35
36 Category CategoryFactory::FromKnownCategory(KnownCategories known_category) { 36 Category CategoryFactory::FromKnownCategory(KnownCategories known_category) {
37 if (known_category < KnownCategories::LOCAL_CATEGORIES_COUNT) { 37 if (known_category < KnownCategories::LOCAL_CATEGORIES_COUNT) {
38 // Local categories should have been added already. 38 // Local categories should have been added already.
39 DCHECK(CategoryExists(static_cast<int>(known_category))); 39 DCHECK(CategoryExists(static_cast<int>(known_category)));
40 } else { 40 } else {
41 DCHECK_GT(known_category, KnownCategories::REMOTE_CATEGORIES_OFFSET); 41 DCHECK_GT(known_category, KnownCategories::REMOTE_CATEGORIES_OFFSET);
42 } 42 }
43 return InternalFromID(static_cast<int>(known_category)); 43 return InternalFromID(static_cast<int>(known_category));
44 } 44 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 Category(id)); 109 Category(id));
110 if (it != ordered_categories_.end()) 110 if (it != ordered_categories_.end())
111 return *it; 111 return *it;
112 112
113 Category category(id); 113 Category category(id);
114 ordered_categories_.push_back(category); 114 ordered_categories_.push_back(category);
115 return category; 115 return category;
116 } 116 }
117 117
118 } // namespace ntp_snippets 118 } // namespace ntp_snippets
OLDNEW
« no previous file with comments | « components/ntp_snippets/bookmarks/bookmark_last_visit_utils_unittest.cc ('k') | components/ntp_snippets/category_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698