| 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 CHROME_BROWSER_UI_WEBUI_CHROME_WEB_UI_CONTROLLER_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROME_WEB_UI_CONTROLLER_FACTORY_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_CHROME_WEB_UI_CONTROLLER_FACTORY_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_CHROME_WEB_UI_CONTROLLER_FACTORY_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| 11 #include "content/public/browser/web_ui.h" | 11 #include "content/public/browser/web_ui.h" |
| 12 #include "content/public/browser/web_ui_controller_factory.h" | 12 #include "content/public/browser/web_ui_controller_factory.h" |
| 13 #include "chrome/browser/favicon/favicon_service.h" | 13 #include "chrome/browser/favicon/favicon_service.h" |
| 14 | 14 |
| 15 class Profile; | 15 class Profile; |
| 16 class RefCountedMemory; | 16 class RefCountedMemory; |
| 17 | 17 |
| 18 class ChromeWebUIControllerFactory : public content::WebUIControllerFactory { | 18 class ChromeWebUIControllerFactory : public content::WebUIControllerFactory { |
| 19 public: | 19 public: |
| 20 virtual content::WebUI::TypeID GetWebUIType( | 20 virtual content::WebUI::TypeID GetWebUIType( |
| 21 content::BrowserContext* browser_context, | 21 content::BrowserContext* browser_context, |
| 22 const GURL& url) const OVERRIDE; | 22 const GURL& url) const OVERRIDE; |
| 23 virtual bool UseWebUIForURL(content::BrowserContext* browser_context, | 23 virtual bool UseWebUIForURL(content::BrowserContext* browser_context, |
| 24 const GURL& url) const OVERRIDE; | 24 const GURL& url) const OVERRIDE; |
| 25 virtual bool UseWebUIBindingsForURL(content::BrowserContext* browser_context, | 25 virtual bool UseWebUIBindingsForURL(content::BrowserContext* browser_context, |
| 26 const GURL& url) const OVERRIDE; | 26 const GURL& url) const OVERRIDE; |
| 27 virtual bool IsURLAcceptableForWebUI(content::BrowserContext* browser_context, | 27 virtual bool IsURLAcceptableForWebUI(content::BrowserContext* browser_context, |
| 28 const GURL& url) const OVERRIDE; | 28 const GURL& url, |
| 29 bool data_urls_allowed) const OVERRIDE; |
| 29 virtual content::WebUIController* CreateWebUIControllerForURL( | 30 virtual content::WebUIController* CreateWebUIControllerForURL( |
| 30 content::WebUI* web_ui, | 31 content::WebUI* web_ui, |
| 31 const GURL& url) const OVERRIDE; | 32 const GURL& url) const OVERRIDE; |
| 32 | 33 |
| 33 // Get the favicon for |page_url| and forward the result to the |request| | 34 // Get the favicon for |page_url| and forward the result to the |request| |
| 34 // when loaded. | 35 // when loaded. |
| 35 void GetFaviconForURL(Profile* profile, | 36 void GetFaviconForURL(Profile* profile, |
| 36 FaviconService::GetFaviconRequest* request, | 37 FaviconService::GetFaviconRequest* request, |
| 37 const GURL& page_url) const; | 38 const GURL& page_url) const; |
| 38 | 39 |
| 39 static ChromeWebUIControllerFactory* GetInstance(); | 40 static ChromeWebUIControllerFactory* GetInstance(); |
| 40 | 41 |
| 41 protected: | 42 protected: |
| 42 ChromeWebUIControllerFactory(); | 43 ChromeWebUIControllerFactory(); |
| 43 virtual ~ChromeWebUIControllerFactory(); | 44 virtual ~ChromeWebUIControllerFactory(); |
| 44 | 45 |
| 45 private: | 46 private: |
| 46 | 47 |
| 47 friend struct DefaultSingletonTraits<ChromeWebUIControllerFactory>; | 48 friend struct DefaultSingletonTraits<ChromeWebUIControllerFactory>; |
| 48 | 49 |
| 49 // Gets the data for the favicon for a WebUI page. Returns NULL if the WebUI | 50 // Gets the data for the favicon for a WebUI page. Returns NULL if the WebUI |
| 50 // does not have a favicon. | 51 // does not have a favicon. |
| 51 RefCountedMemory* GetFaviconResourceBytes(const GURL& page_url) const; | 52 RefCountedMemory* GetFaviconResourceBytes(const GURL& page_url) const; |
| 52 | 53 |
| 53 DISALLOW_COPY_AND_ASSIGN(ChromeWebUIControllerFactory); | 54 DISALLOW_COPY_AND_ASSIGN(ChromeWebUIControllerFactory); |
| 54 }; | 55 }; |
| 55 | 56 |
| 56 #endif // CHROME_BROWSER_UI_WEBUI_CHROME_WEB_UI_CONTROLLER_FACTORY_H_ | 57 #endif // CHROME_BROWSER_UI_WEBUI_CHROME_WEB_UI_CONTROLLER_FACTORY_H_ |
| OLD | NEW |