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/ntp_snippets/content_suggestions_service_factory.h" | 5 #include "chrome/browser/ntp_snippets/content_suggestions_service_factory.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/feature_list.h" | 9 #include "base/feature_list.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 #include "chrome/browser/android/chrome_feature_list.h" | 62 #include "chrome/browser/android/chrome_feature_list.h" |
63 #include "chrome/browser/android/ntp/ntp_snippets_launcher.h" | 63 #include "chrome/browser/android/ntp/ntp_snippets_launcher.h" |
64 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" | 64 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" |
65 #include "chrome/browser/android/offline_pages/request_coordinator_factory.h" | 65 #include "chrome/browser/android/offline_pages/request_coordinator_factory.h" |
66 #include "chrome/browser/download/download_history.h" | 66 #include "chrome/browser/download/download_history.h" |
67 #include "chrome/browser/download/download_service.h" | 67 #include "chrome/browser/download/download_service.h" |
68 #include "chrome/browser/download/download_service_factory.h" | 68 #include "chrome/browser/download/download_service_factory.h" |
69 #include "chrome/browser/ntp_snippets/download_suggestions_provider.h" | 69 #include "chrome/browser/ntp_snippets/download_suggestions_provider.h" |
70 #include "components/ntp_snippets/offline_pages/recent_tab_suggestions_provider.
h" | 70 #include "components/ntp_snippets/offline_pages/recent_tab_suggestions_provider.
h" |
71 #include "components/ntp_snippets/physical_web_pages/physical_web_page_suggestio
ns_provider.h" | 71 #include "components/ntp_snippets/physical_web_pages/physical_web_page_suggestio
ns_provider.h" |
| 72 #include "components/offline_pages/content/suggested_articles_observer.h" |
72 #include "components/offline_pages/core/background/request_coordinator.h" | 73 #include "components/offline_pages/core/background/request_coordinator.h" |
73 #include "components/offline_pages/core/offline_page_feature.h" | 74 #include "components/offline_pages/core/offline_page_feature.h" |
74 #include "components/offline_pages/core/offline_page_model.h" | 75 #include "components/offline_pages/core/offline_page_model.h" |
75 #include "components/offline_pages/core/recent_tabs/recent_tabs_ui_adapter_deleg
ate.h" | 76 #include "components/offline_pages/core/recent_tabs/recent_tabs_ui_adapter_deleg
ate.h" |
76 #include "components/physical_web/data_source/physical_web_data_source.h" | 77 #include "components/physical_web/data_source/physical_web_data_source.h" |
77 | 78 |
78 using content::DownloadManager; | 79 using content::DownloadManager; |
79 using ntp_snippets::PhysicalWebPageSuggestionsProvider; | 80 using ntp_snippets::PhysicalWebPageSuggestionsProvider; |
80 using ntp_snippets::RecentTabSuggestionsProvider; | 81 using ntp_snippets::RecentTabSuggestionsProvider; |
81 using offline_pages::OfflinePageModel; | 82 using offline_pages::OfflinePageModel; |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 bool show_offline_page_downloads = | 367 bool show_offline_page_downloads = |
367 !IsChromeHomeEnabled() && | 368 !IsChromeHomeEnabled() && |
368 base::FeatureList::IsEnabled( | 369 base::FeatureList::IsEnabled( |
369 features::kOfflinePageDownloadSuggestionsFeature); | 370 features::kOfflinePageDownloadSuggestionsFeature); |
370 if (show_asset_downloads || show_offline_page_downloads) { | 371 if (show_asset_downloads || show_offline_page_downloads) { |
371 RegisterDownloadsProvider( | 372 RegisterDownloadsProvider( |
372 show_offline_page_downloads ? offline_page_model : nullptr, | 373 show_offline_page_downloads ? offline_page_model : nullptr, |
373 show_asset_downloads ? download_manager : nullptr, download_history, | 374 show_asset_downloads ? download_manager : nullptr, download_history, |
374 service, pref_service); | 375 service, pref_service); |
375 } | 376 } |
| 377 |
| 378 offline_pages::SuggestedArticlesObserver::ObserveContentSuggestionsService( |
| 379 profile, service); |
376 #endif // OS_ANDROID | 380 #endif // OS_ANDROID |
377 | 381 |
378 // |bookmark_model| can be null in tests. | 382 // |bookmark_model| can be null in tests. |
379 if (base::FeatureList::IsEnabled(ntp_snippets::kBookmarkSuggestionsFeature) && | 383 if (base::FeatureList::IsEnabled(ntp_snippets::kBookmarkSuggestionsFeature) && |
380 bookmark_model && !IsChromeHomeEnabled()) { | 384 bookmark_model && !IsChromeHomeEnabled()) { |
381 RegisterBookmarkProvider(bookmark_model, service, pref_service); | 385 RegisterBookmarkProvider(bookmark_model, service, pref_service); |
382 } | 386 } |
383 | 387 |
384 #if defined(OS_ANDROID) | 388 #if defined(OS_ANDROID) |
385 if (IsPhysicalWebPageProviderEnabled()) { | 389 if (IsPhysicalWebPageProviderEnabled()) { |
(...skipping 12 matching lines...) Expand all Loading... |
398 ntp_snippets::kForeignSessionsSuggestionsFeature)) { | 402 ntp_snippets::kForeignSessionsSuggestionsFeature)) { |
399 RegisterForeignSessionsProvider(sync_service, service, pref_service); | 403 RegisterForeignSessionsProvider(sync_service, service, pref_service); |
400 } | 404 } |
401 | 405 |
402 return service; | 406 return service; |
403 | 407 |
404 #else | 408 #else |
405 return nullptr; | 409 return nullptr; |
406 #endif // CONTENT_SUGGESTIONS_ENABLED | 410 #endif // CONTENT_SUGGESTIONS_ENABLED |
407 } | 411 } |
OLD | NEW |