| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROME_WEB_UI_FACTORY_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_CHROME_WEB_UI_FACTORY_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_CHROME_WEB_UI_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/browser/webui/web_ui.h" | 11 #include "content/browser/webui/web_ui.h" |
| 12 #include "content/browser/webui/web_ui_factory.h" | 12 #include "content/browser/webui/web_ui_factory.h" |
| 13 #include "chrome/browser/favicon/favicon_service.h" | 13 #include "chrome/browser/favicon/favicon_service.h" |
| 14 | 14 |
| 15 class WebUI; | 15 class WebUI; |
| 16 class GURL; | 16 class GURL; |
| 17 class Profile; | 17 class Profile; |
| 18 class RefCountedMemory; | 18 class RefCountedMemory; |
| 19 class TabContents; | 19 class TabContents; |
| 20 | 20 |
| 21 class ChromeWebUIFactory : public content::WebUIFactory { | 21 class ChromeWebUIFactory : public content::WebUIFactory { |
| 22 public: | 22 public: |
| 23 virtual WebUI::TypeID GetWebUIType(Profile* profile, const GURL& url) const; | 23 virtual WebUI::TypeID GetWebUIType(content::BrowserContext* browser_context, |
| 24 virtual bool UseWebUIForURL(Profile* profile, const GURL& url) const; | 24 const GURL& url) const OVERRIDE; |
| 25 virtual bool HasWebUIScheme(const GURL& url) const; | 25 virtual bool UseWebUIForURL(content::BrowserContext* browser_context, |
| 26 virtual bool IsURLAcceptableForWebUI(Profile* profile, const GURL& url) const; | 26 const GURL& url) const OVERRIDE; |
| 27 virtual bool HasWebUIScheme(const GURL& url) const OVERRIDE; |
| 28 virtual bool IsURLAcceptableForWebUI(content::BrowserContext* browser_context, |
| 29 const GURL& url) const OVERRIDE; |
| 27 virtual WebUI* CreateWebUIForURL(TabContents* tab_contents, | 30 virtual WebUI* CreateWebUIForURL(TabContents* tab_contents, |
| 28 const GURL& url) const; | 31 const GURL& url) const OVERRIDE; |
| 29 | 32 |
| 30 // Get the favicon for |page_url| and forward the result to the |request| | 33 // Get the favicon for |page_url| and forward the result to the |request| |
| 31 // when loaded. | 34 // when loaded. |
| 32 void GetFaviconForURL(Profile* profile, | 35 void GetFaviconForURL(Profile* profile, |
| 33 FaviconService::GetFaviconRequest* request, | 36 FaviconService::GetFaviconRequest* request, |
| 34 const GURL& page_url) const; | 37 const GURL& page_url) const; |
| 35 | 38 |
| 36 static ChromeWebUIFactory* GetInstance(); | 39 static ChromeWebUIFactory* GetInstance(); |
| 37 | 40 |
| 38 protected: | 41 protected: |
| 39 ChromeWebUIFactory(); | 42 ChromeWebUIFactory(); |
| 40 virtual ~ChromeWebUIFactory(); | 43 virtual ~ChromeWebUIFactory(); |
| 41 | 44 |
| 42 private: | 45 private: |
| 43 | 46 |
| 44 friend struct DefaultSingletonTraits<ChromeWebUIFactory>; | 47 friend struct DefaultSingletonTraits<ChromeWebUIFactory>; |
| 45 | 48 |
| 46 // Gets the data for the favicon for a WebUI page. Returns NULL if the WebUI | 49 // Gets the data for the favicon for a WebUI page. Returns NULL if the WebUI |
| 47 // does not have a favicon. | 50 // does not have a favicon. |
| 48 RefCountedMemory* GetFaviconResourceBytes(const GURL& page_url) const; | 51 RefCountedMemory* GetFaviconResourceBytes(const GURL& page_url) const; |
| 49 | 52 |
| 50 DISALLOW_COPY_AND_ASSIGN(ChromeWebUIFactory); | 53 DISALLOW_COPY_AND_ASSIGN(ChromeWebUIFactory); |
| 51 }; | 54 }; |
| 52 | 55 |
| 53 #endif // CHROME_BROWSER_UI_WEBUI_CHROME_WEB_UI_FACTORY_H_ | 56 #endif // CHROME_BROWSER_UI_WEBUI_CHROME_WEB_UI_FACTORY_H_ |
| OLD | NEW |