| 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 "chrome/browser/ui/webui/snippets_internals_message_handler.h" | 5 #include "chrome/browser/ui/webui/snippets_internals_message_handler.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 const base::ListValue* args) { | 307 const base::ListValue* args) { |
| 308 DCHECK_EQ(0u, args->GetSize()); | 308 DCHECK_EQ(0u, args->GetSize()); |
| 309 content_suggestions_service_->user_classifier() | 309 content_suggestions_service_->user_classifier() |
| 310 ->ClearClassificationForDebugging(); | 310 ->ClearClassificationForDebugging(); |
| 311 SendClassification(); | 311 SendClassification(); |
| 312 } | 312 } |
| 313 | 313 |
| 314 void SnippetsInternalsMessageHandler::FetchRemoteSuggestionsInTheBackground( | 314 void SnippetsInternalsMessageHandler::FetchRemoteSuggestionsInTheBackground( |
| 315 const base::ListValue* args) { | 315 const base::ListValue* args) { |
| 316 DCHECK_EQ(0u, args->GetSize()); | 316 DCHECK_EQ(0u, args->GetSize()); |
| 317 remote_suggestions_provider_->RefetchInTheBackground(nullptr); | 317 remote_suggestions_provider_->RefetchInTheBackground( |
| 318 RemoteSuggestionsProvider::FetchStatusCallback()); |
| 318 } | 319 } |
| 319 | 320 |
| 320 void SnippetsInternalsMessageHandler::SendAllContent() { | 321 void SnippetsInternalsMessageHandler::SendAllContent() { |
| 321 SendBoolean( | 322 SendBoolean( |
| 322 "flag-article-suggestions", | 323 "flag-article-suggestions", |
| 323 base::FeatureList::IsEnabled(ntp_snippets::kArticleSuggestionsFeature)); | 324 base::FeatureList::IsEnabled(ntp_snippets::kArticleSuggestionsFeature)); |
| 324 SendBoolean("flag-recent-offline-tab-suggestions", | 325 SendBoolean("flag-recent-offline-tab-suggestions", |
| 325 base::FeatureList::IsEnabled( | 326 base::FeatureList::IsEnabled( |
| 326 ntp_snippets::kRecentOfflineTabSuggestionsFeature)); | 327 ntp_snippets::kRecentOfflineTabSuggestionsFeature)); |
| 327 SendBoolean("flag-offlining-recent-pages-feature", | 328 SendBoolean("flag-offlining-recent-pages-feature", |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 void SnippetsInternalsMessageHandler::OnDismissedSuggestionsLoaded( | 455 void SnippetsInternalsMessageHandler::OnDismissedSuggestionsLoaded( |
| 455 Category category, | 456 Category category, |
| 456 std::vector<ContentSuggestion> dismissed_suggestions) { | 457 std::vector<ContentSuggestion> dismissed_suggestions) { |
| 457 if (dismissed_state_[category] == DismissedState::HIDDEN) { | 458 if (dismissed_state_[category] == DismissedState::HIDDEN) { |
| 458 return; | 459 return; |
| 459 } | 460 } |
| 460 dismissed_suggestions_[category] = std::move(dismissed_suggestions); | 461 dismissed_suggestions_[category] = std::move(dismissed_suggestions); |
| 461 dismissed_state_[category] = DismissedState::VISIBLE; | 462 dismissed_state_[category] = DismissedState::VISIBLE; |
| 462 SendContentSuggestions(); | 463 SendContentSuggestions(); |
| 463 } | 464 } |
| OLD | NEW |