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

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

Issue 2284933002: Remove OfflineURL from offline page (Closed)
Patch Set: Remove accidentally added new file during rebase Created 4 years, 2 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 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 CategoryStatus new_status) { 207 CategoryStatus new_status) {
208 DCHECK_NE(CategoryStatus::NOT_PROVIDED, category_status_); 208 DCHECK_NE(CategoryStatus::NOT_PROVIDED, category_status_);
209 if (category_status_ == new_status) 209 if (category_status_ == new_status)
210 return; 210 return;
211 category_status_ = new_status; 211 category_status_ = new_status;
212 observer()->OnCategoryStatusChanged(this, provided_category_, new_status); 212 observer()->OnCategoryStatusChanged(this, provided_category_, new_status);
213 } 213 }
214 214
215 ContentSuggestion RecentTabSuggestionsProvider::ConvertOfflinePage( 215 ContentSuggestion RecentTabSuggestionsProvider::ConvertOfflinePage(
216 const OfflinePageItem& offline_page) const { 216 const OfflinePageItem& offline_page) const {
217 // TODO(vitaliii): Make sure the URL is actually opened as an offline URL
218 // and not just as a downloaded file.
Marc Treib 2016/10/05 09:15:23 I guess this TODO kinda still applies, maybe like
jianli 2016/10/05 20:34:16 Done.
219 ContentSuggestion suggestion(provided_category_, 217 ContentSuggestion suggestion(provided_category_,
220 base::IntToString(offline_page.offline_id), 218 base::IntToString(offline_page.offline_id),
221 offline_page.GetOfflineURL()); 219 offline_page.url);
222 220
223 if (offline_page.title.empty()) { 221 if (offline_page.title.empty()) {
224 // TODO(vitaliii): Remove this fallback once the OfflinePageModel provides 222 // TODO(vitaliii): Remove this fallback once the OfflinePageModel provides
225 // titles for all (relevant) OfflinePageItems. 223 // titles for all (relevant) OfflinePageItems.
226 suggestion.set_title(base::UTF8ToUTF16(offline_page.url.spec())); 224 suggestion.set_title(base::UTF8ToUTF16(offline_page.url.spec()));
227 } else { 225 } else {
228 suggestion.set_title(offline_page.title); 226 suggestion.set_title(offline_page.title);
229 } 227 }
230 suggestion.set_publish_date(offline_page.creation_time); 228 suggestion.set_publish_date(offline_page.creation_time);
231 suggestion.set_publisher_name(base::UTF8ToUTF16(offline_page.url.host())); 229 suggestion.set_publisher_name(base::UTF8ToUTF16(offline_page.url.host()));
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 } 264 }
267 265
268 void RecentTabSuggestionsProvider::StoreDismissedIDsToPrefs( 266 void RecentTabSuggestionsProvider::StoreDismissedIDsToPrefs(
269 const std::set<std::string>& dismissed_ids) { 267 const std::set<std::string>& dismissed_ids) {
270 prefs::StoreDismissedIDsToPrefs(pref_service_, 268 prefs::StoreDismissedIDsToPrefs(pref_service_,
271 prefs::kDismissedRecentOfflineTabSuggestions, 269 prefs::kDismissedRecentOfflineTabSuggestions,
272 dismissed_ids); 270 dismissed_ids);
273 } 271 }
274 272
275 } // namespace ntp_snippets 273 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698