Respond with QuotaExceededError when IndexedDB has no disk space on open.
[chromium-blink-merge.git] / content / browser / webui / content_web_ui_controller_factory.cc
blob45a38adb7072ca5f09760c27d421f6e9cf433c06
1 // Copyright (c) 2013 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.
5 #include "content/browser/webui/content_web_ui_controller_factory.h"
7 #include "content/browser/accessibility/accessibility_ui.h"
8 #include "content/browser/gpu/gpu_internals_ui.h"
9 #include "content/browser/indexed_db/indexed_db_internals_ui.h"
10 #include "content/browser/media/media_internals_ui.h"
11 #include "content/browser/media/webrtc_internals_ui.h"
12 #include "content/browser/tracing/tracing_ui.h"
13 #include "content/public/browser/web_contents.h"
14 #include "content/public/browser/web_ui.h"
15 #include "content/public/common/url_constants.h"
17 namespace content {
19 WebUI::TypeID ContentWebUIControllerFactory::GetWebUIType(
20 BrowserContext* browser_context, const GURL& url) const {
21 if (url.host() == kChromeUIWebRTCInternalsHost ||
22 #if !defined(OS_ANDROID)
23 url.host() == kChromeUITracingHost ||
24 #endif
25 url.host() == kChromeUIGpuHost ||
26 url.host() == kChromeUIIndexedDBInternalsHost ||
27 url.host() == kChromeUIMediaInternalsHost ||
28 url.host() == kChromeUIAccessibilityHost) {
29 return const_cast<ContentWebUIControllerFactory*>(this);
31 return WebUI::kNoWebUI;
34 bool ContentWebUIControllerFactory::UseWebUIForURL(
35 BrowserContext* browser_context, const GURL& url) const {
36 return GetWebUIType(browser_context, url) != WebUI::kNoWebUI;
39 bool ContentWebUIControllerFactory::UseWebUIBindingsForURL(
40 BrowserContext* browser_context, const GURL& url) const {
41 return UseWebUIForURL(browser_context, url);
44 WebUIController* ContentWebUIControllerFactory::CreateWebUIControllerForURL(
45 WebUI* web_ui, const GURL& url) const {
46 if (url.host() == kChromeUIWebRTCInternalsHost)
47 return new WebRTCInternalsUI(web_ui);
48 if (url.host() == kChromeUIGpuHost)
49 return new GpuInternalsUI(web_ui);
50 if (url.host() == kChromeUIIndexedDBInternalsHost)
51 return new IndexedDBInternalsUI(web_ui);
52 if (url.host() == kChromeUIMediaInternalsHost)
53 return new MediaInternalsUI(web_ui);
54 if (url.host() == kChromeUIAccessibilityHost)
55 return new AccessibilityUI(web_ui);
56 #if !defined(OS_ANDROID)
57 if (url.host() == kChromeUITracingHost)
58 return new TracingUI(web_ui);
59 #endif
61 return NULL;
64 // static
65 ContentWebUIControllerFactory* ContentWebUIControllerFactory::GetInstance() {
66 return Singleton<ContentWebUIControllerFactory>::get();
69 ContentWebUIControllerFactory::ContentWebUIControllerFactory() {
72 ContentWebUIControllerFactory::~ContentWebUIControllerFactory() {
75 } // namespace content