OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_CONTROLLER_FACTORY_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_WEB_UI_CONTROLLER_FACTORY_H_ |
6 #define CONTENT_PUBLIC_BROWSER_WEB_UI_CONTROLLER_FACTORY_H_ | 6 #define CONTENT_PUBLIC_BROWSER_WEB_UI_CONTROLLER_FACTORY_H_ |
7 | 7 |
8 #include "content/common/content_export.h" | 8 #include "content/common/content_export.h" |
9 #include "content/public/browser/web_ui.h" | 9 #include "content/public/browser/web_ui.h" |
10 | 10 |
11 class GURL; | 11 class GURL; |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 | 14 |
15 class BrowserContext; | 15 class BrowserContext; |
16 class WebContents; | 16 class WebContents; |
17 class WebUIController; | 17 class WebUIController; |
18 | 18 |
19 // Interface for an object which controls which URLs are considered WebUI URLs | 19 // Interface for an object which controls which URLs are considered WebUI URLs |
20 // and creates WebUIController instances for given URLs. | 20 // and creates WebUIController instances for given URLs. |
21 class CONTENT_EXPORT WebUIControllerFactory { | 21 class CONTENT_EXPORT WebUIControllerFactory { |
22 public: | 22 public: |
23 virtual ~WebUIControllerFactory() {} | 23 virtual ~WebUIControllerFactory() {} |
24 | 24 |
| 25 // Call to register a factory. |
| 26 static void RegisterFactory(WebUIControllerFactory* factory); |
| 27 |
25 // Returns a WebUIController instance for the given URL, or NULL if the URL | 28 // Returns a WebUIController instance for the given URL, or NULL if the URL |
26 // doesn't correspond to a WebUI. | 29 // doesn't correspond to a WebUI. |
27 virtual WebUIController* CreateWebUIControllerForURL( | 30 virtual WebUIController* CreateWebUIControllerForURL( |
28 WebUI* web_ui, const GURL& url) const = 0; | 31 WebUI* web_ui, const GURL& url) const = 0; |
29 | 32 |
30 // Gets the WebUI type for the given URL. This will return kNoWebUI if the | 33 // Gets the WebUI type for the given URL. This will return kNoWebUI if the |
31 // corresponding call to CreateWebUIForURL would fail, or something non-NULL | 34 // corresponding call to CreateWebUIForURL would fail, or something non-NULL |
32 // if CreateWebUIForURL would succeed. | 35 // if CreateWebUIForURL would succeed. |
33 virtual WebUI::TypeID GetWebUIType(BrowserContext* browser_context, | 36 virtual WebUI::TypeID GetWebUIType(BrowserContext* browser_context, |
34 const GURL& url) const = 0; | 37 const GURL& url) const = 0; |
(...skipping 12 matching lines...) Expand all Loading... |
47 // URLs with WebUI types (as above) and also URLs that can be loaded by | 50 // URLs with WebUI types (as above) and also URLs that can be loaded by |
48 // normal tabs such as javascript: URLs or about:hang. | 51 // normal tabs such as javascript: URLs or about:hang. |
49 virtual bool IsURLAcceptableForWebUI(BrowserContext* browser_context, | 52 virtual bool IsURLAcceptableForWebUI(BrowserContext* browser_context, |
50 const GURL& url, | 53 const GURL& url, |
51 bool data_urls_allowed) const = 0; | 54 bool data_urls_allowed) const = 0; |
52 }; | 55 }; |
53 | 56 |
54 } // namespace content | 57 } // namespace content |
55 | 58 |
56 #endif // CONTENT_PUBLIC_BROWSER_WEB_UI_CONTROLLER_FACTORY_H_ | 59 #endif // CONTENT_PUBLIC_BROWSER_WEB_UI_CONTROLLER_FACTORY_H_ |
OLD | NEW |