| 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/physical_web_pages/physical_web_page_suggestio
ns_provider.h" | 5 #include "components/ntp_snippets/physical_web_pages/physical_web_page_suggestio
ns_provider.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 // (see crbug.com/667722). | 217 // (see crbug.com/667722). |
| 218 suggestion.set_publish_date( | 218 suggestion.set_publish_date( |
| 219 base::Time::FromTimeT(static_cast<time_t>(scan_timestamp))); | 219 base::Time::FromTimeT(static_cast<time_t>(scan_timestamp))); |
| 220 suggestion.set_publisher_name(base::UTF8ToUTF16(resolved_url.host())); | 220 suggestion.set_publisher_name(base::UTF8ToUTF16(resolved_url.host())); |
| 221 DCHECK(base::IsStringUTF8(description)); | 221 DCHECK(base::IsStringUTF8(description)); |
| 222 suggestion.set_snippet_text(base::UTF8ToUTF16(description)); | 222 suggestion.set_snippet_text(base::UTF8ToUTF16(description)); |
| 223 return suggestion; | 223 return suggestion; |
| 224 } | 224 } |
| 225 | 225 |
| 226 // PhysicalWebListener implementation. | 226 // PhysicalWebListener implementation. |
| 227 void PhysicalWebPageSuggestionsProvider::OnFound(const std::string& url) { | 227 void PhysicalWebPageSuggestionsProvider::OnFound(const GURL& url) { |
| 228 FetchPhysicalWebPages(); | 228 FetchPhysicalWebPages(); |
| 229 } | 229 } |
| 230 | 230 |
| 231 void PhysicalWebPageSuggestionsProvider::OnLost(const std::string& url) { | 231 void PhysicalWebPageSuggestionsProvider::OnLost(const GURL& url) { |
| 232 // TODO(vitaliii): Do not refetch, but just update the current state. | 232 // TODO(vitaliii): Do not refetch, but just update the current state. |
| 233 FetchPhysicalWebPages(); | 233 FetchPhysicalWebPages(); |
| 234 } | 234 } |
| 235 | 235 |
| 236 void PhysicalWebPageSuggestionsProvider::OnDistanceChanged( | 236 void PhysicalWebPageSuggestionsProvider::OnDistanceChanged( |
| 237 const std::string& url, | 237 const GURL& url, |
| 238 double distance_estimate) { | 238 double distance_estimate) { |
| 239 FetchPhysicalWebPages(); | 239 FetchPhysicalWebPages(); |
| 240 } | 240 } |
| 241 | 241 |
| 242 } // namespace ntp_snippets | 242 } // namespace ntp_snippets |
| OLD | NEW |