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

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

Issue 1677073002: Fetch snippets from ChromeReader and show them on the NTP (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments Created 4 years, 10 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 4fa922ed35899f24b898302fd7e520d70d8b54f1..0602d85c4d94e7ee3d2fdae22a19682ddb71fca4 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
@@ -7,9 +7,17 @@
#include "base/logging.h"
#include "base/memory/singleton.h"
#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/profile_oauth2_token_service.h"
+#include "google_apis/gaia/oauth2_token_service.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/web/public/browser_state.h"
+#include "ios/web/public/web_thread.h"
+#include "net/url_request/url_request_context_getter.h"
// static
IOSChromeNTPSnippetsServiceFactory*
@@ -36,7 +44,24 @@ IOSChromeNTPSnippetsServiceFactory::~IOSChromeNTPSnippetsServiceFactory() {}
scoped_ptr<KeyedService>
IOSChromeNTPSnippetsServiceFactory::BuildServiceInstanceFor(
web::BrowserState* browser_state) const {
+ 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();
+
+ scoped_refptr<base::SequencedTaskRunner> task_runner =
+ web::WebThread::GetBlockingPool()
+ ->GetSequencedTaskRunnerWithShutdownBehavior(
+ base::SequencedWorkerPool::GetSequenceToken(),
+ base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN);
return make_scoped_ptr(new ntp_snippets::NTPSnippetsService(
- GetApplicationContext()->GetApplicationLocale()));
+ task_runner, GetApplicationContext()->GetApplicationLocale(),
+ make_scoped_ptr(new ntp_snippets::NTPSnippetsFetcher(
+ task_runner, (SigninManagerBase*)signin_manager, token_service,
+ request_context, browser_state->GetStatePath()))));
}
« 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