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

Side by Side Diff: components/ntp_snippets/offline_pages/offline_page_suggestions_provider.cc

Issue 2212313002: Call FetchImageCallback asynchronously when no thumbnail exists (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bookmarksprovider
Patch Set: Marc's comments Created 4 years, 4 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 | « components/ntp_snippets/content_suggestions_service_unittest.cc ('k') | no next file » | 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/offline_pages/offline_page_suggestions_provide r.h" 5 #include "components/ntp_snippets/offline_pages/offline_page_suggestions_provide r.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h"
8 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "base/threading/thread_task_runner_handle.h"
12 #include "ui/gfx/image/image.h"
10 13
11 using offline_pages::MultipleOfflinePageItemResult; 14 using offline_pages::MultipleOfflinePageItemResult;
12 using offline_pages::OfflinePageModel; 15 using offline_pages::OfflinePageModel;
13 using offline_pages::OfflinePageItem; 16 using offline_pages::OfflinePageItem;
14 17
15 namespace ntp_snippets { 18 namespace ntp_snippets {
16 19
17 namespace { 20 namespace {
18 21
19 const int kMaxSuggestionsCount = 5; 22 const int kMaxSuggestionsCount = 5;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 54
52 void OfflinePageSuggestionsProvider::DismissSuggestion( 55 void OfflinePageSuggestionsProvider::DismissSuggestion(
53 const std::string& suggestion_id) { 56 const std::string& suggestion_id) {
54 // TODO(pke): Implement some "dont show on NTP anymore" behaviour, 57 // TODO(pke): Implement some "dont show on NTP anymore" behaviour,
55 // then also implement ClearDismissedSuggestionsForDebugging. 58 // then also implement ClearDismissedSuggestionsForDebugging.
56 } 59 }
57 60
58 void OfflinePageSuggestionsProvider::FetchSuggestionImage( 61 void OfflinePageSuggestionsProvider::FetchSuggestionImage(
59 const std::string& suggestion_id, 62 const std::string& suggestion_id,
60 const ImageFetchedCallback& callback) { 63 const ImageFetchedCallback& callback) {
61 // TODO(pke): Implement. 64 // TODO(pke): Fetch proper thumbnail from OfflinePageModel once it's available
65 // there.
66 base::ThreadTaskRunnerHandle::Get()->PostTask(
67 FROM_HERE, base::Bind(callback, suggestion_id, gfx::Image()));
62 } 68 }
63 69
64 void OfflinePageSuggestionsProvider::ClearCachedSuggestionsForDebugging() { 70 void OfflinePageSuggestionsProvider::ClearCachedSuggestionsForDebugging() {
65 // Ignored. 71 // Ignored.
66 } 72 }
67 73
68 void OfflinePageSuggestionsProvider::ClearDismissedSuggestionsForDebugging() { 74 void OfflinePageSuggestionsProvider::ClearDismissedSuggestionsForDebugging() {
69 // TODO(pke): Implement when dismissed suggestions are supported. 75 // TODO(pke): Implement when dismissed suggestions are supported.
70 } 76 }
71 77
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 void OfflinePageSuggestionsProvider::NotifyStatusChanged( 130 void OfflinePageSuggestionsProvider::NotifyStatusChanged(
125 CategoryStatus new_status) { 131 CategoryStatus new_status) {
126 if (category_status_ == new_status) 132 if (category_status_ == new_status)
127 return; 133 return;
128 category_status_ = new_status; 134 category_status_ = new_status;
129 135
130 observer()->OnCategoryStatusChanged(this, provided_category_, new_status); 136 observer()->OnCategoryStatusChanged(this, provided_category_, new_status);
131 } 137 }
132 138
133 } // namespace ntp_snippets 139 } // namespace ntp_snippets
OLDNEW
« no previous file with comments | « components/ntp_snippets/content_suggestions_service_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698