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

Unified Diff: chrome/browser/ntp_snippets/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 | « no previous file | chrome/browser/resources/snippets_internals.css » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ntp_snippets/ntp_snippets_service_factory.cc
diff --git a/chrome/browser/ntp_snippets/ntp_snippets_service_factory.cc b/chrome/browser/ntp_snippets/ntp_snippets_service_factory.cc
index 4fc5a35d7a6a3570befd74c4605bc68ba185e69a..140656102b52617c4e9e6367a808aeefcb41785b 100644
--- a/chrome/browser/ntp_snippets/ntp_snippets_service_factory.cc
+++ b/chrome/browser/ntp_snippets/ntp_snippets_service_factory.cc
@@ -10,6 +10,8 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search/suggestions/image_fetcher_impl.h"
#include "chrome/browser/search/suggestions/suggestions_service_factory.h"
+#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
+#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/common/channel_info.h"
#include "components/image_fetcher/image_fetcher.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
@@ -17,6 +19,8 @@
#include "components/ntp_snippets/ntp_snippets_scheduler.h"
#include "components/ntp_snippets/ntp_snippets_service.h"
#include "components/safe_json/safe_json_parser.h"
+#include "components/signin/core/browser/profile_oauth2_token_service.h"
+#include "components/signin/core/browser/signin_manager.h"
#include "components/version_info/version_info.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
@@ -49,6 +53,8 @@ NTPSnippetsServiceFactory::NTPSnippetsServiceFactory()
: BrowserContextKeyedServiceFactory(
"NTPSnippetsService",
BrowserContextDependencyManager::GetInstance()) {
+ DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance());
+ DependsOn(SigninManagerFactory::GetInstance());
DependsOn(SuggestionsServiceFactory::GetInstance());
}
@@ -57,6 +63,10 @@ NTPSnippetsServiceFactory::~NTPSnippetsServiceFactory() {}
KeyedService* NTPSnippetsServiceFactory::BuildServiceInstanceFor(
content::BrowserContext* context) const {
Profile* profile = Profile::FromBrowserContext(context);
+ SigninManagerBase* signin_manager =
+ SigninManagerFactory::GetForProfile(profile);
+ OAuth2TokenService* token_service =
+ ProfileOAuth2TokenServiceFactory::GetForProfile(profile);
scoped_refptr<net::URLRequestContextGetter> request_context =
content::BrowserContext::GetDefaultStoragePartition(context)->
GetURLRequestContext();
@@ -78,7 +88,8 @@ KeyedService* NTPSnippetsServiceFactory::BuildServiceInstanceFor(
profile->GetPrefs(), suggestions_service, task_runner,
g_browser_process->GetApplicationLocale(), scheduler,
base::WrapUnique(new ntp_snippets::NTPSnippetsFetcher(
- request_context, base::Bind(&safe_json::SafeJsonParser::Parse),
+ signin_manager, token_service, request_context,
+ base::Bind(&safe_json::SafeJsonParser::Parse),
chrome::GetChannel() == version_info::Channel::STABLE)),
base::WrapUnique(new ImageFetcherImpl(request_context.get())));
}
« no previous file with comments | « no previous file | chrome/browser/resources/snippets_internals.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698