| 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/recent_tab_suggestions_provider.
h" | 5 #include "components/ntp_snippets/offline_pages/recent_tab_suggestions_provider.
h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 RecentTabSuggestionsProvider::RecentTabSuggestionsProvider( | 46 RecentTabSuggestionsProvider::RecentTabSuggestionsProvider( |
| 47 ContentSuggestionsProvider::Observer* observer, | 47 ContentSuggestionsProvider::Observer* observer, |
| 48 CategoryFactory* category_factory, | 48 CategoryFactory* category_factory, |
| 49 scoped_refptr<OfflinePageProxy> offline_page_proxy, | 49 scoped_refptr<OfflinePageProxy> offline_page_proxy, |
| 50 PrefService* pref_service) | 50 PrefService* pref_service) |
| 51 : ContentSuggestionsProvider(observer, category_factory), | 51 : ContentSuggestionsProvider(observer, category_factory), |
| 52 category_status_(CategoryStatus::AVAILABLE_LOADING), | 52 category_status_(CategoryStatus::AVAILABLE_LOADING), |
| 53 provided_category_( | 53 provided_category_( |
| 54 category_factory->FromKnownCategory(KnownCategories::RECENT_TABS)), | 54 category_factory->FromKnownCategory(KnownCategories::RECENT_TABS)), |
| 55 offline_page_proxy_(offline_page_proxy), | 55 offline_page_proxy_(std::move(offline_page_proxy)), |
| 56 pref_service_(pref_service), | 56 pref_service_(pref_service), |
| 57 weak_ptr_factory_(this) { | 57 weak_ptr_factory_(this) { |
| 58 observer->OnCategoryStatusChanged(this, provided_category_, category_status_); | 58 observer->OnCategoryStatusChanged(this, provided_category_, category_status_); |
| 59 offline_page_proxy_->AddObserver(this); | 59 offline_page_proxy_->AddObserver(this); |
| 60 FetchRecentTabs(); | 60 FetchRecentTabs(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 RecentTabSuggestionsProvider::~RecentTabSuggestionsProvider() { | 63 RecentTabSuggestionsProvider::~RecentTabSuggestionsProvider() { |
| 64 offline_page_proxy_->RemoveObserver(this); | 64 offline_page_proxy_->RemoveObserver(this); |
| 65 } | 65 } |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 } | 265 } |
| 266 | 266 |
| 267 void RecentTabSuggestionsProvider::StoreDismissedIDsToPrefs( | 267 void RecentTabSuggestionsProvider::StoreDismissedIDsToPrefs( |
| 268 const std::set<std::string>& dismissed_ids) { | 268 const std::set<std::string>& dismissed_ids) { |
| 269 prefs::StoreDismissedIDsToPrefs(pref_service_, | 269 prefs::StoreDismissedIDsToPrefs(pref_service_, |
| 270 prefs::kDismissedRecentOfflineTabSuggestions, | 270 prefs::kDismissedRecentOfflineTabSuggestions, |
| 271 dismissed_ids); | 271 dismissed_ids); |
| 272 } | 272 } |
| 273 | 273 |
| 274 } // namespace ntp_snippets | 274 } // namespace ntp_snippets |
| OLD | NEW |