Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Side by Side Diff: chrome/browser/ntp_snippets/content_suggestions_service_factory.cc

Issue 2228553003: a provider of Physical Web pages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: resolved compile error. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | chrome/browser/resources/snippets_internals.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/feature_list.h" 7 #include "base/feature_list.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
(...skipping 27 matching lines...) Expand all
38 #include "content/public/browser/browser_context.h" 38 #include "content/public/browser/browser_context.h"
39 #include "content/public/browser/browser_thread.h" 39 #include "content/public/browser/browser_thread.h"
40 #include "content/public/browser/storage_partition.h" 40 #include "content/public/browser/storage_partition.h"
41 #include "net/url_request/url_request_context_getter.h" 41 #include "net/url_request/url_request_context_getter.h"
42 42
43 #if defined(OS_ANDROID) 43 #if defined(OS_ANDROID)
44 #include "chrome/browser/android/chrome_feature_list.h" 44 #include "chrome/browser/android/chrome_feature_list.h"
45 #include "chrome/browser/android/ntp/ntp_snippets_launcher.h" 45 #include "chrome/browser/android/ntp/ntp_snippets_launcher.h"
46 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" 46 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h"
47 #include "components/ntp_snippets/offline_pages/offline_page_suggestions_provide r.h" 47 #include "components/ntp_snippets/offline_pages/offline_page_suggestions_provide r.h"
48 #include "components/ntp_snippets/physical_web_pages/physical_web_page_suggestio ns_provider.h"
48 #include "components/offline_pages/offline_page_model.h" 49 #include "components/offline_pages/offline_page_model.h"
49 50
50 using ntp_snippets::OfflinePageSuggestionsProvider; 51 using ntp_snippets::OfflinePageSuggestionsProvider;
52 using ntp_snippets::PhysicalWebPageSuggestionsProvider;
51 using offline_pages::OfflinePageModel; 53 using offline_pages::OfflinePageModel;
52 using offline_pages::OfflinePageModelFactory; 54 using offline_pages::OfflinePageModelFactory;
53 #endif // OS_ANDROID 55 #endif // OS_ANDROID
54 56
55 using bookmarks::BookmarkModel; 57 using bookmarks::BookmarkModel;
56 using content::BrowserThread; 58 using content::BrowserThread;
57 using image_fetcher::ImageFetcherImpl; 59 using image_fetcher::ImageFetcherImpl;
58 using ntp_snippets::BookmarkSuggestionsProvider; 60 using ntp_snippets::BookmarkSuggestionsProvider;
59 using ntp_snippets::ContentSuggestionsService; 61 using ntp_snippets::ContentSuggestionsService;
60 using ntp_snippets::NTPSnippetsDatabase; 62 using ntp_snippets::NTPSnippetsDatabase;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 if (base::FeatureList::IsEnabled( 153 if (base::FeatureList::IsEnabled(
152 ntp_snippets::kBookmarkSuggestionsFeature)) { 154 ntp_snippets::kBookmarkSuggestionsFeature)) {
153 BookmarkModel* bookmark_model = 155 BookmarkModel* bookmark_model =
154 BookmarkModelFactory::GetForBrowserContext(profile); 156 BookmarkModelFactory::GetForBrowserContext(profile);
155 std::unique_ptr<BookmarkSuggestionsProvider> bookmark_suggestions_provider = 157 std::unique_ptr<BookmarkSuggestionsProvider> bookmark_suggestions_provider =
156 base::MakeUnique<BookmarkSuggestionsProvider>( 158 base::MakeUnique<BookmarkSuggestionsProvider>(
157 service, service->category_factory(), bookmark_model); 159 service, service->category_factory(), bookmark_model);
158 service->RegisterProvider(std::move(bookmark_suggestions_provider)); 160 service->RegisterProvider(std::move(bookmark_suggestions_provider));
159 } 161 }
160 162
163 #if defined(OS_ANDROID)
164 // Create the PhysicalWebPageSuggestionsProvider.
165 if (base::FeatureList::IsEnabled(
166 ntp_snippets::kPhysicalWebPageSuggestionsFeature)) {
167 std::unique_ptr<PhysicalWebPageSuggestionsProvider>
168 physical_web_page_suggestions_provider =
169 base::MakeUnique<PhysicalWebPageSuggestionsProvider>(
170 service, service->category_factory());
171 service->RegisterProvider(
172 std::move(physical_web_page_suggestions_provider));
173 }
174 #endif // OS_ANDROID
175
161 if (base::FeatureList::IsEnabled(ntp_snippets::kArticleSuggestionsFeature)) { 176 if (base::FeatureList::IsEnabled(ntp_snippets::kArticleSuggestionsFeature)) {
162 // Create the NTPSnippetsService (articles provider). 177 // Create the NTPSnippetsService (articles provider).
163 SigninManagerBase* signin_manager = 178 SigninManagerBase* signin_manager =
164 SigninManagerFactory::GetForProfile(profile); 179 SigninManagerFactory::GetForProfile(profile);
165 OAuth2TokenService* token_service = 180 OAuth2TokenService* token_service =
166 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); 181 ProfileOAuth2TokenServiceFactory::GetForProfile(profile);
167 scoped_refptr<net::URLRequestContextGetter> request_context = 182 scoped_refptr<net::URLRequestContextGetter> request_context =
168 content::BrowserContext::GetDefaultStoragePartition(context) 183 content::BrowserContext::GetDefaultStoragePartition(context)
169 ->GetURLRequestContext(); 184 ->GetURLRequestContext();
170 SuggestionsService* suggestions_service = 185 SuggestionsService* suggestions_service =
(...skipping 25 matching lines...) Expand all
196 base::MakeUnique<ImageDecoderImpl>(), 211 base::MakeUnique<ImageDecoderImpl>(),
197 base::MakeUnique<NTPSnippetsDatabase>(database_dir, task_runner), 212 base::MakeUnique<NTPSnippetsDatabase>(database_dir, task_runner),
198 base::MakeUnique<NTPSnippetsStatusService>(signin_manager, 213 base::MakeUnique<NTPSnippetsStatusService>(signin_manager,
199 profile->GetPrefs())); 214 profile->GetPrefs()));
200 service->set_ntp_snippets_service(ntp_snippets_service.get()); 215 service->set_ntp_snippets_service(ntp_snippets_service.get());
201 service->RegisterProvider(std::move(ntp_snippets_service)); 216 service->RegisterProvider(std::move(ntp_snippets_service));
202 } 217 }
203 218
204 return service; 219 return service;
205 } 220 }
OLDNEW
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | chrome/browser/resources/snippets_internals.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698