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

Unified Diff: ios/chrome/browser/ntp_snippets/ios_chrome_ntp_snippets_service_factory.cc

Issue 1922083004: Allow fetching personalized snippets from ChromeReader. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Yet another unittest fix Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/ntp_snippets/ntp_snippets_service_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ntp_snippets/ios_chrome_ntp_snippets_service_factory.cc
diff --git a/ios/chrome/browser/ntp_snippets/ios_chrome_ntp_snippets_service_factory.cc b/ios/chrome/browser/ntp_snippets/ios_chrome_ntp_snippets_service_factory.cc
index d5a3d3b899f2629c451b4e593482b01a74982a92..da7e41f1d54423c15e2f25c7baea7ec88ba0d050 100644
--- a/ios/chrome/browser/ntp_snippets/ios_chrome_ntp_snippets_service_factory.cc
+++ b/ios/chrome/browser/ntp_snippets/ios_chrome_ntp_snippets_service_factory.cc
@@ -13,9 +13,12 @@
#include "components/keyed_service/ios/browser_state_dependency_manager.h"
#include "components/ntp_snippets/ntp_snippets_fetcher.h"
#include "components/ntp_snippets/ntp_snippets_service.h"
+#include "components/signin/core/browser/signin_manager.h"
#include "components/version_info/version_info.h"
#include "ios/chrome/browser/application_context.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
+#include "ios/chrome/browser/signin/oauth2_token_service_factory.h"
+#include "ios/chrome/browser/signin/signin_manager_factory.h"
#include "ios/chrome/browser/suggestions/image_fetcher_impl.h"
#include "ios/chrome/browser/suggestions/suggestions_service_factory.h"
#include "ios/chrome/common/channel_info.h"
@@ -65,6 +68,8 @@ IOSChromeNTPSnippetsServiceFactory::IOSChromeNTPSnippetsServiceFactory()
: BrowserStateKeyedServiceFactory(
"NTPSnippetsService",
BrowserStateDependencyManager::GetInstance()) {
+ DependsOn(OAuth2TokenServiceFactory::GetInstance());
+ DependsOn(ios::SigninManagerFactory::GetInstance());
DependsOn(SuggestionsServiceFactory::GetInstance());
}
@@ -76,6 +81,10 @@ IOSChromeNTPSnippetsServiceFactory::BuildServiceInstanceFor(
ios::ChromeBrowserState* chrome_browser_state =
ios::ChromeBrowserState::FromBrowserState(browser_state);
DCHECK(!browser_state->IsOffTheRecord());
+ SigninManager* signin_manager =
+ ios::SigninManagerFactory::GetForBrowserState(chrome_browser_state);
+ OAuth2TokenService* token_service =
+ OAuth2TokenServiceFactory::GetForBrowserState(chrome_browser_state);
scoped_refptr<net::URLRequestContextGetter> request_context =
browser_state->GetRequestContext();
SuggestionsService* suggestions_service =
@@ -92,7 +101,8 @@ IOSChromeNTPSnippetsServiceFactory::BuildServiceInstanceFor(
chrome_browser_state->GetPrefs(), suggestions_service, task_runner,
GetApplicationContext()->GetApplicationLocale(), scheduler,
base::WrapUnique(new ntp_snippets::NTPSnippetsFetcher(
- request_context, base::Bind(&ParseJson),
+ signin_manager, token_service, request_context,
+ base::Bind(&ParseJson),
GetChannel() == version_info::Channel::STABLE)),
base::WrapUnique(new ImageFetcherImpl(
request_context.get(), web::WebThread::GetBlockingPool()))));
« no previous file with comments | « components/ntp_snippets/ntp_snippets_service_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698