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

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

Issue 1308823002: Move Singleton and related structs to namespace base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ToT Created 5 years, 3 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
« no previous file with comments | « ios/web/webui/web_ui_ios_controller_factory_registry.h ('k') | ipc/ipc_channel_posix.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/web/webui/web_ui_ios_controller_factory_registry.h" 5 #include "ios/web/webui/web_ui_ios_controller_factory_registry.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "url/gurl.h" 8 #include "url/gurl.h"
9 #include "url/url_constants.h" 9 #include "url/url_constants.h"
10 10
11 namespace web { 11 namespace web {
12 12
13 base::LazyInstance<std::vector<WebUIIOSControllerFactory*> > g_factories = 13 base::LazyInstance<std::vector<WebUIIOSControllerFactory*> > g_factories =
14 LAZY_INSTANCE_INITIALIZER; 14 LAZY_INSTANCE_INITIALIZER;
15 15
16 void WebUIIOSControllerFactory::RegisterFactory( 16 void WebUIIOSControllerFactory::RegisterFactory(
17 WebUIIOSControllerFactory* factory) { 17 WebUIIOSControllerFactory* factory) {
18 g_factories.Pointer()->push_back(factory); 18 g_factories.Pointer()->push_back(factory);
19 } 19 }
20 20
21 WebUIIOSControllerFactoryRegistry* 21 WebUIIOSControllerFactoryRegistry*
22 WebUIIOSControllerFactoryRegistry::GetInstance() { 22 WebUIIOSControllerFactoryRegistry::GetInstance() {
23 return Singleton<WebUIIOSControllerFactoryRegistry>::get(); 23 return base::Singleton<WebUIIOSControllerFactoryRegistry>::get();
24 } 24 }
25 25
26 WebUIIOSController* 26 WebUIIOSController*
27 WebUIIOSControllerFactoryRegistry::CreateWebUIIOSControllerForURL( 27 WebUIIOSControllerFactoryRegistry::CreateWebUIIOSControllerForURL(
28 WebUIIOS* web_ui, 28 WebUIIOS* web_ui,
29 const GURL& url) const { 29 const GURL& url) const {
30 std::vector<WebUIIOSControllerFactory*>* factories = g_factories.Pointer(); 30 std::vector<WebUIIOSControllerFactory*>* factories = g_factories.Pointer();
31 for (size_t i = 0; i < factories->size(); ++i) { 31 for (size_t i = 0; i < factories->size(); ++i) {
32 WebUIIOSController* controller = 32 WebUIIOSController* controller =
33 (*factories)[i]->CreateWebUIIOSControllerForURL(web_ui, url); 33 (*factories)[i]->CreateWebUIIOSControllerForURL(web_ui, url);
34 if (controller) 34 if (controller)
35 return controller; 35 return controller;
36 } 36 }
37 return NULL; 37 return NULL;
38 } 38 }
39 39
40 WebUIIOSControllerFactoryRegistry::WebUIIOSControllerFactoryRegistry() { 40 WebUIIOSControllerFactoryRegistry::WebUIIOSControllerFactoryRegistry() {
41 } 41 }
42 42
43 WebUIIOSControllerFactoryRegistry::~WebUIIOSControllerFactoryRegistry() { 43 WebUIIOSControllerFactoryRegistry::~WebUIIOSControllerFactoryRegistry() {
44 } 44 }
45 45
46 } // namespace web 46 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/webui/web_ui_ios_controller_factory_registry.h ('k') | ipc/ipc_channel_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698