| 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. | 25   // Call to register a factory. | 
| 26   static void RegisterFactory(WebUIControllerFactory* factory); | 26   static void RegisterFactory(WebUIControllerFactory* factory); | 
| 27 | 27 | 
|  | 28   static void UnregisterFactoryForTesting(WebUIControllerFactory* factory); | 
|  | 29 | 
| 28   // Returns a WebUIController instance for the given URL, or NULL if the URL | 30   // Returns a WebUIController instance for the given URL, or NULL if the URL | 
| 29   // doesn't correspond to a WebUI. | 31   // doesn't correspond to a WebUI. | 
| 30   virtual WebUIController* CreateWebUIControllerForURL( | 32   virtual WebUIController* CreateWebUIControllerForURL( | 
| 31       WebUI* web_ui, const GURL& url) const = 0; | 33       WebUI* web_ui, const GURL& url) const = 0; | 
| 32 | 34 | 
| 33   // Gets the WebUI type for the given URL. This will return kNoWebUI if the | 35   // Gets the WebUI type for the given URL. This will return kNoWebUI if the | 
| 34   // corresponding call to CreateWebUIForURL would fail, or something non-NULL | 36   // corresponding call to CreateWebUIForURL would fail, or something non-NULL | 
| 35   // if CreateWebUIForURL would succeed. | 37   // if CreateWebUIForURL would succeed. | 
| 36   virtual WebUI::TypeID GetWebUIType(BrowserContext* browser_context, | 38   virtual WebUI::TypeID GetWebUIType(BrowserContext* browser_context, | 
| 37                                      const GURL& url) const = 0; | 39                                      const GURL& url) const = 0; | 
| 38 | 40 | 
| 39   // Shorthand for the above, but returns a simple yes/no. | 41   // Shorthand for the above, but returns a simple yes/no. | 
| 40   // See also ContentClient::HasWebUIScheme, which only checks the scheme | 42   // See also ContentClient::HasWebUIScheme, which only checks the scheme | 
| 41   // (faster) and can be used to determine security policy. | 43   // (faster) and can be used to determine security policy. | 
| 42   virtual bool UseWebUIForURL(BrowserContext* browser_context, | 44   virtual bool UseWebUIForURL(BrowserContext* browser_context, | 
| 43                               const GURL& url) const = 0; | 45                               const GURL& url) const = 0; | 
| 44 | 46 | 
| 45   // Returns true for the subset of WebUIs that actually need WebUI bindings. | 47   // Returns true for the subset of WebUIs that actually need WebUI bindings. | 
| 46   virtual bool UseWebUIBindingsForURL(BrowserContext* browser_context, | 48   virtual bool UseWebUIBindingsForURL(BrowserContext* browser_context, | 
| 47                                       const GURL& url) const = 0; | 49                                       const GURL& url) const = 0; | 
| 48 }; | 50 }; | 
| 49 | 51 | 
| 50 }  // namespace content | 52 }  // namespace content | 
| 51 | 53 | 
| 52 #endif  // CONTENT_PUBLIC_BROWSER_WEB_UI_CONTROLLER_FACTORY_H_ | 54 #endif  // CONTENT_PUBLIC_BROWSER_WEB_UI_CONTROLLER_FACTORY_H_ | 
| OLD | NEW | 
|---|