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/public/browser/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(content::BrowserContext* browser_context, | 23 virtual WebUI::TypeID GetWebUIType(content::BrowserContext* browser_context, |
24 const GURL& url) const OVERRIDE; | 24 const GURL& url) const OVERRIDE; |
25 virtual bool UseWebUIForURL(content::BrowserContext* browser_context, | 25 virtual bool UseWebUIForURL(content::BrowserContext* browser_context, |
26 const GURL& url) const OVERRIDE; | 26 const GURL& url) const OVERRIDE; |
27 virtual bool UseWebUIBindingsForURL(content::BrowserContext* browser_context, | 27 virtual bool UseWebUIBindingsForURL(content::BrowserContext* browser_context, |
28 const GURL& url) const OVERRIDE; | 28 const GURL& url) const OVERRIDE; |
29 virtual bool HasWebUIScheme(const GURL& url) const OVERRIDE; | 29 virtual bool HasWebUIScheme(const GURL& url) const OVERRIDE; |
30 virtual bool IsURLAcceptableForWebUI(content::BrowserContext* browser_context, | 30 virtual bool IsURLAcceptableForWebUI(content::BrowserContext* browser_context, |
31 const GURL& url) const OVERRIDE; | 31 const GURL& url) const OVERRIDE; |
32 virtual WebUI* CreateWebUIForURL(TabContents* tab_contents, | 32 virtual WebUI* CreateWebUIForURL(content::WebContents* tab_contents, |
33 const GURL& url) const OVERRIDE; | 33 const GURL& url) const OVERRIDE; |
34 | 34 |
35 // Get the favicon for |page_url| and forward the result to the |request| | 35 // Get the favicon for |page_url| and forward the result to the |request| |
36 // when loaded. | 36 // when loaded. |
37 void GetFaviconForURL(Profile* profile, | 37 void GetFaviconForURL(Profile* profile, |
38 FaviconService::GetFaviconRequest* request, | 38 FaviconService::GetFaviconRequest* request, |
39 const GURL& page_url) const; | 39 const GURL& page_url) const; |
40 | 40 |
41 static ChromeWebUIFactory* GetInstance(); | 41 static ChromeWebUIFactory* GetInstance(); |
42 | 42 |
43 protected: | 43 protected: |
44 ChromeWebUIFactory(); | 44 ChromeWebUIFactory(); |
45 virtual ~ChromeWebUIFactory(); | 45 virtual ~ChromeWebUIFactory(); |
46 | 46 |
47 private: | 47 private: |
48 | 48 |
49 friend struct DefaultSingletonTraits<ChromeWebUIFactory>; | 49 friend struct DefaultSingletonTraits<ChromeWebUIFactory>; |
50 | 50 |
51 // Gets the data for the favicon for a WebUI page. Returns NULL if the WebUI | 51 // Gets the data for the favicon for a WebUI page. Returns NULL if the WebUI |
52 // does not have a favicon. | 52 // does not have a favicon. |
53 RefCountedMemory* GetFaviconResourceBytes(const GURL& page_url) const; | 53 RefCountedMemory* GetFaviconResourceBytes(const GURL& page_url) const; |
54 | 54 |
55 DISALLOW_COPY_AND_ASSIGN(ChromeWebUIFactory); | 55 DISALLOW_COPY_AND_ASSIGN(ChromeWebUIFactory); |
56 }; | 56 }; |
57 | 57 |
58 #endif // CHROME_BROWSER_UI_WEBUI_CHROME_WEB_UI_FACTORY_H_ | 58 #endif // CHROME_BROWSER_UI_WEBUI_CHROME_WEB_UI_FACTORY_H_ |
OLD | NEW |