Chromium Code Reviews| 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/location.h" | |
| 8 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "base/threading/thread_task_runner_handle.h" | |
| 12 #include "ui/gfx/image/image.h" | |
| 10 | 13 |
| 11 using offline_pages::MultipleOfflinePageItemResult; | 14 using offline_pages::MultipleOfflinePageItemResult; |
| 12 using offline_pages::OfflinePageModel; | 15 using offline_pages::OfflinePageModel; |
| 13 using offline_pages::OfflinePageItem; | 16 using offline_pages::OfflinePageItem; |
| 14 | 17 |
| 15 namespace ntp_snippets { | 18 namespace ntp_snippets { |
| 16 | 19 |
| 17 namespace { | 20 namespace { |
| 18 | 21 |
| 19 const int kMaxSuggestionsCount = 5; | 22 const int kMaxSuggestionsCount = 5; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 51 | 54 |
| 52 void OfflinePageSuggestionsProvider::DismissSuggestion( | 55 void OfflinePageSuggestionsProvider::DismissSuggestion( |
| 53 const std::string& suggestion_id) { | 56 const std::string& suggestion_id) { |
| 54 // TODO(pke): Implement some "dont show on NTP anymore" behaviour, | 57 // TODO(pke): Implement some "dont show on NTP anymore" behaviour, |
| 55 // then also implement ClearDismissedSuggestionsForDebugging. | 58 // then also implement ClearDismissedSuggestionsForDebugging. |
| 56 } | 59 } |
| 57 | 60 |
| 58 void OfflinePageSuggestionsProvider::FetchSuggestionImage( | 61 void OfflinePageSuggestionsProvider::FetchSuggestionImage( |
| 59 const std::string& suggestion_id, | 62 const std::string& suggestion_id, |
| 60 const ImageFetchedCallback& callback) { | 63 const ImageFetchedCallback& callback) { |
| 61 // TODO(pke): Implement. | 64 base::ThreadTaskRunnerHandle::Get()->PostTask( |
|
Marc Treib
2016/08/05 09:55:20
The TODO can probably stay :)
Philipp Keck
2016/08/05 10:01:38
Done.
| |
| 65 FROM_HERE, base::Bind(callback, suggestion_id, gfx::Image())); | |
| 62 } | 66 } |
| 63 | 67 |
| 64 void OfflinePageSuggestionsProvider::ClearCachedSuggestionsForDebugging() { | 68 void OfflinePageSuggestionsProvider::ClearCachedSuggestionsForDebugging() { |
| 65 // Ignored. | 69 // Ignored. |
| 66 } | 70 } |
| 67 | 71 |
| 68 void OfflinePageSuggestionsProvider::ClearDismissedSuggestionsForDebugging() { | 72 void OfflinePageSuggestionsProvider::ClearDismissedSuggestionsForDebugging() { |
| 69 // TODO(pke): Implement when dismissed suggestions are supported. | 73 // TODO(pke): Implement when dismissed suggestions are supported. |
| 70 } | 74 } |
| 71 | 75 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 void OfflinePageSuggestionsProvider::NotifyStatusChanged( | 128 void OfflinePageSuggestionsProvider::NotifyStatusChanged( |
| 125 CategoryStatus new_status) { | 129 CategoryStatus new_status) { |
| 126 if (category_status_ == new_status) | 130 if (category_status_ == new_status) |
| 127 return; | 131 return; |
| 128 category_status_ = new_status; | 132 category_status_ = new_status; |
| 129 | 133 |
| 130 observer()->OnCategoryStatusChanged(this, provided_category_, new_status); | 134 observer()->OnCategoryStatusChanged(this, provided_category_, new_status); |
| 131 } | 135 } |
| 132 | 136 |
| 133 } // namespace ntp_snippets | 137 } // namespace ntp_snippets |
| OLD | NEW |