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

Side by Side Diff: components/ntp_snippets/ntp_snippets_service.cc

Issue 2149453004: Implement first version of OfflinePageSuggestionsProvider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove separate build target for offline_page_suggestions Created 4 years, 5 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/ntp_snippets_service.h" 5 #include "components/ntp_snippets/ntp_snippets_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 } 215 }
216 if (database_->IsErrorState()) { 216 if (database_->IsErrorState()) {
217 EnterState(State::SHUT_DOWN, 217 EnterState(State::SHUT_DOWN,
218 ContentSuggestionsCategoryStatus::LOADING_ERROR); 218 ContentSuggestionsCategoryStatus::LOADING_ERROR);
219 return; 219 return;
220 } 220 }
221 221
222 database_->SetErrorCallback(base::Bind(&NTPSnippetsService::OnDatabaseError, 222 database_->SetErrorCallback(base::Bind(&NTPSnippetsService::OnDatabaseError,
223 base::Unretained(this))); 223 base::Unretained(this)));
224 224
225 // TODO(pke): Move this to SetObserver as soon as the UI reads from the
226 // ContentSuggestionsService directly.
225 // We transition to other states while finalizing the initialization, when the 227 // We transition to other states while finalizing the initialization, when the
226 // database is done loading. 228 // database is done loading.
227 database_->LoadSnippets(base::Bind(&NTPSnippetsService::OnDatabaseLoaded, 229 database_->LoadSnippets(base::Bind(&NTPSnippetsService::OnDatabaseLoaded,
228 base::Unretained(this))); 230 base::Unretained(this)));
229 } 231 }
230 232
231 NTPSnippetsService::~NTPSnippetsService() { 233 NTPSnippetsService::~NTPSnippetsService() {
232 DCHECK(state_ == State::SHUT_DOWN); 234 DCHECK(state_ == State::SHUT_DOWN);
233 } 235 }
234 236
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 } 815 }
814 816
815 void NTPSnippetsService::NotifyCategoryStatusChanged() { 817 void NTPSnippetsService::NotifyCategoryStatusChanged() {
816 if (observer_) { 818 if (observer_) {
817 observer_->OnCategoryStatusChanged(ContentSuggestionsCategory::ARTICLES, 819 observer_->OnCategoryStatusChanged(ContentSuggestionsCategory::ARTICLES,
818 category_status_); 820 category_status_);
819 } 821 }
820 } 822 }
821 823
822 } // namespace ntp_snippets 824 } // namespace ntp_snippets
OLDNEW
« no previous file with comments | « components/ntp_snippets/ntp_snippets_service.h ('k') | components/ntp_snippets/offline_pages/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698