| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/ntp_snippets/offline_pages/offline_page_suggestions_provide
r.h" | 5 #include "components/ntp_snippets/offline_pages/offline_page_suggestions_provide
r.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 | 10 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 // TODO(pke): Get more reasonable data from the OfflinePageModel here. | 122 // TODO(pke): Get more reasonable data from the OfflinePageModel here. |
| 123 suggestion.set_title(base::UTF8ToUTF16(item.url.spec())); | 123 suggestion.set_title(base::UTF8ToUTF16(item.url.spec())); |
| 124 suggestion.set_snippet_text(base::string16()); | 124 suggestion.set_snippet_text(base::string16()); |
| 125 suggestion.set_publish_date(item.creation_time); | 125 suggestion.set_publish_date(item.creation_time); |
| 126 suggestion.set_publisher_name(base::UTF8ToUTF16(item.url.host())); | 126 suggestion.set_publisher_name(base::UTF8ToUTF16(item.url.host())); |
| 127 suggestions.emplace_back(std::move(suggestion)); | 127 suggestions.emplace_back(std::move(suggestion)); |
| 128 if (suggestions.size() == kMaxSuggestionsCount) | 128 if (suggestions.size() == kMaxSuggestionsCount) |
| 129 break; | 129 break; |
| 130 } | 130 } |
| 131 | 131 |
| 132 observer_->OnNewSuggestions(provided_category_, std::move(suggestions)); | 132 observer_->OnNewSuggestions(this, provided_category_, std::move(suggestions)); |
| 133 } | 133 } |
| 134 | 134 |
| 135 void OfflinePageSuggestionsProvider::NotifyStatusChanged( | 135 void OfflinePageSuggestionsProvider::NotifyStatusChanged( |
| 136 CategoryStatus new_status) { | 136 CategoryStatus new_status) { |
| 137 if (category_status_ == new_status) | 137 if (category_status_ == new_status) |
| 138 return; | 138 return; |
| 139 category_status_ = new_status; | 139 category_status_ = new_status; |
| 140 | 140 |
| 141 if (!observer_) | 141 if (!observer_) |
| 142 return; | 142 return; |
| 143 observer_->OnCategoryStatusChanged(provided_category_, new_status); | 143 observer_->OnCategoryStatusChanged(this, provided_category_, new_status); |
| 144 } | 144 } |
| 145 | 145 |
| 146 } // namespace ntp_snippets | 146 } // namespace ntp_snippets |
| OLD | NEW |