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_BROWSER_WEBUI_WEB_UI_SOURCE_H_ | |
6 #define CONTENT_BROWSER_WEBUI_WEB_UI_SOURCE_H_ | |
7 #pragma once | |
8 | |
9 #include "content/browser/webui/web_ui.h" | |
10 | |
11 class Profile; | |
12 class TabContents; | |
13 class GURL; | |
14 | |
15 // Interface for an object which controls which URLs are considered WebUI URLs | |
16 // and creates WebUI instances for given URLs. | |
17 class WebUISource { | |
stuartmorgan
2011/03/24 21:09:41
Source vs Factory seems a bit arbitrary; I'd have
Evan Stade
2011/03/24 21:28:40
sounds fine to me
| |
18 public: | |
19 // Returns a WebUI instance for the given URL, or NULL if the URL doesn't | |
20 // correspond to a WebUI. | |
21 virtual WebUI* CreateWebUIForURL(TabContents* source, | |
22 const GURL& url) const = 0; | |
23 | |
24 // Gets the WebUI type for the given URL. This will return kNoWebUI if the | |
25 // corresponding call to CreateWebUIForURL would fail, or something non-NULL | |
26 // if CreateWebUIForURL would succeed. | |
27 virtual WebUI::WebUITypeID GetWebUIType(Profile* profile, | |
jam
2011/03/24 21:38:43
Profile is a Chrome concept that Elliot is moving
| |
28 const GURL& url) const = 0; | |
29 | |
30 // Shorthand for the above, but returns a simple yes/no. | |
31 virtual bool UseWebUIForURL(Profile* profile, const GURL& url) const = 0; | |
32 | |
33 // Returns true if the url has a scheme for WebUI. This differs from the above | |
34 // in that it only checks the scheme; it is faster and can be used to | |
35 // determine security policy. | |
36 virtual bool HasWebUIScheme(const GURL& url) const = 0; | |
37 | |
38 // Returns true if the given URL can be loaded by Web UI system. This allows | |
39 // URLs with WebUI types (as above) and also URLs that can be loaded by | |
40 // normal tabs such as javascript: URLs or about:hang. | |
41 virtual bool IsURLAcceptableForWebUI(Profile* profile, | |
42 const GURL& url) const = 0; | |
43 | |
44 virtual ~WebUISource() {} | |
45 }; | |
46 | |
47 #endif // CONTENT_BROWSER_WEBUI_WEB_UI_SOURCE_H_ | |
OLD | NEW |