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

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

Issue 2111573002: Add ios_image_decoder_impl.* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo in ios_chrome.gyp 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
« no previous file with comments | « components/image_fetcher/image_decoder.h ('k') | ios/chrome/browser/BUILD.gn » ('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 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 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 DCHECK_GT(next_expiry, expiry); 622 DCHECK_GT(next_expiry, expiry);
623 expiry_timer_.Start(FROM_HERE, next_expiry - expiry, 623 expiry_timer_.Start(FROM_HERE, next_expiry - expiry,
624 base::Bind(&NTPSnippetsService::ClearExpiredSnippets, 624 base::Bind(&NTPSnippetsService::ClearExpiredSnippets,
625 base::Unretained(this))); 625 base::Unretained(this)));
626 } 626 }
627 627
628 void NTPSnippetsService::OnSnippetImageFetchedFromDatabase( 628 void NTPSnippetsService::OnSnippetImageFetchedFromDatabase(
629 const std::string& snippet_id, 629 const std::string& snippet_id,
630 const ImageFetchedCallback& callback, 630 const ImageFetchedCallback& callback,
631 std::string data) { 631 std::string data) {
632 // |image_decoder_| is null on iOS and in tests. 632 // |image_decoder_| is null in tests.
633 if (image_decoder_ && !data.empty()) { 633 if (image_decoder_ && !data.empty()) {
634 image_decoder_->DecodeImage( 634 image_decoder_->DecodeImage(
635 std::move(data), 635 std::move(data),
636 base::Bind(&NTPSnippetsService::OnSnippetImageDecoded, 636 base::Bind(&NTPSnippetsService::OnSnippetImageDecoded,
637 base::Unretained(this), snippet_id, callback)); 637 base::Unretained(this), snippet_id, callback));
638 return; 638 return;
639 } 639 }
640 640
641 // Fetching from the DB failed; start a network fetch. 641 // Fetching from the DB failed; start a network fetch.
642 FetchSnippetImageFromNetwork(snippet_id, callback); 642 FetchSnippetImageFromNetwork(snippet_id, callback);
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 return; 806 return;
807 } 807 }
808 } 808 }
809 809
810 void NTPSnippetsService::ClearDeprecatedPrefs() { 810 void NTPSnippetsService::ClearDeprecatedPrefs() {
811 pref_service_->ClearPref(prefs::kDeprecatedSnippets); 811 pref_service_->ClearPref(prefs::kDeprecatedSnippets);
812 pref_service_->ClearPref(prefs::kDeprecatedDiscardedSnippets); 812 pref_service_->ClearPref(prefs::kDeprecatedDiscardedSnippets);
813 } 813 }
814 814
815 } // namespace ntp_snippets 815 } // namespace ntp_snippets
OLDNEW
« no previous file with comments | « components/image_fetcher/image_decoder.h ('k') | ios/chrome/browser/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698