| Index: ios/chrome/browser/content_suggestions/content_suggestions_service_bridge_observer.mm
|
| diff --git a/ios/chrome/browser/content_suggestions/content_suggestions_service_bridge_observer.mm b/ios/chrome/browser/content_suggestions/content_suggestions_service_bridge_observer.mm
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..a855376cd5a080d017d1a33dc629aa642e5dada2
|
| --- /dev/null
|
| +++ b/ios/chrome/browser/content_suggestions/content_suggestions_service_bridge_observer.mm
|
| @@ -0,0 +1,45 @@
|
| +// 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.
|
| +
|
| +#import "ios/chrome/browser/content_suggestions/content_suggestions_service_bridge_observer.h"
|
| +
|
| +#if !defined(__has_feature) || !__has_feature(objc_arc)
|
| +#error "This file requires ARC support."
|
| +#endif
|
| +
|
| +ContentSuggestionsServiceBridge::ContentSuggestionsServiceBridge(
|
| + id<ContentSuggestionsServiceBridgeObserver> observer,
|
| + ntp_snippets::ContentSuggestionsService* service) {
|
| + observer_ = observer;
|
| + service_ = service;
|
| + service->AddObserver(this);
|
| +}
|
| +
|
| +ContentSuggestionsServiceBridge::~ContentSuggestionsServiceBridge() {
|
| + service_->RemoveObserver(this);
|
| +}
|
| +
|
| +void ContentSuggestionsServiceBridge::OnNewSuggestions(
|
| + ntp_snippets::Category category) {
|
| + [observer_ onNewSuggestions:category];
|
| +}
|
| +
|
| +void ContentSuggestionsServiceBridge::OnCategoryStatusChanged(
|
| + ntp_snippets::Category category,
|
| + ntp_snippets::CategoryStatus new_status) {
|
| + [observer_ onCategory:category statusChanged:new_status];
|
| +}
|
| +
|
| +void ContentSuggestionsServiceBridge::OnSuggestionInvalidated(
|
| + const ntp_snippets::ContentSuggestion::ID& suggestion_id) {
|
| + [observer_ onSuggestionInvalidated:suggestion_id];
|
| +}
|
| +
|
| +void ContentSuggestionsServiceBridge::OnFullRefreshRequired() {
|
| + [observer_ onFullRefreshRequired];
|
| +}
|
| +
|
| +void ContentSuggestionsServiceBridge::ContentSuggestionsServiceShutdown() {
|
| + [observer_ contentSuggestionsServiceShutdown];
|
| +}
|
|
|