Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: content/browser/frame_host/navigation_handle_factory.h

Issue 1269813002: Add a NavigationThrottle to the public content/ interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@navigation-api
Patch Set: Addressed comments Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 #ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_FACTORY_H_
6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_FACTORY_H_
7
8 #include "base/memory/scoped_ptr.h"
9 #include "url/gurl.h"
10
11 namespace content {
12
13 class NavigationHandleImpl;
14 class NavigatorDelegate;
15
16 // This class is used to create NavigationHandles through a static method.
17 // Normally it creates regular NavigationHandleImpls. However, a global
18 // instance of this interface can be registered through SetFactoryForTesting.
19 // In that case, NavigationHandleFactory::Create will use the CreateHandle
20 // method of the registered interface to create NavigationHandles. This is used
21 // in tests to create TestNavigationHandles instead of plain
nasko 2015/09/14 22:00:04 nit: Which type of tests? unit, browser, or both?
clamy 2015/09/16 01:03:21 Done.
22 // NavigationHandleImpls.
23 class NavigationHandleFactory {
24 public:
25 // Returs a NavigationHandle. This is a plain NavigationHandleImpl, unless a
26 // factory has been registered for testing.
27 static scoped_ptr<NavigationHandleImpl> Create(const GURL& url,
28 const GURL& validated_url,
29 bool is_main_frame,
30 NavigatorDelegate* delegate);
31
32 // Registers a factory during tests. NavigationHandleFactory::Create will
33 // then return the result of factory->CreateHandle, if |factory| is not null.
34 // Otherwise it will continue returning plain NavigationHandleImpls.
35 static void SetFactoryForTesting(NavigationHandleFactory* factory);
36
37 virtual ~NavigationHandleFactory();
38
39 // When a factory is registered, this method will be used to create
40 // NavigationHandles.
41 virtual scoped_ptr<NavigationHandleImpl> CreateHandle(
42 const GURL& url,
43 const GURL& validated_url,
44 bool is_main_frame,
45 NavigatorDelegate* delegate) = 0;
46 };
47
48 } // namespace content
49
50 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698