| OLD | NEW |
| 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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 void NTPSnippetsService::FetchSuggestionImage( | 328 void NTPSnippetsService::FetchSuggestionImage( |
| 329 const std::string& suggestion_id, | 329 const std::string& suggestion_id, |
| 330 const ImageFetchedCallback& callback) { | 330 const ImageFetchedCallback& callback) { |
| 331 std::string snippet_id = GetWithinCategoryIDFromUniqueID(suggestion_id); | 331 std::string snippet_id = GetWithinCategoryIDFromUniqueID(suggestion_id); |
| 332 database_->LoadImage( | 332 database_->LoadImage( |
| 333 snippet_id, | 333 snippet_id, |
| 334 base::Bind(&NTPSnippetsService::OnSnippetImageFetchedFromDatabase, | 334 base::Bind(&NTPSnippetsService::OnSnippetImageFetchedFromDatabase, |
| 335 base::Unretained(this), callback, snippet_id)); | 335 base::Unretained(this), callback, snippet_id)); |
| 336 } | 336 } |
| 337 | 337 |
| 338 void NTPSnippetsService::ClearHistory(base::Time begin, base::Time end) { |
| 339 // TODO(vitaliii): Implement. See crbug.com/641321. |
| 340 } |
| 341 |
| 338 void NTPSnippetsService::ClearCachedSuggestions(Category category) { | 342 void NTPSnippetsService::ClearCachedSuggestions(Category category) { |
| 339 DCHECK_EQ(category, provided_category_); | 343 DCHECK_EQ(category, provided_category_); |
| 340 if (!initialized()) | 344 if (!initialized()) |
| 341 return; | 345 return; |
| 342 | 346 |
| 343 if (snippets_.empty()) | 347 if (snippets_.empty()) |
| 344 return; | 348 return; |
| 345 | 349 |
| 346 database_->DeleteSnippets(snippets_); | 350 database_->DeleteSnippets(snippets_); |
| 347 snippets_.clear(); | 351 snippets_.clear(); |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 892 void NTPSnippetsService::UpdateCategoryStatus(CategoryStatus status) { | 896 void NTPSnippetsService::UpdateCategoryStatus(CategoryStatus status) { |
| 893 if (status == category_status_) | 897 if (status == category_status_) |
| 894 return; | 898 return; |
| 895 | 899 |
| 896 category_status_ = status; | 900 category_status_ = status; |
| 897 observer()->OnCategoryStatusChanged(this, provided_category_, | 901 observer()->OnCategoryStatusChanged(this, provided_category_, |
| 898 category_status_); | 902 category_status_); |
| 899 } | 903 } |
| 900 | 904 |
| 901 } // namespace ntp_snippets | 905 } // namespace ntp_snippets |
| OLD | NEW |