| Index: content/browser/frame_host/navigation_handle_factory.h
|
| diff --git a/content/browser/frame_host/navigation_handle_factory.h b/content/browser/frame_host/navigation_handle_factory.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..5e89baa958c0ce2d89ac6c15588a2b7bf0c71b53
|
| --- /dev/null
|
| +++ b/content/browser/frame_host/navigation_handle_factory.h
|
| @@ -0,0 +1,48 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_FACTORY_H_
|
| +#define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_FACTORY_H_
|
| +
|
| +#include "base/memory/scoped_ptr.h"
|
| +#include "url/gurl.h"
|
| +
|
| +namespace content {
|
| +
|
| +class NavigationHandleImpl;
|
| +class NavigatorDelegate;
|
| +
|
| +// This class is used to create NavigationHandles through a static method.
|
| +// Normally it creates regular NavigationHandleImpls. However, a global
|
| +// instance of this interface can be registered through SetFactoryForTesting.
|
| +// In that case, NavigationHandleFactory::Create will use the CreateHandle
|
| +// method of the registered interface to create NavigationHandles. This is used
|
| +// in unit tests to create TestNavigationHandles instead of plain
|
| +// NavigationHandleImpls.
|
| +class NavigationHandleFactory {
|
| + public:
|
| + // Returs a NavigationHandle. This is a plain NavigationHandleImpl, unless a
|
| + // factory has been registered for testing.
|
| + static scoped_ptr<NavigationHandleImpl> Create(const GURL& url,
|
| + bool is_main_frame,
|
| + NavigatorDelegate* delegate);
|
| +
|
| + // Registers a factory during tests. NavigationHandleFactory::Create will
|
| + // then return the result of factory->CreateHandle, if |factory| is not null.
|
| + // Otherwise it will continue returning plain NavigationHandleImpls.
|
| + static void SetFactoryForTesting(NavigationHandleFactory* factory);
|
| +
|
| + virtual ~NavigationHandleFactory();
|
| +
|
| + // When a factory is registered, this method will be used to create
|
| + // NavigationHandles.
|
| + virtual scoped_ptr<NavigationHandleImpl> CreateHandle(
|
| + const GURL& url,
|
| + bool is_main_frame,
|
| + NavigatorDelegate* delegate) = 0;
|
| +};
|
| +
|
| +} // namespace content
|
| +
|
| +#endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_FACTORY_H_
|
|
|