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

Unified Diff: ios/chrome/browser/content_suggestions/mediator_util.h

Issue 2790363002: Move C functions out of ContentSuggestionsMediator (Closed)
Patch Set: Fix line break Created 3 years, 8 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: ios/chrome/browser/content_suggestions/mediator_util.h
diff --git a/ios/chrome/browser/content_suggestions/mediator_util.h b/ios/chrome/browser/content_suggestions/mediator_util.h
new file mode 100644
index 0000000000000000000000000000000000000000..69a5d718cf648fbcdd463ed88b53161171907b56
--- /dev/null
+++ b/ios/chrome/browser/content_suggestions/mediator_util.h
@@ -0,0 +1,62 @@
+// 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.
+
+#ifndef IOS_CHROME_BROWSER_CONTENT_SUGGESTIONS_MEDIATOR_UTIL_H_
+#define IOS_CHROME_BROWSER_CONTENT_SUGGESTIONS_MEDIATOR_UTIL_H_
+
+#include "base/bind.h"
+#include "base/optional.h"
+#include "components/ntp_snippets/category_info.h"
+#include "components/ntp_snippets/content_suggestion.h"
+#include "components/ntp_snippets/status.h"
+#import "ios/chrome/browser/ui/content_suggestions/content_suggestion.h"
+#import "ios/chrome/browser/ui/content_suggestions/identifier/content_suggestions_section_information.h"
+
+namespace ntp_snippets {
+class ContentSuggestion;
+class Category;
+class CategoryInfo;
+}
+
+@class ContentSuggestionsCategoryWrapper;
+
+// TODO(crbug.com/701275): Once base::BindBlock supports the move semantics,
+// remove this wrapper.
+// Wraps a callback taking a const ref to a callback taking an object.
+void BindWrapper(
+ base::Callback<void(ntp_snippets::Status status_code,
+ const std::vector<ntp_snippets::ContentSuggestion>&
+ suggestions)> callback,
+ ntp_snippets::Status status_code,
+ std::vector<ntp_snippets::ContentSuggestion> suggestions);
+
+// Returns the Type for this |category|.
+ContentSuggestionType TypeForCategory(ntp_snippets::Category category);
+
+// Returns the section ID for this |category|.
+ContentSuggestionsSectionID SectionIDForCategory(
+ ntp_snippets::Category category);
+
+// Returns the section layout corresponding to the category |layout|.
+ContentSuggestionsSectionLayout SectionLayoutForLayout(
+ ntp_snippets::ContentSuggestionsCardLayout layout);
+
+// Converts a ntp_snippets::ContentSuggestion to an Objective-C
+// ContentSuggestion.
+ContentSuggestion* ConvertContentSuggestion(
+ const ntp_snippets::ContentSuggestion& contentSuggestion);
+
+// Returns a SectionInformation for a |category|, filled with the
+// |categoryInfo|.
+ContentSuggestionsSectionInformation* SectionInformationFromCategoryInfo(
+ const base::Optional<ntp_snippets::CategoryInfo>& categoryInfo,
+ const ntp_snippets::Category& category);
+
+// Returns a ntp_snippets::ID based on a Objective-C Category and the ID in the
+// category.
+ntp_snippets::ContentSuggestion::ID SuggestionIDForSectionID(
+ ContentSuggestionsCategoryWrapper* category,
+ const std::string& id_in_category);
+
+#endif // IOS_CHROME_BROWSER_CONTENT_SUGGESTIONS_MEDIATOR_UTIL_H_

Powered by Google App Engine
This is Rietveld 408576698