OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "base/singleton.h" | |
6 | |
7 class WebUISource; | |
8 | |
9 // A single-entry registry which keeps track of a WebUISource. The browser | |
10 // registers a signle WebUISource at a time. | |
jam
2011/03/24 21:38:43
nit: single
| |
11 class WebUIRegister { | |
stuartmorgan
2011/03/24 21:09:41
Register is usually a verb. Registry? Registrar?
Evan Stade
2011/03/24 21:28:40
register is also a noun. As a noun it's basically
| |
12 public: | |
13 // Sets the WebUISource. Clears any previous source. | |
14 static void RegisterSource(WebUISource* source); | |
stuartmorgan
2011/03/24 21:09:41
Maybe the behavior would be more obvious if the na
Evan Stade
2011/03/24 21:28:40
ok
| |
15 | |
16 // Returns whatever WebUISource has been registered. This will never return | |
17 // NULL; if no WebUISource was registered it returns an EmptyWebUISource (for | |
18 // which no URL is considered a WebUI). | |
19 static const WebUISource* GetSource(); | |
20 | |
21 // Exists for Singleton. See Singleton implementation. | |
22 static WebUIRegister* GetInstance(); | |
23 | |
24 private: | |
25 WebUIRegister(); | |
26 ~WebUIRegister(); | |
27 | |
28 friend struct DefaultSingletonTraits<WebUIRegister>; | |
29 | |
30 // We don't own this pointer. | |
31 WebUISource* source_; | |
32 | |
33 DISALLOW_COPY_AND_ASSIGN(WebUIRegister); | |
34 }; | |
OLD | NEW |