Move ContentSuggestions identifiers to custom target
This CL moves the identifier used in ContentSuggestions to a custom target,
allowing an easier include in future refactoring.
BUG=694159
Review-Url: https://codereview.chromium.org/2762643003
Cr-Commit-Position: refs/heads/master@{#458105}
diff --git a/ios/chrome/browser/content_suggestions/BUILD.gn b/ios/chrome/browser/content_suggestions/BUILD.gn
index d492361d..d951291 100644
--- a/ios/chrome/browser/content_suggestions/BUILD.gn
+++ b/ios/chrome/browser/content_suggestions/BUILD.gn
@@ -23,6 +23,7 @@
"//ios/chrome/browser/ui",
"//ios/chrome/browser/ui/alert_coordinator",
"//ios/chrome/browser/ui/content_suggestions",
+ "//ios/chrome/browser/ui/content_suggestions/identifier",
"//ios/web",
"//ui/base",
"//ui/strings",
diff --git a/ios/chrome/browser/content_suggestions/content_suggestions_coordinator.mm b/ios/chrome/browser/content_suggestions/content_suggestions_coordinator.mm
index 8aecdea..bfc996a 100644
--- a/ios/chrome/browser/content_suggestions/content_suggestions_coordinator.mm
+++ b/ios/chrome/browser/content_suggestions/content_suggestions_coordinator.mm
@@ -11,10 +11,10 @@
#import "ios/chrome/browser/content_suggestions/content_suggestions_mediator.h"
#include "ios/chrome/browser/ntp_snippets/ios_chrome_content_suggestions_service_factory.h"
#import "ios/chrome/browser/ui/alert_coordinator/action_sheet_coordinator.h"
-#import "ios/chrome/browser/ui/content_suggestions/content_suggestion_identifier.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_commands.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.h"
+#import "ios/chrome/browser/ui/content_suggestions/identifier/content_suggestion_identifier.h"
#import "ios/chrome/browser/ui/url_loader.h"
#include "ios/chrome/grit/ios_strings.h"
#include "ios/web/public/referrer.h"
diff --git a/ios/chrome/browser/content_suggestions/content_suggestions_mediator.mm b/ios/chrome/browser/content_suggestions/content_suggestions_mediator.mm
index b600a6b..f9ed02e 100644
--- a/ios/chrome/browser/content_suggestions/content_suggestions_mediator.mm
+++ b/ios/chrome/browser/content_suggestions/content_suggestions_mediator.mm
@@ -14,10 +14,10 @@
#import "ios/chrome/browser/content_suggestions/content_suggestions_category_wrapper.h"
#import "ios/chrome/browser/content_suggestions/content_suggestions_service_bridge_observer.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestion.h"
-#import "ios/chrome/browser/ui/content_suggestions/content_suggestion_identifier.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_data_sink.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_image_fetcher.h"
-#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_section_information.h"
+#import "ios/chrome/browser/ui/content_suggestions/identifier/content_suggestion_identifier.h"
+#import "ios/chrome/browser/ui/content_suggestions/identifier/content_suggestions_section_information.h"
#include "ios/chrome/grit/ios_strings.h"
#include "ui/base/l10n/l10n_util_mac.h"
#include "ui/gfx/image/image.h"
diff --git a/ios/chrome/browser/ui/content_suggestions/BUILD.gn b/ios/chrome/browser/ui/content_suggestions/BUILD.gn
index 0e274b4..4c1aa80 100644
--- a/ios/chrome/browser/ui/content_suggestions/BUILD.gn
+++ b/ios/chrome/browser/ui/content_suggestions/BUILD.gn
@@ -7,8 +7,6 @@
sources = [
"content_suggestion.h",
"content_suggestion.mm",
- "content_suggestion_identifier.h",
- "content_suggestion_identifier.mm",
"content_suggestions_article_item.h",
"content_suggestions_article_item.mm",
"content_suggestions_collection_updater.h",
@@ -25,8 +23,6 @@
"content_suggestions_footer_item.h",
"content_suggestions_footer_item.mm",
"content_suggestions_image_fetcher.h",
- "content_suggestions_section_information.h",
- "content_suggestions_section_information.mm",
"content_suggestions_stack_item.h",
"content_suggestions_stack_item.mm",
"content_suggestions_stack_item_actions.h",
@@ -42,6 +38,7 @@
"//ios/chrome/browser/ui",
"//ios/chrome/browser/ui/collection_view",
"//ios/chrome/browser/ui/colors",
+ "//ios/chrome/browser/ui/content_suggestions/identifier",
"//ios/chrome/browser/ui/util",
"//ios/third_party/material_roboto_font_loader_ios",
"//ui/base",
@@ -56,7 +53,6 @@
configs += [ "//build/config/compiler:enable_arc" ]
testonly = true
sources = [
- "content_suggestion_identifier_unittest.mm",
"content_suggestions_article_item_unittest.mm",
"content_suggestions_expandable_item_unittest.mm",
"content_suggestions_favicon_item_unittest.mm",
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestion.h b/ios/chrome/browser/ui/content_suggestions/content_suggestion.h
index 472628c0..227275f 100644
--- a/ios/chrome/browser/ui/content_suggestions/content_suggestion.h
+++ b/ios/chrome/browser/ui/content_suggestions/content_suggestion.h
@@ -7,13 +7,14 @@
#import <UIKit/UIKit.h>
-#import "ios/chrome/browser/ui/content_suggestions/content_suggestion_identifier.h"
-#include "url/gurl.h"
+#import "ios/chrome/browser/ui/content_suggestions/identifier/content_suggestion_identifier.h"
namespace base {
class Time;
}
+class GURL;
+
// Enum defining the type of a ContentSuggestions.
typedef NS_ENUM(NSInteger, ContentSuggestionType) {
ContentSuggestionTypeArticle
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestion.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestion.mm
index 856c832..673986a4 100644
--- a/ios/chrome/browser/ui/content_suggestions/content_suggestion.mm
+++ b/ios/chrome/browser/ui/content_suggestions/content_suggestion.mm
@@ -5,6 +5,7 @@
#import "ios/chrome/browser/ui/content_suggestions/content_suggestion.h"
#include "base/time/time.h"
+#include "url/gurl.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item.h b/ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item.h
index 8a81bc65..633dde6 100644
--- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item.h
+++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item.h
@@ -6,15 +6,15 @@
#define IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_ARTICLE_ITEM_H_
#import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h"
-#import "ios/chrome/browser/ui/content_suggestions/content_suggestion_identifier.h"
+#import "ios/chrome/browser/ui/content_suggestions/identifier/content_suggestion_identifier.h"
#import "ios/third_party/material_components_ios/src/components/CollectionCells/src/MaterialCollectionCells.h"
-#include "url/gurl.h"
namespace base {
class Time;
}
@class ContentSuggestionsArticleItem;
+class GURL;
// Delegate for a ContentSuggestionsArticleItem.
@protocol ContentSuggestionsArticleItemDelegate
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item.mm
index ecc4581..97fbcf2 100644
--- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item.mm
+++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item.mm
@@ -9,6 +9,7 @@
#import "ios/chrome/browser/ui/uikit_ui_util.h"
#import "ios/chrome/browser/ui/util/i18n_string.h"
#import "ios/third_party/material_components_ios/src/components/Typography/src/MaterialTypography.h"
+#include "url/gurl.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.mm
index 2443888b..bb0b8d9 100644
--- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.mm
+++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater.mm
@@ -11,7 +11,6 @@
#import "ios/chrome/browser/ui/collection_view/collection_view_controller.h"
#import "ios/chrome/browser/ui/collection_view/collection_view_model.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestion.h"
-#import "ios/chrome/browser/ui/content_suggestions/content_suggestion_identifier.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_article_item.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_data_sink.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_data_source.h"
@@ -19,10 +18,11 @@
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_favicon_item.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_footer_item.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_image_fetcher.h"
-#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_section_information.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_stack_item.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_text_item.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.h"
+#import "ios/chrome/browser/ui/content_suggestions/identifier/content_suggestion_identifier.h"
+#import "ios/chrome/browser/ui/content_suggestions/identifier/content_suggestions_section_information.h"
#include "ui/gfx/image/image.h"
#include "url/gurl.h"
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm
index 7440f90c..36c152b 100644
--- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm
+++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm
@@ -16,6 +16,7 @@
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_stack_item_actions.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_text_item_actions.h"
#import "ios/chrome/browser/ui/content_suggestions/expandable_item.h"
+#include "url/gurl.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
diff --git a/ios/chrome/browser/ui/content_suggestions/identifier/BUILD.gn b/ios/chrome/browser/ui/content_suggestions/identifier/BUILD.gn
new file mode 100644
index 0000000..d89c544
--- /dev/null
+++ b/ios/chrome/browser/ui/content_suggestions/identifier/BUILD.gn
@@ -0,0 +1,28 @@
+# Copyright 2017 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.
+
+source_set("identifier") {
+ configs += [ "//build/config/compiler:enable_arc" ]
+ sources = [
+ "content_suggestion_identifier.h",
+ "content_suggestion_identifier.mm",
+ "content_suggestions_section_information.h",
+ "content_suggestions_section_information.mm",
+ ]
+ deps = [
+ "//base",
+ ]
+}
+
+source_set("unit_tests") {
+ configs += [ "//build/config/compiler:enable_arc" ]
+ testonly = true
+ sources = [
+ "content_suggestion_identifier_unittest.mm",
+ ]
+ deps = [
+ ":identifier",
+ "//testing/gtest",
+ ]
+}
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestion_identifier.h b/ios/chrome/browser/ui/content_suggestions/identifier/content_suggestion_identifier.h
similarity index 71%
rename from ios/chrome/browser/ui/content_suggestions/content_suggestion_identifier.h
rename to ios/chrome/browser/ui/content_suggestions/identifier/content_suggestion_identifier.h
index 8148880..a85ff6e5 100644
--- a/ios/chrome/browser/ui/content_suggestions/content_suggestion_identifier.h
+++ b/ios/chrome/browser/ui/content_suggestions/identifier/content_suggestion_identifier.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTION_IDENTIFIER_H_
-#define IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTION_IDENTIFIER_H_
+#ifndef IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_IDENTIFIER_CONTENT_SUGGESTION_IDENTIFIER_H_
+#define IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_IDENTIFIER_CONTENT_SUGGESTION_IDENTIFIER_H_
#import <Foundation/Foundation.h>
@@ -27,4 +27,4 @@
@end
-#endif // IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTION_IDENTIFIER_H_
+#endif // IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_IDENTIFIER_CONTENT_SUGGESTION_IDENTIFIER_H_
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestion_identifier.mm b/ios/chrome/browser/ui/content_suggestions/identifier/content_suggestion_identifier.mm
similarity index 89%
rename from ios/chrome/browser/ui/content_suggestions/content_suggestion_identifier.mm
rename to ios/chrome/browser/ui/content_suggestions/identifier/content_suggestion_identifier.mm
index b3ad566..79d60da6 100644
--- a/ios/chrome/browser/ui/content_suggestions/content_suggestion_identifier.mm
+++ b/ios/chrome/browser/ui/content_suggestions/identifier/content_suggestion_identifier.mm
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#import "ios/chrome/browser/ui/content_suggestions/content_suggestion_identifier.h"
+#import "ios/chrome/browser/ui/content_suggestions/identifier/content_suggestion_identifier.h"
#include "base/mac/foundation_util.h"
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestion_identifier_unittest.mm b/ios/chrome/browser/ui/content_suggestions/identifier/content_suggestion_identifier_unittest.mm
similarity index 94%
rename from ios/chrome/browser/ui/content_suggestions/content_suggestion_identifier_unittest.mm
rename to ios/chrome/browser/ui/content_suggestions/identifier/content_suggestion_identifier_unittest.mm
index 635c58d..5d9c86c 100644
--- a/ios/chrome/browser/ui/content_suggestions/content_suggestion_identifier_unittest.mm
+++ b/ios/chrome/browser/ui/content_suggestions/identifier/content_suggestion_identifier_unittest.mm
@@ -2,9 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#import "ios/chrome/browser/ui/content_suggestions/content_suggestion_identifier.h"
+#import "ios/chrome/browser/ui/content_suggestions/identifier/content_suggestion_identifier.h"
-#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_section_information.h"
+#import "ios/chrome/browser/ui/content_suggestions/identifier/content_suggestions_section_information.h"
#include "testing/gtest/include/gtest/gtest.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_section_information.h b/ios/chrome/browser/ui/content_suggestions/identifier/content_suggestions_section_information.h
similarity index 76%
rename from ios/chrome/browser/ui/content_suggestions/content_suggestions_section_information.h
rename to ios/chrome/browser/ui/content_suggestions/identifier/content_suggestions_section_information.h
index c8af1ba..d73e0651 100644
--- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_section_information.h
+++ b/ios/chrome/browser/ui/content_suggestions/identifier/content_suggestions_section_information.h
@@ -2,13 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_SECTION_INFORMATION_H_
-#define IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_SECTION_INFORMATION_H_
+#ifndef IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_IDENTIFIER_CONTENT_SUGGESTIONS_SECTION_INFORMATION_H_
+#define IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_IDENTIFIER_CONTENT_SUGGESTIONS_SECTION_INFORMATION_H_
#import <Foundation/Foundation.h>
-#import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h"
-
// Layout for the section and its items.
typedef NS_ENUM(NSInteger, ContentSuggestionsSectionLayout) {
// Follows the card layout.
@@ -37,9 +35,6 @@
NS_DESIGNATED_INITIALIZER;
- (instancetype)init NS_UNAVAILABLE;
-// Item to display when the section is empty. If nil the section should not be
-// displayed when empty.
-@property(nonatomic, strong) CollectionViewItem* emptyCell;
// Layout to display the content of the section.
@property(nonatomic, assign) ContentSuggestionsSectionLayout layout;
// ID of the section. Used for ordering.
@@ -51,4 +46,4 @@
@end
-#endif // IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_SECTION_INFORMATION_H_
+#endif // IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_IDENTIFIER_CONTENT_SUGGESTIONS_SECTION_INFORMATION_H_
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_section_information.mm b/ios/chrome/browser/ui/content_suggestions/identifier/content_suggestions_section_information.mm
similarity index 84%
rename from ios/chrome/browser/ui/content_suggestions/content_suggestions_section_information.mm
rename to ios/chrome/browser/ui/content_suggestions/identifier/content_suggestions_section_information.mm
index 14b05cc..8467276e 100644
--- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_section_information.mm
+++ b/ios/chrome/browser/ui/content_suggestions/identifier/content_suggestions_section_information.mm
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_section_information.h"
+#import "ios/chrome/browser/ui/content_suggestions/identifier/content_suggestions_section_information.h"
#include "base/logging.h"
@@ -12,7 +12,6 @@
@implementation ContentSuggestionsSectionInformation
-@synthesize emptyCell = _emptyCell;
@synthesize layout = _layout;
@synthesize sectionID = _sectionID;
@synthesize title = _title;