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