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 13 matching lines...) Expand all Loading... |
24 #include "chrome/browser/ntp_snippets/content_suggestions_service_factory.h" | 24 #include "chrome/browser/ntp_snippets/content_suggestions_service_factory.h" |
25 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
26 #include "chrome/common/chrome_features.h" | 26 #include "chrome/common/chrome_features.h" |
27 #include "components/ntp_snippets/category.h" | 27 #include "components/ntp_snippets/category.h" |
28 #include "components/ntp_snippets/category_info.h" | 28 #include "components/ntp_snippets/category_info.h" |
29 #include "components/ntp_snippets/features.h" | 29 #include "components/ntp_snippets/features.h" |
30 #include "components/ntp_snippets/pref_names.h" | 30 #include "components/ntp_snippets/pref_names.h" |
31 #include "components/ntp_snippets/remote/ntp_snippets_fetcher.h" | 31 #include "components/ntp_snippets/remote/ntp_snippets_fetcher.h" |
32 #include "components/ntp_snippets/remote/remote_suggestions_provider.h" | 32 #include "components/ntp_snippets/remote/remote_suggestions_provider.h" |
33 #include "components/ntp_snippets/switches.h" | 33 #include "components/ntp_snippets/switches.h" |
| 34 #include "components/offline_pages/core/offline_page_feature.h" |
34 #include "components/prefs/pref_service.h" | 35 #include "components/prefs/pref_service.h" |
35 #include "content/public/browser/web_ui.h" | 36 #include "content/public/browser/web_ui.h" |
36 | 37 |
37 using ntp_snippets::ContentSuggestion; | 38 using ntp_snippets::ContentSuggestion; |
38 using ntp_snippets::Category; | 39 using ntp_snippets::Category; |
39 using ntp_snippets::CategoryInfo; | 40 using ntp_snippets::CategoryInfo; |
40 using ntp_snippets::CategoryStatus; | 41 using ntp_snippets::CategoryStatus; |
41 using ntp_snippets::KnownCategories; | 42 using ntp_snippets::KnownCategories; |
42 using ntp_snippets::RemoteSuggestionsProvider; | 43 using ntp_snippets::RemoteSuggestionsProvider; |
43 using ntp_snippets::UserClassifier; | 44 using ntp_snippets::UserClassifier; |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 | 274 |
274 void SnippetsInternalsMessageHandler::SendAllContent() { | 275 void SnippetsInternalsMessageHandler::SendAllContent() { |
275 SendBoolean("flag-snippets", base::FeatureList::IsEnabled( | 276 SendBoolean("flag-snippets", base::FeatureList::IsEnabled( |
276 ntp_snippets::kContentSuggestionsFeature)); | 277 ntp_snippets::kContentSuggestionsFeature)); |
277 SendBoolean( | 278 SendBoolean( |
278 "flag-article-suggestions", | 279 "flag-article-suggestions", |
279 base::FeatureList::IsEnabled(ntp_snippets::kArticleSuggestionsFeature)); | 280 base::FeatureList::IsEnabled(ntp_snippets::kArticleSuggestionsFeature)); |
280 SendBoolean("flag-recent-offline-tab-suggestions", | 281 SendBoolean("flag-recent-offline-tab-suggestions", |
281 base::FeatureList::IsEnabled( | 282 base::FeatureList::IsEnabled( |
282 ntp_snippets::kRecentOfflineTabSuggestionsFeature)); | 283 ntp_snippets::kRecentOfflineTabSuggestionsFeature)); |
| 284 SendBoolean("flag-offlining-recent-pages-feature", |
| 285 base::FeatureList::IsEnabled( |
| 286 offline_pages::kOffliningRecentPagesFeature)); |
283 SendBoolean( | 287 SendBoolean( |
284 "flag-asset-download-suggestions", | 288 "flag-asset-download-suggestions", |
285 base::FeatureList::IsEnabled(features::kAssetDownloadSuggestionsFeature)); | 289 base::FeatureList::IsEnabled(features::kAssetDownloadSuggestionsFeature)); |
286 SendBoolean("flag-offline-page-download-suggestions", | 290 SendBoolean("flag-offline-page-download-suggestions", |
287 base::FeatureList::IsEnabled( | 291 base::FeatureList::IsEnabled( |
288 features::kOfflinePageDownloadSuggestionsFeature)); | 292 features::kOfflinePageDownloadSuggestionsFeature)); |
289 SendBoolean( | 293 SendBoolean( |
290 "flag-bookmark-suggestions", | 294 "flag-bookmark-suggestions", |
291 base::FeatureList::IsEnabled(ntp_snippets::kBookmarkSuggestionsFeature)); | 295 base::FeatureList::IsEnabled(ntp_snippets::kBookmarkSuggestionsFeature)); |
292 | 296 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 | 411 |
408 void SnippetsInternalsMessageHandler::OnDismissedSuggestionsLoaded( | 412 void SnippetsInternalsMessageHandler::OnDismissedSuggestionsLoaded( |
409 Category category, | 413 Category category, |
410 std::vector<ContentSuggestion> dismissed_suggestions) { | 414 std::vector<ContentSuggestion> dismissed_suggestions) { |
411 if (dismissed_state_[category] == DismissedState::HIDDEN) | 415 if (dismissed_state_[category] == DismissedState::HIDDEN) |
412 return; | 416 return; |
413 dismissed_suggestions_[category] = std::move(dismissed_suggestions); | 417 dismissed_suggestions_[category] = std::move(dismissed_suggestions); |
414 dismissed_state_[category] = DismissedState::VISIBLE; | 418 dismissed_state_[category] = DismissedState::VISIBLE; |
415 SendContentSuggestions(); | 419 SendContentSuggestions(); |
416 } | 420 } |
OLD | NEW |