Add ICU message format support
[chromium-blink-merge.git] / ios / web / webui / web_ui_ios_controller_factory_registry.cc
blob58e8d1360bf31e35399c927826199461d0e3d74d
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
3 // found in the LICENSE file.
5 #include "ios/web/webui/web_ui_ios_controller_factory_registry.h"
7 #include "base/lazy_instance.h"
8 #include "url/gurl.h"
9 #include "url/url_constants.h"
11 namespace web {
13 base::LazyInstance<std::vector<WebUIIOSControllerFactory*> > g_factories =
14 LAZY_INSTANCE_INITIALIZER;
16 void WebUIIOSControllerFactory::RegisterFactory(
17 WebUIIOSControllerFactory* factory) {
18 g_factories.Pointer()->push_back(factory);
21 WebUIIOSControllerFactoryRegistry*
22 WebUIIOSControllerFactoryRegistry::GetInstance() {
23 return Singleton<WebUIIOSControllerFactoryRegistry>::get();
26 WebUIIOSController*
27 WebUIIOSControllerFactoryRegistry::CreateWebUIIOSControllerForURL(
28 WebUIIOS* web_ui,
29 const GURL& url) const {
30 std::vector<WebUIIOSControllerFactory*>* factories = g_factories.Pointer();
31 for (size_t i = 0; i < factories->size(); ++i) {
32 WebUIIOSController* controller =
33 (*factories)[i]->CreateWebUIIOSControllerForURL(web_ui, url);
34 if (controller)
35 return controller;
37 return NULL;
40 WebUIIOSControllerFactoryRegistry::WebUIIOSControllerFactoryRegistry() {
43 WebUIIOSControllerFactoryRegistry::~WebUIIOSControllerFactoryRegistry() {
46 } // namespace web