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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef IOS_CHROME_BROWSER_CONTENT_SUGGESTIONS_MEDIATOR_UTIL_H_
6 #define IOS_CHROME_BROWSER_CONTENT_SUGGESTIONS_MEDIATOR_UTIL_H_
7
8 #include "base/bind.h"
9 #include "base/optional.h"
10 #include "components/ntp_snippets/category_info.h"
11 #include "components/ntp_snippets/content_suggestion.h"
12 #include "components/ntp_snippets/status.h"
13 #import "ios/chrome/browser/ui/content_suggestions/content_suggestion.h"
14 #import "ios/chrome/browser/ui/content_suggestions/identifier/content_suggestion s_section_information.h"
15
16 namespace ntp_snippets {
17 class ContentSuggestion;
18 class Category;
19 class CategoryInfo;
20 }
21
22 @class ContentSuggestionsCategoryWrapper;
23
24 // TODO(crbug.com/701275): Once base::BindBlock supports the move semantics,
25 // remove this wrapper.
26 // Wraps a callback taking a const ref to a callback taking an object.
27 void BindWrapper(
28 base::Callback<void(ntp_snippets::Status status_code,
29 const std::vector<ntp_snippets::ContentSuggestion>&
30 suggestions)> callback,
31 ntp_snippets::Status status_code,
32 std::vector<ntp_snippets::ContentSuggestion> suggestions);
33
34 // Returns the Type for this |category|.
35 ContentSuggestionType TypeForCategory(ntp_snippets::Category category);
36
37 // Returns the section ID for this |category|.
38 ContentSuggestionsSectionID SectionIDForCategory(
39 ntp_snippets::Category category);
40
41 // Returns the section layout corresponding to the category |layout|.
42 ContentSuggestionsSectionLayout SectionLayoutForLayout(
43 ntp_snippets::ContentSuggestionsCardLayout layout);
44
45 // Converts a ntp_snippets::ContentSuggestion to an Objective-C
46 // ContentSuggestion.
47 ContentSuggestion* ConvertContentSuggestion(
48 const ntp_snippets::ContentSuggestion& contentSuggestion);
49
50 // Returns a SectionInformation for a |category|, filled with the
51 // |categoryInfo|.
52 ContentSuggestionsSectionInformation* SectionInformationFromCategoryInfo(
53 const base::Optional<ntp_snippets::CategoryInfo>& categoryInfo,
54 const ntp_snippets::Category& category);
55
56 // Returns a ntp_snippets::ID based on a Objective-C Category and the ID in the
57 // category.
58 ntp_snippets::ContentSuggestion::ID SuggestionIDForSectionID(
59 ContentSuggestionsCategoryWrapper* category,
60 const std::string& id_in_category);
61
62 #endif // IOS_CHROME_BROWSER_CONTENT_SUGGESTIONS_MEDIATOR_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698