Cast: Stop logging kVideoFrameSentToEncoder and rename a couple events.
[chromium-blink-merge.git] / content / browser / webui / content_web_ui_controller_factory.cc
blob6b7b760e8d5ec624ea37229ef6625c11d1deda9b
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/service_worker/service_worker_internals_ui.h"
13 #include "content/browser/tracing/tracing_ui.h"
14 #include "content/public/browser/storage_partition.h"
15 #include "content/public/browser/web_contents.h"
16 #include "content/public/browser/web_ui.h"
17 #include "content/public/common/url_constants.h"
19 namespace content {
21 WebUI::TypeID ContentWebUIControllerFactory::GetWebUIType(
22 BrowserContext* browser_context, const GURL& url) const {
23 if (url.host() == kChromeUIWebRTCInternalsHost ||
24 #if !defined(OS_ANDROID)
25 url.host() == kChromeUITracingHost ||
26 #endif
27 url.host() == kChromeUIGpuHost ||
28 url.host() == kChromeUIIndexedDBInternalsHost ||
29 url.host() == kChromeUIMediaInternalsHost ||
30 url.host() == kChromeUIServiceWorkerInternalsHost ||
31 url.host() == kChromeUIAccessibilityHost) {
32 return const_cast<ContentWebUIControllerFactory*>(this);
34 return WebUI::kNoWebUI;
37 bool ContentWebUIControllerFactory::UseWebUIForURL(
38 BrowserContext* browser_context, const GURL& url) const {
39 return GetWebUIType(browser_context, url) != WebUI::kNoWebUI;
42 bool ContentWebUIControllerFactory::UseWebUIBindingsForURL(
43 BrowserContext* browser_context, const GURL& url) const {
44 return UseWebUIForURL(browser_context, url);
47 WebUIController* ContentWebUIControllerFactory::CreateWebUIControllerForURL(
48 WebUI* web_ui, const GURL& url) const {
49 if (url.host() == kChromeUIWebRTCInternalsHost)
50 return new WebRTCInternalsUI(web_ui);
51 if (url.host() == kChromeUIGpuHost)
52 return new GpuInternalsUI(web_ui);
53 if (url.host() == kChromeUIIndexedDBInternalsHost)
54 return new IndexedDBInternalsUI(web_ui);
55 if (url.host() == kChromeUIMediaInternalsHost)
56 return new MediaInternalsUI(web_ui);
57 if (url.host() == kChromeUIAccessibilityHost)
58 return new AccessibilityUI(web_ui);
59 if (url.host() == kChromeUIServiceWorkerInternalsHost)
60 return new ServiceWorkerInternalsUI(web_ui);
61 #if !defined(OS_ANDROID)
62 if (url.host() == kChromeUITracingHost)
63 return new TracingUI(web_ui);
64 #endif
66 return NULL;
69 // static
70 ContentWebUIControllerFactory* ContentWebUIControllerFactory::GetInstance() {
71 return Singleton<ContentWebUIControllerFactory>::get();
74 ContentWebUIControllerFactory::ContentWebUIControllerFactory() {
77 ContentWebUIControllerFactory::~ContentWebUIControllerFactory() {
80 } // namespace content