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_CONTENT_WEB_UI_CLIENT_H_ |
| 6 #define CONTENT_BROWSER_WEBUI_CONTENT_WEB_UI_CLIENT_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 namespace content { |
| 16 |
| 17 // Interface for an object which controls which URLs are considered WebUI URLs |
| 18 // and creates WebUI instances for given URLs. |
| 19 class ContentWebUIClient { |
| 20 public: |
| 21 // Returns a WebUI instance for the given URL, or NULL if the URL doesn't |
| 22 // correspond to a WebUI. |
| 23 virtual WebUI* CreateWebUIForURL(TabContents* source, |
| 24 const GURL& url) const = 0; |
| 25 |
| 26 // Gets the WebUI type for the given URL. This will return kNoWebUI if the |
| 27 // corresponding call to CreateWebUIForURL would fail, or something non-NULL |
| 28 // if CreateWebUIForURL would succeed. |
| 29 virtual WebUI::WebUITypeID GetWebUIType(Profile* profile, |
| 30 const GURL& url) const = 0; |
| 31 |
| 32 // Shorthand for the above, but returns a simple yes/no. |
| 33 virtual bool UseWebUIForURL(Profile* profile, const GURL& url) const = 0; |
| 34 |
| 35 // Returns true if the url has a scheme for WebUI. This differs from the above |
| 36 // in that it only checks the scheme; it is faster and can be used to |
| 37 // determine security policy. |
| 38 virtual bool HasWebUIScheme(const GURL& url) const = 0; |
| 39 |
| 40 // Returns true if the given URL can be loaded by Web UI system. This allows |
| 41 // URLs with WebUI types (as above) and also URLs that can be loaded by |
| 42 // normal tabs such as javascript: URLs or about:hang. |
| 43 virtual bool IsURLAcceptableForWebUI(Profile* profile, |
| 44 const GURL& url) const = 0; |
| 45 |
| 46 virtual ~ContentWebUIClient() {} |
| 47 }; |
| 48 |
| 49 } // content |
| 50 |
| 51 #endif // CONTENT_BROWSER_WEBUI_CONTENT_WEB_UI_CLIENT_H_ |
OLD | NEW |