OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_DOM_UI_DOM_UI_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_DOM_UI_DOM_UI_FACTORY_H_ |
6 #define CHROME_BROWSER_DOM_UI_DOM_UI_FACTORY_H_ | 6 #define CHROME_BROWSER_DOM_UI_DOM_UI_FACTORY_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/favicon_service.h" | 9 #include "chrome/browser/favicon_service.h" |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 // given URL. This is useful for comparing the potential DOMUIs for two URLs. | 28 // given URL. This is useful for comparing the potential DOMUIs for two URLs. |
29 // Returns kNoDOMUI if the given URL will not use the DOM UI system. | 29 // Returns kNoDOMUI if the given URL will not use the DOM UI system. |
30 static DOMUITypeID GetDOMUIType(Profile* profile, const GURL& url); | 30 static DOMUITypeID GetDOMUIType(Profile* profile, const GURL& url); |
31 | 31 |
32 // Returns true if the given URL's scheme would trigger the DOM UI system. | 32 // Returns true if the given URL's scheme would trigger the DOM UI system. |
33 // This is a less precise test than UseDONUIForURL, which tells you whether | 33 // This is a less precise test than UseDONUIForURL, which tells you whether |
34 // that specific URL matches a known one. This one is faster and can be used | 34 // that specific URL matches a known one. This one is faster and can be used |
35 // to determine security policy. | 35 // to determine security policy. |
36 static bool HasDOMUIScheme(const GURL& url); | 36 static bool HasDOMUIScheme(const GURL& url); |
37 | 37 |
38 // Returns true if the given URL will use the DOM UI system. | 38 // Returns true if the given URL must use the DOM UI system. |
39 static bool UseDOMUIForURL(Profile* profile, const GURL& url); | 39 static bool UseDOMUIForURL(Profile* profile, const GURL& url); |
40 | 40 |
| 41 // Returns true if the given URL can be loaded by DOM UI system. This |
| 42 // includes URLs that can be loaded by normal tabs as well, such as |
| 43 // javascript: URLs or about:hang. |
| 44 static bool IsURLAcceptableForDOMUI(Profile* profile, const GURL& url); |
| 45 |
41 // Allocates a new DOMUI object for the given URL, and returns it. If the URL | 46 // Allocates a new DOMUI object for the given URL, and returns it. If the URL |
42 // is not a DOM UI URL, then it will return NULL. When non-NULL, ownership of | 47 // is not a DOM UI URL, then it will return NULL. When non-NULL, ownership of |
43 // the returned pointer is passed to the caller. | 48 // the returned pointer is passed to the caller. |
44 static DOMUI* CreateDOMUIForURL(TabContents* tab_contents, const GURL& url); | 49 static DOMUI* CreateDOMUIForURL(TabContents* tab_contents, const GURL& url); |
45 | 50 |
46 // Get the favicon for |page_url| and forward the result to the |request| | 51 // Get the favicon for |page_url| and forward the result to the |request| |
47 // when loaded. | 52 // when loaded. |
48 static void GetFaviconForURL(Profile* profile, | 53 static void GetFaviconForURL(Profile* profile, |
49 FaviconService::GetFaviconRequest* request, | 54 FaviconService::GetFaviconRequest* request, |
50 const GURL& page_url); | 55 const GURL& page_url); |
51 | 56 |
52 private: | 57 private: |
53 // Class is for scoping only. | 58 // Class is for scoping only. |
54 DOMUIFactory() {} | 59 DOMUIFactory() {} |
55 | 60 |
56 // Gets the data for the favicon for a DOMUI page. Returns NULL if the DOMUI | 61 // Gets the data for the favicon for a DOMUI page. Returns NULL if the DOMUI |
57 // does not have a favicon. | 62 // does not have a favicon. |
58 static RefCountedMemory* GetFaviconResourceBytes(Profile* profile, | 63 static RefCountedMemory* GetFaviconResourceBytes(Profile* profile, |
59 const GURL& page_url); | 64 const GURL& page_url); |
60 }; | 65 }; |
61 | 66 |
62 #endif // CHROME_BROWSER_DOM_UI_DOM_UI_FACTORY_H_ | 67 #endif // CHROME_BROWSER_DOM_UI_DOM_UI_FACTORY_H_ |
OLD | NEW |