| 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();
|
| +}
|
|
|