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_TEST_CHROME_WEB_UI_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_TEST_CHROME_WEB_UI_FACTORY_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_TEST_CHROME_WEB_UI_FACTORY_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_TEST_CHROME_WEB_UI_FACTORY_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <functional> | 9 #include <functional> |
10 #include <map> | 10 #include <map> |
(...skipping 21 matching lines...) Expand all Loading... |
32 typedef std::map<std::string, WebUIProvider*> FactoryOverridesMap; | 32 typedef std::map<std::string, WebUIProvider*> FactoryOverridesMap; |
33 | 33 |
34 // Override the creation for urls having |host| with |provider|. | 34 // Override the creation for urls having |host| with |provider|. |
35 static void AddFactoryOverride(const std::string& host, | 35 static void AddFactoryOverride(const std::string& host, |
36 WebUIProvider* provider); | 36 WebUIProvider* provider); |
37 | 37 |
38 // Remove the override for urls having |host|. | 38 // Remove the override for urls having |host|. |
39 static void RemoveFactoryOverride(const std::string& host); | 39 static void RemoveFactoryOverride(const std::string& host); |
40 | 40 |
41 // ChromeWebUIFactory overrides. | 41 // ChromeWebUIFactory overrides. |
42 virtual WebUI::TypeID GetWebUIType(content::BrowserContext* browser_context, | 42 virtual content::WebUI::TypeID GetWebUIType( |
43 const GURL& url) const OVERRIDE; | 43 content::BrowserContext* browser_context, |
| 44 const GURL& url) const OVERRIDE; |
44 virtual content::WebUIController* CreateWebUIForURL( | 45 virtual content::WebUIController* CreateWebUIForURL( |
45 content::WebUI* web_ui, const GURL& url) const OVERRIDE; | 46 content::WebUI* web_ui, const GURL& url) const OVERRIDE; |
46 | 47 |
47 // Return the singleton instance. | 48 // Return the singleton instance. |
48 static TestChromeWebUIFactory* GetInstance(); | 49 static TestChromeWebUIFactory* GetInstance(); |
49 | 50 |
50 private: | 51 private: |
51 TestChromeWebUIFactory(); | 52 TestChromeWebUIFactory(); |
52 virtual ~TestChromeWebUIFactory(); | 53 virtual ~TestChromeWebUIFactory(); |
53 | 54 |
54 friend struct DefaultSingletonTraits<TestChromeWebUIFactory>; | 55 friend struct DefaultSingletonTraits<TestChromeWebUIFactory>; |
55 | 56 |
56 // Return the WebUIProvider for the |url|'s host if it exists, otherwise NULL. | 57 // Return the WebUIProvider for the |url|'s host if it exists, otherwise NULL. |
57 WebUIProvider* GetWebUIProvider(Profile* profile, const GURL& url) const; | 58 WebUIProvider* GetWebUIProvider(Profile* profile, const GURL& url) const; |
58 | 59 |
59 // Stores the mapping of host to WebUIProvider. | 60 // Stores the mapping of host to WebUIProvider. |
60 FactoryOverridesMap factory_overrides_; | 61 FactoryOverridesMap factory_overrides_; |
61 | 62 |
62 DISALLOW_COPY_AND_ASSIGN(TestChromeWebUIFactory); | 63 DISALLOW_COPY_AND_ASSIGN(TestChromeWebUIFactory); |
63 }; | 64 }; |
64 | 65 |
65 #endif // CHROME_BROWSER_UI_WEBUI_TEST_CHROME_WEB_UI_FACTORY_H_ | 66 #endif // CHROME_BROWSER_UI_WEBUI_TEST_CHROME_WEB_UI_FACTORY_H_ |
OLD | NEW |