| OLD | NEW |
| 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/sessions/foreign_sessions_suggestions_provider
.h" | 5 #include "components/ntp_snippets/sessions/foreign_sessions_suggestions_provider
.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <tuple> | 9 #include <tuple> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 dismissed_ids); | 142 dismissed_ids); |
| 143 } | 143 } |
| 144 | 144 |
| 145 void ForeignSessionsSuggestionsProvider::FetchSuggestionImage( | 145 void ForeignSessionsSuggestionsProvider::FetchSuggestionImage( |
| 146 const ContentSuggestion::ID& suggestion_id, | 146 const ContentSuggestion::ID& suggestion_id, |
| 147 const ImageFetchedCallback& callback) { | 147 const ImageFetchedCallback& callback) { |
| 148 base::ThreadTaskRunnerHandle::Get()->PostTask( | 148 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 149 FROM_HERE, base::Bind(callback, gfx::Image())); | 149 FROM_HERE, base::Bind(callback, gfx::Image())); |
| 150 } | 150 } |
| 151 | 151 |
| 152 void ForeignSessionsSuggestionsProvider::FetchMore( |
| 153 const Category& category, |
| 154 FetchedMoreCallback callback) { |
| 155 // Ignored. |
| 156 } |
| 157 |
| 152 void ForeignSessionsSuggestionsProvider::ClearHistory( | 158 void ForeignSessionsSuggestionsProvider::ClearHistory( |
| 153 base::Time begin, | 159 base::Time begin, |
| 154 base::Time end, | 160 base::Time end, |
| 155 const base::Callback<bool(const GURL& url)>& filter) { | 161 const base::Callback<bool(const GURL& url)>& filter) { |
| 156 std::set<std::string> dismissed_ids = prefs::ReadDismissedIDsFromPrefs( | 162 std::set<std::string> dismissed_ids = prefs::ReadDismissedIDsFromPrefs( |
| 157 *pref_service_, prefs::kDismissedForeignSessionsSuggestions); | 163 *pref_service_, prefs::kDismissedForeignSessionsSuggestions); |
| 158 for (auto iter = dismissed_ids.begin(); iter != dismissed_ids.end();) { | 164 for (auto iter = dismissed_ids.begin(); iter != dismissed_ids.end();) { |
| 159 if (filter.Run(GURL(*iter))) { | 165 if (filter.Run(GURL(*iter))) { |
| 160 iter = dismissed_ids.erase(iter); | 166 iter = dismissed_ids.erase(iter); |
| 161 } else { | 167 } else { |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 // This field is sandwiched between the url's favicon, which is on the left, | 315 // This field is sandwiched between the url's favicon, which is on the left, |
| 310 // and the |publish_date|, which is to the right. The domain should always | 316 // and the |publish_date|, which is to the right. The domain should always |
| 311 // appear next to the favicon. | 317 // appear next to the favicon. |
| 312 suggestion.set_publisher_name( | 318 suggestion.set_publisher_name( |
| 313 base::UTF8ToUTF16(data.navigation->virtual_url().host() + " - " + | 319 base::UTF8ToUTF16(data.navigation->virtual_url().host() + " - " + |
| 314 data.session->session_name)); | 320 data.session->session_name)); |
| 315 return suggestion; | 321 return suggestion; |
| 316 } | 322 } |
| 317 | 323 |
| 318 } // namespace ntp_snippets | 324 } // namespace ntp_snippets |
| OLD | NEW |