| OLD | NEW |
| (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<ContentSuggestionsServiceObserver> 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_ contentSuggestionsService:service_ |
| 26 newSuggestionsInCategory:category]; |
| 27 } |
| 28 |
| 29 void ContentSuggestionsServiceBridge::OnCategoryStatusChanged( |
| 30 ntp_snippets::Category category, |
| 31 ntp_snippets::CategoryStatus new_status) { |
| 32 [observer_ contentSuggestionsService:service_ |
| 33 category:category |
| 34 statusChangedTo:new_status]; |
| 35 } |
| 36 |
| 37 void ContentSuggestionsServiceBridge::OnSuggestionInvalidated( |
| 38 const ntp_snippets::ContentSuggestion::ID& suggestion_id) { |
| 39 [observer_ contentSuggestionsService:service_ |
| 40 SuggestionInvalidated:suggestion_id]; |
| 41 } |
| 42 |
| 43 void ContentSuggestionsServiceBridge::OnFullRefreshRequired() { |
| 44 [observer_ contentSuggestionsServiceFullRefreshRequired:service_]; |
| 45 } |
| 46 |
| 47 void ContentSuggestionsServiceBridge::ContentSuggestionsServiceShutdown() { |
| 48 [observer_ contentSuggestionsServiceShutdown:service_]; |
| 49 } |
| OLD | NEW |