OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 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_PUBLIC_BROWSER_WEB_UI_FACTORY_H_ | |
6 #define CONTENT_PUBLIC_BROWSER_WEB_UI_FACTORY_H_ | |
7 #pragma once | |
8 | |
9 #include "content/common/content_export.h" | |
10 #include "content/public/browser/web_ui.h" | |
11 | |
12 class GURL; | |
13 | |
14 namespace content { | |
15 | |
16 class BrowserContext; | |
17 class WebContents; | |
18 class WebUIController; | |
19 | |
20 // Interface for an object which controls which URLs are considered WebUI URLs | |
21 // and creates WebUI instances for given URLs. | |
22 class CONTENT_EXPORT WebUIFactory { | |
23 public: | |
24 // Returns a WebUI instance for the given URL, or NULL if the URL doesn't | |
25 // correspond to a WebUI. | |
26 virtual WebUIController* CreateWebUIForURL(WebUI* web_ui, | |
27 const GURL& url) const = 0; | |
28 | |
29 // Gets the WebUI type for the given URL. This will return kNoWebUI if the | |
30 // corresponding call to CreateWebUIForURL would fail, or something non-NULL | |
31 // if CreateWebUIForURL would succeed. | |
32 virtual WebUI::TypeID GetWebUIType(BrowserContext* browser_context, | |
33 const GURL& url) const = 0; | |
34 | |
35 // Shorthand for the above, but returns a simple yes/no. | |
36 virtual bool UseWebUIForURL(BrowserContext* browser_context, | |
37 const GURL& url) const = 0; | |
38 | |
39 // Returns true for the subset of WebUIs that actually need WebUI bindings. | |
40 virtual bool UseWebUIBindingsForURL(BrowserContext* browser_context, | |
41 const GURL& url) const = 0; | |
42 | |
43 // Returns true if the url has a scheme for WebUI. This differs from the above | |
44 // in that it only checks the scheme; it is faster and can be used to | |
45 // determine security policy. | |
46 virtual bool HasWebUIScheme(const GURL& url) const = 0; | |
47 | |
48 // Returns true if the given URL can be loaded by Web UI system. This allows | |
49 // URLs with WebUI types (as above) and also URLs that can be loaded by | |
50 // normal tabs such as javascript: URLs or about:hang. | |
51 virtual bool IsURLAcceptableForWebUI(BrowserContext* browser_context, | |
52 const GURL& url) const = 0; | |
53 | |
54 virtual ~WebUIFactory() {} | |
55 }; | |
56 | |
57 } // namespace content | |
58 | |
59 #endif // CONTENT_PUBLIC_BROWSER_WEB_UI_FACTORY_H_ | |
OLD | NEW |