Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: ios/web/webui/web_ui_ios_controller_factory_registry.cc

Issue 1110213002: Upstream most of the iOS WebUI support in ios/web/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #include "ios/web/webui/web_ui_ios_controller_factory_registry.h"
6
7 #include "base/lazy_instance.h"
8 #include "url/gurl.h"
9 #include "url/url_constants.h"
10
11 namespace web {
12
13 base::LazyInstance<std::vector<WebUIIOSControllerFactory*> > g_factories =
Eugene But (OOO till 7-30) 2015/04/28 20:23:01 NIT: no need for space between '>'
14 LAZY_INSTANCE_INITIALIZER;
15
16 void WebUIIOSControllerFactory::RegisterFactory(
17 WebUIIOSControllerFactory* factory) {
18 g_factories.Pointer()->push_back(factory);
19 }
20
21 WebUIIOSControllerFactoryRegistry*
22 WebUIIOSControllerFactoryRegistry::GetInstance() {
23 return Singleton<WebUIIOSControllerFactoryRegistry>::get();
24 }
25
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;
36 }
37 return NULL;
38 }
39
40 WebUIIOSControllerFactoryRegistry::WebUIIOSControllerFactoryRegistry() {
41 }
42
43 WebUIIOSControllerFactoryRegistry::~WebUIIOSControllerFactoryRegistry() {
44 }
45
46 } // namespace web
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698