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

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

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 #import "ios/chrome/browser/content_suggestions/content_suggestions_service_brid ge_observer.h"
6
7 #if !defined(__has_feature) || !__has_feature(objc_arc)
8 #error "This file requires ARC support."
9 #endif
10
11 ContentSuggestionsServiceBridge::ContentSuggestionsServiceBridge(
12 id<ContentSuggestionsServiceBridgeObserver> observer,
13 ntp_snippets::ContentSuggestionsService* service) {
14 observer_ = observer;
15 service_ = service;
16 service->AddObserver(this);
17 }
18
19 ContentSuggestionsServiceBridge::~ContentSuggestionsServiceBridge() {
20 service_->RemoveObserver(this);
21 }
22
23 void ContentSuggestionsServiceBridge::OnNewSuggestions(
24 ntp_snippets::Category category) {
25 [observer_ onNewSuggestions:category];
26 }
27
28 void ContentSuggestionsServiceBridge::OnCategoryStatusChanged(
29 ntp_snippets::Category category,
30 ntp_snippets::CategoryStatus new_status) {
31 [observer_ onCategory:category statusChanged:new_status];
32 }
33
34 void ContentSuggestionsServiceBridge::OnSuggestionInvalidated(
35 const ntp_snippets::ContentSuggestion::ID& suggestion_id) {
36 [observer_ onSuggestionInvalidated:suggestion_id];
37 }
38
39 void ContentSuggestionsServiceBridge::OnFullRefreshRequired() {
40 [observer_ onFullRefreshRequired];
41 }
42
43 void ContentSuggestionsServiceBridge::ContentSuggestionsServiceShutdown() {
44 [observer_ contentSuggestionsServiceShutdown];
45 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698