| 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" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 // ClearDismissedSuggestionsForDebugging. | 79 // ClearDismissedSuggestionsForDebugging. |
| 80 } | 80 } |
| 81 | 81 |
| 82 void PhysicalWebPageSuggestionsProvider::FetchSuggestionImage( | 82 void PhysicalWebPageSuggestionsProvider::FetchSuggestionImage( |
| 83 const std::string& suggestion_id, const ImageFetchedCallback& callback) { | 83 const std::string& suggestion_id, const ImageFetchedCallback& callback) { |
| 84 // TODO(vitaliii): Implement. | 84 // TODO(vitaliii): Implement. |
| 85 base::ThreadTaskRunnerHandle::Get()->PostTask( | 85 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 86 FROM_HERE, base::Bind(callback, gfx::Image())); | 86 FROM_HERE, base::Bind(callback, gfx::Image())); |
| 87 } | 87 } |
| 88 | 88 |
| 89 void PhysicalWebPageSuggestionsProvider::ClearHistory( |
| 90 base::Time begin, |
| 91 base::Time end, |
| 92 const base::Callback<bool(const GURL& url)>& filter) { |
| 93 // TODO(vitaliii): Implement when dismissed suggestions are supported. See |
| 94 // crbug.com/641321. |
| 95 } |
| 96 |
| 89 void PhysicalWebPageSuggestionsProvider::ClearCachedSuggestions( | 97 void PhysicalWebPageSuggestionsProvider::ClearCachedSuggestions( |
| 90 Category category) { | 98 Category category) { |
| 91 // Ignored | 99 // Ignored |
| 92 } | 100 } |
| 93 | 101 |
| 94 void PhysicalWebPageSuggestionsProvider::GetDismissedSuggestionsForDebugging( | 102 void PhysicalWebPageSuggestionsProvider::GetDismissedSuggestionsForDebugging( |
| 95 Category category, | 103 Category category, |
| 96 const DismissedSuggestionsCallback& callback) { | 104 const DismissedSuggestionsCallback& callback) { |
| 97 // Not implemented. | 105 // Not implemented. |
| 98 callback.Run(std::vector<ContentSuggestion>()); | 106 callback.Run(std::vector<ContentSuggestion>()); |
| 99 } | 107 } |
| 100 | 108 |
| 101 void PhysicalWebPageSuggestionsProvider::ClearDismissedSuggestionsForDebugging( | 109 void PhysicalWebPageSuggestionsProvider::ClearDismissedSuggestionsForDebugging( |
| 102 Category category) { | 110 Category category) { |
| 103 // TODO(vitaliii): Implement when dismissed suggestions are supported. | 111 // TODO(vitaliii): Implement when dismissed suggestions are supported. |
| 104 } | 112 } |
| 105 | 113 |
| 106 //////////////////////////////////////////////////////////////////////////////// | 114 //////////////////////////////////////////////////////////////////////////////// |
| 107 // Private methods | 115 // Private methods |
| 108 | 116 |
| 109 // Updates the |category_status_| and notifies the |observer_|, if necessary. | 117 // Updates the |category_status_| and notifies the |observer_|, if necessary. |
| 110 void PhysicalWebPageSuggestionsProvider::NotifyStatusChanged( | 118 void PhysicalWebPageSuggestionsProvider::NotifyStatusChanged( |
| 111 CategoryStatus new_status) { | 119 CategoryStatus new_status) { |
| 112 if (category_status_ == new_status) return; | 120 if (category_status_ == new_status) return; |
| 113 category_status_ = new_status; | 121 category_status_ = new_status; |
| 114 observer()->OnCategoryStatusChanged(this, provided_category_, new_status); | 122 observer()->OnCategoryStatusChanged(this, provided_category_, new_status); |
| 115 } | 123 } |
| 116 | 124 |
| 117 } // namespace ntp_snippets | 125 } // namespace ntp_snippets |
| OLD | NEW |