| 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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 | 301 |
| 302 SendBoolean("flag-physical-web", base::FeatureList::IsEnabled( | 302 SendBoolean("flag-physical-web", base::FeatureList::IsEnabled( |
| 303 chrome::android::kPhysicalWebFeature)); | 303 chrome::android::kPhysicalWebFeature)); |
| 304 | 304 |
| 305 SendClassification(); | 305 SendClassification(); |
| 306 SendLastRemoteSuggestionsBackgroundFetchTime(); | 306 SendLastRemoteSuggestionsBackgroundFetchTime(); |
| 307 | 307 |
| 308 if (remote_suggestions_provider_) { | 308 if (remote_suggestions_provider_) { |
| 309 const ntp_snippets::RemoteSuggestionsFetcher* fetcher = | 309 const ntp_snippets::RemoteSuggestionsFetcher* fetcher = |
| 310 remote_suggestions_provider_->suggestions_fetcher_for_debugging(); | 310 remote_suggestions_provider_->suggestions_fetcher_for_debugging(); |
| 311 // TODO(fhorschig): Read this string from variations directly. | |
| 312 SendString("switch-personalized", fetcher->PersonalizationModeString()); | |
| 313 | |
| 314 SendString("switch-fetch-url", fetcher->fetch_url().spec()); | 311 SendString("switch-fetch-url", fetcher->fetch_url().spec()); |
| 315 web_ui()->CallJavascriptFunctionUnsafe( | 312 web_ui()->CallJavascriptFunctionUnsafe( |
| 316 "chrome.SnippetsInternals.receiveJson", | 313 "chrome.SnippetsInternals.receiveJson", |
| 317 base::StringValue(fetcher->last_json())); | 314 base::StringValue(fetcher->last_json())); |
| 318 } | 315 } |
| 319 | 316 |
| 320 SendContentSuggestions(); | 317 SendContentSuggestions(); |
| 321 } | 318 } |
| 322 | 319 |
| 323 void SnippetsInternalsMessageHandler::SendClassification() { | 320 void SnippetsInternalsMessageHandler::SendClassification() { |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 | 410 |
| 414 void SnippetsInternalsMessageHandler::OnDismissedSuggestionsLoaded( | 411 void SnippetsInternalsMessageHandler::OnDismissedSuggestionsLoaded( |
| 415 Category category, | 412 Category category, |
| 416 std::vector<ContentSuggestion> dismissed_suggestions) { | 413 std::vector<ContentSuggestion> dismissed_suggestions) { |
| 417 if (dismissed_state_[category] == DismissedState::HIDDEN) | 414 if (dismissed_state_[category] == DismissedState::HIDDEN) |
| 418 return; | 415 return; |
| 419 dismissed_suggestions_[category] = std::move(dismissed_suggestions); | 416 dismissed_suggestions_[category] = std::move(dismissed_suggestions); |
| 420 dismissed_state_[category] = DismissedState::VISIBLE; | 417 dismissed_state_[category] = DismissedState::VISIBLE; |
| 421 SendContentSuggestions(); | 418 SendContentSuggestions(); |
| 422 } | 419 } |
| OLD | NEW |