| 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 | 307 |
| 308 SendBoolean("flag-physical-web", base::FeatureList::IsEnabled( | 308 SendBoolean("flag-physical-web", base::FeatureList::IsEnabled( |
| 309 chrome::android::kPhysicalWebFeature)); | 309 chrome::android::kPhysicalWebFeature)); |
| 310 | 310 |
| 311 SendClassification(); | 311 SendClassification(); |
| 312 SendLastRemoteSuggestionsBackgroundFetchTime(); | 312 SendLastRemoteSuggestionsBackgroundFetchTime(); |
| 313 | 313 |
| 314 if (remote_suggestions_provider_) { | 314 if (remote_suggestions_provider_) { |
| 315 const ntp_snippets::RemoteSuggestionsFetcher* fetcher = | 315 const ntp_snippets::RemoteSuggestionsFetcher* fetcher = |
| 316 remote_suggestions_provider_->suggestions_fetcher_for_debugging(); | 316 remote_suggestions_provider_->suggestions_fetcher_for_debugging(); |
| 317 // TODO(fhorschig): Read this string from variations directly. | |
| 318 SendString("switch-personalized", fetcher->PersonalizationModeString()); | |
| 319 | |
| 320 SendString("switch-fetch-url", fetcher->fetch_url().spec()); | 317 SendString("switch-fetch-url", fetcher->fetch_url().spec()); |
| 321 web_ui()->CallJavascriptFunctionUnsafe( | 318 web_ui()->CallJavascriptFunctionUnsafe( |
| 322 "chrome.SnippetsInternals.receiveJson", | 319 "chrome.SnippetsInternals.receiveJson", |
| 323 base::StringValue(fetcher->last_json())); | 320 base::StringValue(fetcher->last_json())); |
| 324 } | 321 } |
| 325 | 322 |
| 326 SendContentSuggestions(); | 323 SendContentSuggestions(); |
| 327 } | 324 } |
| 328 | 325 |
| 329 void SnippetsInternalsMessageHandler::SendClassification() { | 326 void SnippetsInternalsMessageHandler::SendClassification() { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 void SnippetsInternalsMessageHandler::OnDismissedSuggestionsLoaded( | 418 void SnippetsInternalsMessageHandler::OnDismissedSuggestionsLoaded( |
| 422 Category category, | 419 Category category, |
| 423 std::vector<ContentSuggestion> dismissed_suggestions) { | 420 std::vector<ContentSuggestion> dismissed_suggestions) { |
| 424 if (dismissed_state_[category] == DismissedState::HIDDEN) { | 421 if (dismissed_state_[category] == DismissedState::HIDDEN) { |
| 425 return; | 422 return; |
| 426 } | 423 } |
| 427 dismissed_suggestions_[category] = std::move(dismissed_suggestions); | 424 dismissed_suggestions_[category] = std::move(dismissed_suggestions); |
| 428 dismissed_state_[category] = DismissedState::VISIBLE; | 425 dismissed_state_[category] = DismissedState::VISIBLE; |
| 429 SendContentSuggestions(); | 426 SendContentSuggestions(); |
| 430 } | 427 } |
| OLD | NEW |