| 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/physical_web_pages/physical_web_page_suggestio
ns_provider.h" | 5 #include "components/ntp_snippets/physical_web_pages/physical_web_page_suggestio
ns_provider.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/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #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" |
| 11 | 13 |
| 12 namespace ntp_snippets { | 14 namespace ntp_snippets { |
| 13 | 15 |
| 14 namespace { | 16 namespace { |
| 15 | 17 |
| 16 const size_t kMaxSuggestionsCount = 10; | 18 const size_t kMaxSuggestionsCount = 10; |
| 17 | 19 |
| 18 } // namespace | 20 } // namespace |
| 19 | 21 |
| 20 // TODO(vitaliii): remove when Physical Web C++ interface is provided. | 22 // TODO(vitaliii): remove when Physical Web C++ interface is provided. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 75 |
| 74 void PhysicalWebPageSuggestionsProvider::DismissSuggestion( | 76 void PhysicalWebPageSuggestionsProvider::DismissSuggestion( |
| 75 const std::string& suggestion_id) { | 77 const std::string& suggestion_id) { |
| 76 // TODO(vitaliii): Implement this and then | 78 // TODO(vitaliii): Implement this and then |
| 77 // ClearDismissedSuggestionsForDebugging. | 79 // ClearDismissedSuggestionsForDebugging. |
| 78 } | 80 } |
| 79 | 81 |
| 80 void PhysicalWebPageSuggestionsProvider::FetchSuggestionImage( | 82 void PhysicalWebPageSuggestionsProvider::FetchSuggestionImage( |
| 81 const std::string& suggestion_id, const ImageFetchedCallback& callback) { | 83 const std::string& suggestion_id, const ImageFetchedCallback& callback) { |
| 82 // TODO(vitaliii): Implement. | 84 // TODO(vitaliii): Implement. |
| 85 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 86 FROM_HERE, base::Bind(callback, gfx::Image())); |
| 83 } | 87 } |
| 84 | 88 |
| 85 void PhysicalWebPageSuggestionsProvider::ClearCachedSuggestions( | 89 void PhysicalWebPageSuggestionsProvider::ClearCachedSuggestions( |
| 86 Category category) { | 90 Category category) { |
| 87 // Ignored | 91 // Ignored |
| 88 } | 92 } |
| 89 | 93 |
| 90 void PhysicalWebPageSuggestionsProvider::GetDismissedSuggestionsForDebugging( | 94 void PhysicalWebPageSuggestionsProvider::GetDismissedSuggestionsForDebugging( |
| 91 Category category, | 95 Category category, |
| 92 const DismissedSuggestionsCallback& callback) { | 96 const DismissedSuggestionsCallback& callback) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 104 | 108 |
| 105 // Updates the |category_status_| and notifies the |observer_|, if necessary. | 109 // Updates the |category_status_| and notifies the |observer_|, if necessary. |
| 106 void PhysicalWebPageSuggestionsProvider::NotifyStatusChanged( | 110 void PhysicalWebPageSuggestionsProvider::NotifyStatusChanged( |
| 107 CategoryStatus new_status) { | 111 CategoryStatus new_status) { |
| 108 if (category_status_ == new_status) return; | 112 if (category_status_ == new_status) return; |
| 109 category_status_ = new_status; | 113 category_status_ = new_status; |
| 110 observer()->OnCategoryStatusChanged(this, provided_category_, new_status); | 114 observer()->OnCategoryStatusChanged(this, provided_category_, new_status); |
| 111 } | 115 } |
| 112 | 116 |
| 113 } // namespace ntp_snippets | 117 } // namespace ntp_snippets |
| OLD | NEW |