Disable PDF tests that are failing after combining PDF plugin into chrome.
[chromium-blink-merge.git] / content / browser / webui / content_web_ui_controller_factory.cc
blob7a9263111f395e7b593854366e3c836851ec4fac
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/service_worker/service_worker_internals_ui.h"
12 #include "content/browser/tracing/tracing_ui.h"
13 #include "content/public/browser/storage_partition.h"
14 #include "content/public/browser/web_contents.h"
15 #include "content/public/browser/web_ui.h"
16 #include "content/public/common/url_constants.h"
18 #if defined(ENABLE_WEBRTC)
19 #include "content/browser/media/webrtc_internals_ui.h"
20 #endif
22 namespace content {
24 WebUI::TypeID ContentWebUIControllerFactory::GetWebUIType(
25 BrowserContext* browser_context, const GURL& url) const {
26 if (url.host() == kChromeUIWebRTCInternalsHost ||
27 #if !defined(OS_ANDROID)
28 url.host() == kChromeUITracingHost ||
29 #endif
30 url.host() == kChromeUIGpuHost ||
31 url.host() == kChromeUIIndexedDBInternalsHost ||
32 url.host() == kChromeUIMediaInternalsHost ||
33 url.host() == kChromeUIServiceWorkerInternalsHost ||
34 url.host() == kChromeUIAccessibilityHost) {
35 return const_cast<ContentWebUIControllerFactory*>(this);
37 return WebUI::kNoWebUI;
40 bool ContentWebUIControllerFactory::UseWebUIForURL(
41 BrowserContext* browser_context, const GURL& url) const {
42 return GetWebUIType(browser_context, url) != WebUI::kNoWebUI;
45 bool ContentWebUIControllerFactory::UseWebUIBindingsForURL(
46 BrowserContext* browser_context, const GURL& url) const {
47 return UseWebUIForURL(browser_context, url);
50 WebUIController* ContentWebUIControllerFactory::CreateWebUIControllerForURL(
51 WebUI* web_ui, const GURL& url) const {
52 if (url.host() == kChromeUIGpuHost)
53 return new GpuInternalsUI(web_ui);
54 if (url.host() == kChromeUIIndexedDBInternalsHost)
55 return new IndexedDBInternalsUI(web_ui);
56 if (url.host() == kChromeUIMediaInternalsHost)
57 return new MediaInternalsUI(web_ui);
58 if (url.host() == kChromeUIAccessibilityHost)
59 return new AccessibilityUI(web_ui);
60 if (url.host() == kChromeUIServiceWorkerInternalsHost)
61 return new ServiceWorkerInternalsUI(web_ui);
62 #if !defined(OS_ANDROID)
63 if (url.host() == kChromeUITracingHost)
64 return new TracingUI(web_ui);
65 #endif
67 #if defined(ENABLE_WEBRTC)
68 if (url.host() == kChromeUIWebRTCInternalsHost)
69 return new WebRTCInternalsUI(web_ui);
70 #endif
72 return NULL;
75 // static
76 ContentWebUIControllerFactory* ContentWebUIControllerFactory::GetInstance() {
77 return Singleton<ContentWebUIControllerFactory>::get();
80 ContentWebUIControllerFactory::ContentWebUIControllerFactory() {
83 ContentWebUIControllerFactory::~ContentWebUIControllerFactory() {
86 } // namespace content