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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 #include "content/public/browser/browser_context.h" | 54 #include "content/public/browser/browser_context.h" |
55 #include "content/public/browser/browser_thread.h" | 55 #include "content/public/browser/browser_thread.h" |
56 #include "content/public/browser/storage_partition.h" | 56 #include "content/public/browser/storage_partition.h" |
57 #include "google_apis/google_api_keys.h" | 57 #include "google_apis/google_api_keys.h" |
58 #include "net/url_request/url_request_context_getter.h" | 58 #include "net/url_request/url_request_context_getter.h" |
59 | 59 |
60 #if defined(OS_ANDROID) | 60 #if defined(OS_ANDROID) |
61 #include "chrome/browser/android/chrome_feature_list.h" | 61 #include "chrome/browser/android/chrome_feature_list.h" |
62 #include "chrome/browser/android/ntp/ntp_snippets_launcher.h" | 62 #include "chrome/browser/android/ntp/ntp_snippets_launcher.h" |
63 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" | 63 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" |
| 64 #include "chrome/browser/android/offline_pages/offline_page_suggestions_observer
.h" |
64 #include "chrome/browser/android/offline_pages/request_coordinator_factory.h" | 65 #include "chrome/browser/android/offline_pages/request_coordinator_factory.h" |
65 #include "chrome/browser/download/download_history.h" | 66 #include "chrome/browser/download/download_history.h" |
66 #include "chrome/browser/download/download_service.h" | 67 #include "chrome/browser/download/download_service.h" |
67 #include "chrome/browser/download/download_service_factory.h" | 68 #include "chrome/browser/download/download_service_factory.h" |
68 #include "chrome/browser/ntp_snippets/download_suggestions_provider.h" | 69 #include "chrome/browser/ntp_snippets/download_suggestions_provider.h" |
69 #include "components/ntp_snippets/offline_pages/recent_tab_suggestions_provider.
h" | 70 #include "components/ntp_snippets/offline_pages/recent_tab_suggestions_provider.
h" |
70 #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" |
71 #include "components/offline_pages/core/background/request_coordinator.h" | 72 #include "components/offline_pages/core/background/request_coordinator.h" |
72 #include "components/offline_pages/core/offline_page_feature.h" | 73 #include "components/offline_pages/core/offline_page_feature.h" |
73 #include "components/offline_pages/core/offline_page_model.h" | 74 #include "components/offline_pages/core/offline_page_model.h" |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 bool show_offline_page_downloads = | 356 bool show_offline_page_downloads = |
356 !IsChromeHomeEnabled() && | 357 !IsChromeHomeEnabled() && |
357 base::FeatureList::IsEnabled( | 358 base::FeatureList::IsEnabled( |
358 features::kOfflinePageDownloadSuggestionsFeature); | 359 features::kOfflinePageDownloadSuggestionsFeature); |
359 if (show_asset_downloads || show_offline_page_downloads) { | 360 if (show_asset_downloads || show_offline_page_downloads) { |
360 RegisterDownloadsProvider( | 361 RegisterDownloadsProvider( |
361 show_offline_page_downloads ? offline_page_model : nullptr, | 362 show_offline_page_downloads ? offline_page_model : nullptr, |
362 show_asset_downloads ? download_manager : nullptr, download_history, | 363 show_asset_downloads ? download_manager : nullptr, download_history, |
363 service, pref_service); | 364 service, pref_service); |
364 } | 365 } |
| 366 |
| 367 offline_pages::SuggestionsObserver::ObserveContentSuggestionsService(profile, |
| 368 service); |
365 #endif // OS_ANDROID | 369 #endif // OS_ANDROID |
366 | 370 |
367 // |bookmark_model| can be null in tests. | 371 // |bookmark_model| can be null in tests. |
368 if (base::FeatureList::IsEnabled(ntp_snippets::kBookmarkSuggestionsFeature) && | 372 if (base::FeatureList::IsEnabled(ntp_snippets::kBookmarkSuggestionsFeature) && |
369 bookmark_model && !IsChromeHomeEnabled()) { | 373 bookmark_model && !IsChromeHomeEnabled()) { |
370 RegisterBookmarkProvider(bookmark_model, service, pref_service); | 374 RegisterBookmarkProvider(bookmark_model, service, pref_service); |
371 } | 375 } |
372 | 376 |
373 #if defined(OS_ANDROID) | 377 #if defined(OS_ANDROID) |
374 if (IsPhysicalWebPageProviderEnabled()) { | 378 if (IsPhysicalWebPageProviderEnabled()) { |
(...skipping 12 matching lines...) Expand all Loading... |
387 ntp_snippets::kForeignSessionsSuggestionsFeature)) { | 391 ntp_snippets::kForeignSessionsSuggestionsFeature)) { |
388 RegisterForeignSessionsProvider(sync_service, service, pref_service); | 392 RegisterForeignSessionsProvider(sync_service, service, pref_service); |
389 } | 393 } |
390 | 394 |
391 return service; | 395 return service; |
392 | 396 |
393 #else | 397 #else |
394 return nullptr; | 398 return nullptr; |
395 #endif // CONTENT_SUGGESTIONS_ENABLED | 399 #endif // CONTENT_SUGGESTIONS_ENABLED |
396 } | 400 } |
OLD | NEW |