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

Unified Diff: content/browser/webui/web_ui_register.cc

Issue 6713082: Move WebUIFactory to chrome/browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 9 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/webui/web_ui_register.cc
diff --git a/content/browser/webui/web_ui_register.cc b/content/browser/webui/web_ui_register.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f354e39d824f0706533999324030128a090dab4a
--- /dev/null
+++ b/content/browser/webui/web_ui_register.cc
@@ -0,0 +1,66 @@
+// 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 "content/browser/webui/web_ui_register.h"
+
+#include "content/browser/webui/web_ui.h"
+#include "content/browser/webui/web_ui_source.h"
+
+namespace {
+
+// A stubbed out version of WebUISource.
+class EmptyWebUISource : public WebUISource {
+ public:
+ virtual WebUI* CreateWebUIForURL(TabContents* source,
+ const GURL& url) const {
+ return NULL;
+ }
+ virtual WebUI::WebUITypeID GetWebUIType(Profile* profile,
+ const GURL& url) const {
+ return WebUI::kNoWebUI;
+ }
+ virtual bool UseWebUIForURL(Profile* profile, const GURL& url) const {
+ return false;
+ }
+ virtual bool HasWebUIScheme(const GURL& url) const {
+ return false;
+ }
+ virtual bool IsURLAcceptableForWebUI(Profile* profile,
+ const GURL& url) const {
+ return false;
+ };
+
+ static EmptyWebUISource* GetInstance() {
+ return Singleton<EmptyWebUISource>::get();
+ }
+
+ private:
+ EmptyWebUISource() {}
+ virtual ~EmptyWebUISource() {}
+
+ friend struct DefaultSingletonTraits<EmptyWebUISource>;
+};
+
+} // namespace
+
+// static
+void WebUIRegister::RegisterSource(WebUISource* source) {
+ GetInstance()->source_ = source;
+}
+
+// static
+const WebUISource* WebUIRegister::GetSource() {
+ return GetInstance()->source_;
+}
+
+WebUIRegister::WebUIRegister() : source_(EmptyWebUISource::GetInstance()) {
+}
+
+WebUIRegister::~WebUIRegister() {
+}
+
+// static
+WebUIRegister* WebUIRegister::GetInstance() {
+ return Singleton<WebUIRegister>::get();
+}

Powered by Google App Engine
This is Rietveld 408576698