| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "ios/chrome/browser/ui/webui/chrome_web_ui_ios_controller_factory.h" | 5 #include "ios/chrome/browser/ui/webui/chrome_web_ui_ios_controller_factory.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "ios/chrome/browser/chrome_url_constants.h" | 10 #include "ios/chrome/browser/chrome_url_constants.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 if (url_host == kChromeUISignInInternalsHost) | 85 if (url_host == kChromeUISignInInternalsHost) |
| 86 return &NewWebUIIOS<SignInInternalsUIIOS>; | 86 return &NewWebUIIOS<SignInInternalsUIIOS>; |
| 87 if (url_host == kChromeUISyncInternalsHost) | 87 if (url_host == kChromeUISyncInternalsHost) |
| 88 return &NewWebUIIOS<SyncInternalsUI>; | 88 return &NewWebUIIOS<SyncInternalsUI>; |
| 89 if (url_host == kChromeUITermsHost) | 89 if (url_host == kChromeUITermsHost) |
| 90 return &NewWebUIIOSWithHost<TermsUI>; | 90 return &NewWebUIIOSWithHost<TermsUI>; |
| 91 if (url_host == kChromeUIVersionHost) | 91 if (url_host == kChromeUIVersionHost) |
| 92 return &NewWebUIIOS<VersionUI>; | 92 return &NewWebUIIOS<VersionUI>; |
| 93 if (url_host == kChromeUIFlagsHost) | 93 if (url_host == kChromeUIFlagsHost) |
| 94 return &NewWebUIIOS<FlagsUI>; | 94 return &NewWebUIIOS<FlagsUI>; |
| 95 if (url_host == kChromeUIAppleFlagsHost) | |
| 96 return &NewWebUIIOS<AppleFlagsUI>; | |
| 97 | 95 |
| 98 return nullptr; | 96 return nullptr; |
| 99 } | 97 } |
| 100 | 98 |
| 101 } // namespace | 99 } // namespace |
| 102 | 100 |
| 103 std::unique_ptr<WebUIIOSController> | 101 std::unique_ptr<WebUIIOSController> |
| 104 ChromeWebUIIOSControllerFactory::CreateWebUIIOSControllerForURL( | 102 ChromeWebUIIOSControllerFactory::CreateWebUIIOSControllerForURL( |
| 105 WebUIIOS* web_ui, | 103 WebUIIOS* web_ui, |
| 106 const GURL& url) const { | 104 const GURL& url) const { |
| 107 WebUIIOSFactoryFunction function = GetWebUIIOSFactoryFunction(web_ui, url); | 105 WebUIIOSFactoryFunction function = GetWebUIIOSFactoryFunction(web_ui, url); |
| 108 if (!function) | 106 if (!function) |
| 109 return nullptr; | 107 return nullptr; |
| 110 | 108 |
| 111 return (*function)(web_ui, url); | 109 return (*function)(web_ui, url); |
| 112 } | 110 } |
| 113 | 111 |
| 114 // static | 112 // static |
| 115 ChromeWebUIIOSControllerFactory* | 113 ChromeWebUIIOSControllerFactory* |
| 116 ChromeWebUIIOSControllerFactory::GetInstance() { | 114 ChromeWebUIIOSControllerFactory::GetInstance() { |
| 117 return base::Singleton<ChromeWebUIIOSControllerFactory>::get(); | 115 return base::Singleton<ChromeWebUIIOSControllerFactory>::get(); |
| 118 } | 116 } |
| 119 | 117 |
| 120 ChromeWebUIIOSControllerFactory::ChromeWebUIIOSControllerFactory() {} | 118 ChromeWebUIIOSControllerFactory::ChromeWebUIIOSControllerFactory() {} |
| 121 | 119 |
| 122 ChromeWebUIIOSControllerFactory::~ChromeWebUIIOSControllerFactory() {} | 120 ChromeWebUIIOSControllerFactory::~ChromeWebUIIOSControllerFactory() {} |
| OLD | NEW |