OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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/ui/search/new_tab_page_interceptor_service.h" | 5 #include "chrome/browser/ui/search/new_tab_page_interceptor_service.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 NewTabPageInterceptorService::~NewTabPageInterceptorService() { | 109 NewTabPageInterceptorService::~NewTabPageInterceptorService() { |
110 if (template_url_service_) | 110 if (template_url_service_) |
111 template_url_service_->RemoveObserver(this); | 111 template_url_service_->RemoveObserver(this); |
112 } | 112 } |
113 | 113 |
114 void NewTabPageInterceptorService::OnTemplateURLServiceChanged() { | 114 void NewTabPageInterceptorService::OnTemplateURLServiceChanged() { |
115 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 115 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
116 GURL new_tab_page_url(search::GetNewTabPageURL(profile_)); | 116 GURL new_tab_page_url(search::GetNewTabPageURL(profile_)); |
117 content::BrowserThread::PostTask( | 117 content::BrowserThread::PostTask( |
118 content::BrowserThread::IO, FROM_HERE, | 118 content::BrowserThread::IO, FROM_HERE, |
119 base::Bind(&NewTabPageInterceptor::SetNewTabPageURL, interceptor_, | 119 base::BindOnce(&NewTabPageInterceptor::SetNewTabPageURL, interceptor_, |
120 new_tab_page_url)); | 120 new_tab_page_url)); |
121 } | 121 } |
122 | 122 |
123 std::unique_ptr<net::URLRequestInterceptor> | 123 std::unique_ptr<net::URLRequestInterceptor> |
124 NewTabPageInterceptorService::CreateInterceptor() { | 124 NewTabPageInterceptorService::CreateInterceptor() { |
125 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 125 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
126 std::unique_ptr<NewTabPageInterceptor> interceptor( | 126 std::unique_ptr<NewTabPageInterceptor> interceptor( |
127 new NewTabPageInterceptor(search::GetNewTabPageURL(profile_))); | 127 new NewTabPageInterceptor(search::GetNewTabPageURL(profile_))); |
128 interceptor_ = interceptor->GetWeakPtr(); | 128 interceptor_ = interceptor->GetWeakPtr(); |
129 return std::move(interceptor); | 129 return std::move(interceptor); |
130 } | 130 } |
OLD | NEW |