Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/ui/search/new_tab_page_interceptor_service.h" | |
| 6 | |
| 7 #include "chrome/browser/profiles/profile.h" | |
| 8 #include "chrome/browser/search/search.h" | |
| 9 #include "chrome/browser/ui/search/new_tab_page_interceptor.h" | |
| 10 #include "content/public/browser/browser_thread.h" | |
| 11 | |
| 12 NewTabPageInterceptorService::NewTabPageInterceptorService(Profile* profile) | |
| 13 : profile_(profile) { | |
| 14 DCHECK(profile_); | |
| 15 } | |
| 16 | |
| 17 NewTabPageInterceptorService::~NewTabPageInterceptorService() { | |
| 18 } | |
| 19 | |
| 20 void NewTabPageInterceptorService::UpdateDefaultSearchProvider( | |
| 21 const GURL& new_tab_page_url) { | |
| 22 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | |
| 23 content::BrowserThread::PostTask( | |
| 24 content::BrowserThread::IO, FROM_HERE, | |
|
mmenke
2015/01/15 22:35:30
Should include base/location.h for FROM_HERE. Bel
Mathieu
2015/01/22 19:21:59
Done.
| |
| 25 base::Bind(&NewTabPageInterceptor::SetNewTabPageURL, interceptor_, | |
| 26 new_tab_page_url)); | |
| 27 } | |
| 28 | |
| 29 scoped_ptr<net::URLRequestInterceptor> | |
| 30 NewTabPageInterceptorService::CreateInterceptor() { | |
| 31 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | |
| 32 scoped_ptr<NewTabPageInterceptor> interceptor( | |
| 33 new NewTabPageInterceptor(chrome::GetNewTabPageURL(profile_))); | |
| 34 interceptor_ = interceptor->GetWeakPtr(); | |
| 35 return interceptor.Pass(); | |
| 36 } | |
| OLD | NEW |