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

Side by Side Diff: chrome/browser/ntp_snippets/download_suggestions_provider.cc

Issue 2477313003: [NTP] Remove unused resource string and TODOs. (Closed)
Patch Set: Created 4 years, 1 month 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/ntp_snippets_strings.grdp » ('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 "chrome/browser/ntp_snippets/download_suggestions_provider.h" 5 #include "chrome/browser/ntp_snippets/download_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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 // ContentSuggestion move constructor noexcept. 391 // ContentSuggestion move constructor noexcept.
392 while (suggestions.size() > kMaxSuggestionsCount) 392 while (suggestions.size() > kMaxSuggestionsCount)
393 suggestions.pop_back(); 393 suggestions.pop_back();
394 394
395 observer()->OnNewSuggestions(this, provided_category_, 395 observer()->OnNewSuggestions(this, provided_category_,
396 std::move(suggestions)); 396 std::move(suggestions));
397 } 397 }
398 398
399 ContentSuggestion DownloadSuggestionsProvider::ConvertOfflinePage( 399 ContentSuggestion DownloadSuggestionsProvider::ConvertOfflinePage(
400 const OfflinePageItem& offline_page) const { 400 const OfflinePageItem& offline_page) const {
401 // TODO(vitaliii): Make sure the URL is actually opened as an offline URL even
402 // when the user is online. See crbug.com/641568.
403 ContentSuggestion suggestion( 401 ContentSuggestion suggestion(
404 ContentSuggestion::ID(provided_category_, GetOfflinePagePerCategoryID( 402 ContentSuggestion::ID(provided_category_, GetOfflinePagePerCategoryID(
405 offline_page.offline_id)), 403 offline_page.offline_id)),
406 offline_page.url); 404 offline_page.url);
407 405
408 if (offline_page.title.empty()) { 406 if (offline_page.title.empty()) {
409 // TODO(vitaliii): Remove this fallback once the OfflinePageModel provides 407 // TODO(vitaliii): Remove this fallback once the OfflinePageModel provides
410 // titles for all (relevant) OfflinePageItems. 408 // titles for all (relevant) OfflinePageItems.
411 suggestion.set_title(base::UTF8ToUTF16(offline_page.url.spec())); 409 suggestion.set_title(base::UTF8ToUTF16(offline_page.url.spec()));
412 } else { 410 } else {
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 638
641 void DownloadSuggestionsProvider::UnregisterDownloadItemObservers() { 639 void DownloadSuggestionsProvider::UnregisterDownloadItemObservers() {
642 DCHECK_NE(download_manager_, nullptr); 640 DCHECK_NE(download_manager_, nullptr);
643 641
644 std::vector<DownloadItem*> all_downloads; 642 std::vector<DownloadItem*> all_downloads;
645 download_manager_->GetAllDownloads(&all_downloads); 643 download_manager_->GetAllDownloads(&all_downloads);
646 644
647 for (DownloadItem* item : all_downloads) 645 for (DownloadItem* item : all_downloads)
648 item->RemoveObserver(this); 646 item->RemoveObserver(this);
649 } 647 }
OLDNEW
« no previous file with comments | « no previous file | components/ntp_snippets_strings.grdp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698