Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1012)

Side by Side Diff: components/ntp_snippets/physical_web_pages/physical_web_page_suggestions_provider.cc

Issue 2765713002: Associate a scan mode with Physical Web listeners (Closed)
Patch Set: Use key as parame to erase() Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | components/physical_web/data_source/fake_physical_web_data_source.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | components/physical_web/data_source/fake_physical_web_data_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698