Skip to content

Commit

Permalink
Replace the NTP Interceptor with Throttle
Browse files Browse the repository at this point in the history
This change replaces the NewTabPageInterceptorService with a
NewTabPageNavigationThrottle.  The throttle reduces complexity, but it
is also neutral regarding the network stack / network service, so it
fixes the NewTabPageInterceptorServiceTests that were broken with the
NetworkService feature enabled.  These tests are now renamed
NewTabPageNavigationThrottleTest.

BUG=802926

Cq-Include-Trybots: master.tryserver.chromium.linux:linux_mojo
Change-Id: Iec0664df33e79d6bcc18f60aecc4017de7f65858
Reviewed-on: https://chromium-review.googlesource.com/868994
Commit-Queue: Conley Owens <cco3@chromium.org>
Reviewed-by: Marc Treib <treib@chromium.org>
Reviewed-by: Matt Menke <mmenke@chromium.org>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#530370}
  • Loading branch information
cco3 authored and Commit Bot committed Jan 19, 2018
1 parent bc084a8 commit 2ba21bc
Show file tree
Hide file tree
Showing 13 changed files with 218 additions and 400 deletions.
6 changes: 6 additions & 0 deletions chrome/browser/chrome_content_browser_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@
#include "chrome/browser/payments/payment_request_factory.h"
#include "chrome/browser/search/instant_service.h"
#include "chrome/browser/search/instant_service_factory.h"
#include "chrome/browser/ui/search/new_tab_page_navigation_throttle.h"
#include "chrome/common/importer/profile_import.mojom.h"
#endif

Expand Down Expand Up @@ -3503,6 +3504,11 @@ ChromeContentBrowserClient::CreateThrottlesForNavigation(
DevToolsWindow::MaybeCreateNavigationThrottle(handle);
if (devtools_throttle)
throttles.push_back(std::move(devtools_throttle));

std::unique_ptr<content::NavigationThrottle> new_tab_page_throttle =
NewTabPageNavigationThrottle::MaybeCreateThrottleFor(handle);
if (new_tab_page_throttle)
throttles.push_back(std::move(new_tab_page_throttle));
#endif

return throttles;
Expand Down
12 changes: 0 additions & 12 deletions chrome/browser/profiles/profile_io_data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,6 @@

#if defined(OS_ANDROID)
#include "content/public/browser/android/content_protocol_handler.h"
#else
#include "chrome/browser/ui/search/new_tab_page_interceptor_service.h"
#include "chrome/browser/ui/search/new_tab_page_interceptor_service_factory.h"
#endif // defined(OS_ANDROID)

#if defined(OS_CHROMEOS)
Expand Down Expand Up @@ -453,15 +450,6 @@ void ProfileIOData::InitializeOnUIThread(Profile* profile) {
params->protocol_handler_interceptor =
protocol_handler_registry->CreateJobInterceptorFactory();

#if !defined(OS_ANDROID)
NewTabPageInterceptorService* new_tab_interceptor_service =
NewTabPageInterceptorServiceFactory::GetForProfile(profile);
if (new_tab_interceptor_service) {
params->new_tab_page_interceptor =
new_tab_interceptor_service->CreateInterceptor();
}
#endif

#if defined(OS_CHROMEOS)
// Enable client certificates for the Chrome OS sign-in frame, if this feature
// is not disabled by a flag.
Expand Down
6 changes: 2 additions & 4 deletions chrome/browser/ui/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -855,10 +855,8 @@ split_static_library("ui") {
"scoped_tabbed_browser_displayer.h",
"search/instant_controller.cc",
"search/instant_controller.h",
"search/new_tab_page_interceptor_service.cc",
"search/new_tab_page_interceptor_service.h",
"search/new_tab_page_interceptor_service_factory.cc",
"search/new_tab_page_interceptor_service_factory.h",
"search/new_tab_page_navigation_throttle.cc",
"search/new_tab_page_navigation_throttle.h",
"search/ntp_user_data_logger.cc",
"search/ntp_user_data_logger.h",
"search/search_ipc_router.cc",
Expand Down
111 changes: 0 additions & 111 deletions chrome/browser/ui/search/new_tab_page_interceptor_browsertest.cc

This file was deleted.

130 changes: 0 additions & 130 deletions chrome/browser/ui/search/new_tab_page_interceptor_service.cc

This file was deleted.

46 changes: 0 additions & 46 deletions chrome/browser/ui/search/new_tab_page_interceptor_service.h

This file was deleted.

This file was deleted.

Loading

0 comments on commit 2ba21bc

Please sign in to comment.