| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 ContentSuggestionsProvider::Observer* observer, | 91 ContentSuggestionsProvider::Observer* observer, |
| 92 physical_web::PhysicalWebDataSource* physical_web_data_source, | 92 physical_web::PhysicalWebDataSource* physical_web_data_source, |
| 93 PrefService* pref_service) | 93 PrefService* pref_service) |
| 94 : ContentSuggestionsProvider(observer), | 94 : ContentSuggestionsProvider(observer), |
| 95 category_status_(CategoryStatus::AVAILABLE), | 95 category_status_(CategoryStatus::AVAILABLE), |
| 96 provided_category_( | 96 provided_category_( |
| 97 Category::FromKnownCategory(KnownCategories::PHYSICAL_WEB_PAGES)), | 97 Category::FromKnownCategory(KnownCategories::PHYSICAL_WEB_PAGES)), |
| 98 physical_web_data_source_(physical_web_data_source), | 98 physical_web_data_source_(physical_web_data_source), |
| 99 pref_service_(pref_service) { | 99 pref_service_(pref_service) { |
| 100 observer->OnCategoryStatusChanged(this, provided_category_, category_status_); | 100 observer->OnCategoryStatusChanged(this, provided_category_, category_status_); |
| 101 physical_web_data_source_->RegisterListener(this); | 101 physical_web_data_source_->RegisterListener(this, |
| 102 physical_web::BACKGROUND_INTERMITTENT); |
| 102 // TODO(vitaliii): Rewrite initial fetch once crbug.com/667754 is resolved. | 103 // TODO(vitaliii): Rewrite initial fetch once crbug.com/667754 is resolved. |
| 103 FetchPhysicalWebPages(); | 104 FetchPhysicalWebPages(); |
| 104 } | 105 } |
| 105 | 106 |
| 106 PhysicalWebPageSuggestionsProvider::~PhysicalWebPageSuggestionsProvider() { | 107 PhysicalWebPageSuggestionsProvider::~PhysicalWebPageSuggestionsProvider() { |
| 107 physical_web_data_source_->UnregisterListener(this); | 108 physical_web_data_source_->UnregisterListener(this); |
| 108 } | 109 } |
| 109 | 110 |
| 110 CategoryStatus PhysicalWebPageSuggestionsProvider::GetCategoryStatus( | 111 CategoryStatus PhysicalWebPageSuggestionsProvider::GetCategoryStatus( |
| 111 Category category) { | 112 Category category) { |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 } | 359 } |
| 359 | 360 |
| 360 void PhysicalWebPageSuggestionsProvider::StoreDismissedIDsToPrefs( | 361 void PhysicalWebPageSuggestionsProvider::StoreDismissedIDsToPrefs( |
| 361 const std::set<std::string>& dismissed_ids) { | 362 const std::set<std::string>& dismissed_ids) { |
| 362 prefs::StoreDismissedIDsToPrefs(pref_service_, | 363 prefs::StoreDismissedIDsToPrefs(pref_service_, |
| 363 prefs::kDismissedPhysicalWebPageSuggestions, | 364 prefs::kDismissedPhysicalWebPageSuggestions, |
| 364 dismissed_ids); | 365 dismissed_ids); |
| 365 } | 366 } |
| 366 | 367 |
| 367 } // namespace ntp_snippets | 368 } // namespace ntp_snippets |
| OLD | NEW |