Index: content/browser/webui/web_ui_register.h |
diff --git a/content/browser/webui/web_ui_register.h b/content/browser/webui/web_ui_register.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..67c8652ab15b7ba22d23a8fb2915c995a2d53990 |
--- /dev/null |
+++ b/content/browser/webui/web_ui_register.h |
@@ -0,0 +1,34 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "base/singleton.h" |
+ |
+class WebUISource; |
+ |
+// A single-entry registry which keeps track of a WebUISource. The browser |
+// registers a signle WebUISource at a time. |
jam
2011/03/24 21:38:43
nit: single
|
+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
|
+ public: |
+ // Sets the WebUISource. Clears any previous source. |
+ 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
|
+ |
+ // Returns whatever WebUISource has been registered. This will never return |
+ // NULL; if no WebUISource was registered it returns an EmptyWebUISource (for |
+ // which no URL is considered a WebUI). |
+ static const WebUISource* GetSource(); |
+ |
+ // Exists for Singleton. See Singleton implementation. |
+ static WebUIRegister* GetInstance(); |
+ |
+ private: |
+ WebUIRegister(); |
+ ~WebUIRegister(); |
+ |
+ friend struct DefaultSingletonTraits<WebUIRegister>; |
+ |
+ // We don't own this pointer. |
+ WebUISource* source_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(WebUIRegister); |
+}; |