1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
content / public / test / test_navigation_throttle_inserter.cc [blame]
// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/public/test/test_navigation_throttle_inserter.h"
#include <utility>
#include "content/public/browser/navigation_handle.h"
namespace content {
TestNavigationThrottleInserter::TestNavigationThrottleInserter(
WebContents* web_contents,
ThrottleInsertionCallback callback)
: WebContentsObserver(web_contents), callback_(std::move(callback)) {}
TestNavigationThrottleInserter::~TestNavigationThrottleInserter() = default;
void TestNavigationThrottleInserter::DidStartNavigation(
NavigationHandle* navigation_handle) {
if (std::unique_ptr<NavigationThrottle> throttle =
callback_.Run(navigation_handle)) {
navigation_handle->RegisterThrottleForTesting(std::move(throttle));
}
}
} // namespace content