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