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

Side by Side Diff: ios/chrome/browser/content_suggestions/content_suggestions_service_bridge_observer.h

Issue 2638413006: Add ContentSuggestionsMediator (Closed)
Patch Set: Fix Created 3 years, 11 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_CONTENT_SUGGESTIONS_SERVICE_BRIDG E_OBSERVER_H_
6 #define IOS_CHROME_BROWSER_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_SERVICE_BRIDG E_OBSERVER_H_
7
8 #include "components/ntp_snippets/content_suggestions_service.h"
9
10 // Protocol duplicating all ContentSuggestionsService Observer methods in
11 // Objective-C.
12 @protocol ContentSuggestionsServiceBridgeObserver
marq (ping after 24h) 2017/01/27 12:44:55 Remove 'Bridge" from the protocol name.
gambard 2017/01/30 15:19:17 Done.
13
marq (ping after 24h) 2017/01/27 12:44:55 You still need comments for each method declaratio
gambard 2017/01/30 15:19:17 Done.
14 - (void)onNewSuggestions:(ntp_snippets::Category)category;
marq (ping after 24h) 2017/01/27 12:44:55 The usual pattern for delegate and observer protoc
gambard 2017/01/30 15:19:17 Done.
15 - (void)onCategory:(ntp_snippets::Category)category
16 statusChanged:(ntp_snippets::CategoryStatus)status;
17 - (void)onSuggestionInvalidated:
18 (const ntp_snippets::ContentSuggestion::ID&)suggestion_id;
19 - (void)onFullRefreshRequired;
20 - (void)contentSuggestionsServiceShutdown;
21
22 @end
23
24 // Observer for the ContentSuggestionsService that translates all the callbacks
25 // to Objective-C calls.
26 class ContentSuggestionsServiceBridge
27 : public ntp_snippets::ContentSuggestionsService::Observer {
28 public:
29 ContentSuggestionsServiceBridge(
30 id<ContentSuggestionsServiceBridgeObserver> observer,
31 ntp_snippets::ContentSuggestionsService* service);
32 ~ContentSuggestionsServiceBridge() override;
33
34 private:
35 void OnNewSuggestions(ntp_snippets::Category category) override;
36 void OnCategoryStatusChanged(
37 ntp_snippets::Category category,
38 ntp_snippets::CategoryStatus new_status) override;
39 void OnSuggestionInvalidated(
40 const ntp_snippets::ContentSuggestion::ID& suggestion_id) override;
41 void OnFullRefreshRequired() override;
42 void ContentSuggestionsServiceShutdown() override;
43
44 __unsafe_unretained id<ContentSuggestionsServiceBridgeObserver> observer_;
45 ntp_snippets::ContentSuggestionsService* service_; // weak
46
47 DISALLOW_COPY_AND_ASSIGN(ContentSuggestionsServiceBridge);
48 };
49
50 #endif // IOS_CHROME_BROWSER_CONTENT_SUGGESTIONS_CONTENT_SUGGESTIONS_SERVICE_BR IDGE_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698