OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/webui/content_web_ui_controller_factory.h" | 5 #include "content/browser/webui/content_web_ui_controller_factory.h" |
6 | 6 |
7 #include "content/browser/accessibility/accessibility_ui.h" | 7 #include "content/browser/accessibility/accessibility_ui.h" |
8 #include "content/browser/appcache/appcache_internals_ui.h" | 8 #include "content/browser/appcache/appcache_internals_ui.h" |
9 #include "content/browser/gpu/gpu_internals_ui.h" | 9 #include "content/browser/gpu/gpu_internals_ui.h" |
10 #include "content/browser/indexed_db/indexed_db_internals_ui.h" | 10 #include "content/browser/indexed_db/indexed_db_internals_ui.h" |
11 #include "content/browser/media/media_internals_ui.h" | 11 #include "content/browser/media/media_internals_ui.h" |
| 12 #include "content/browser/net/network_errors_listing_ui.h" |
12 #include "content/browser/service_worker/service_worker_internals_ui.h" | 13 #include "content/browser/service_worker/service_worker_internals_ui.h" |
13 #include "content/browser/tracing/tracing_ui.h" | 14 #include "content/browser/tracing/tracing_ui.h" |
14 #include "content/public/browser/storage_partition.h" | 15 #include "content/public/browser/storage_partition.h" |
15 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
16 #include "content/public/browser/web_ui.h" | 17 #include "content/public/browser/web_ui.h" |
17 #include "content/public/common/url_constants.h" | 18 #include "content/public/common/url_constants.h" |
18 | 19 |
19 #if defined(ENABLE_WEBRTC) | 20 #if defined(ENABLE_WEBRTC) |
20 #include "content/browser/media/webrtc_internals_ui.h" | 21 #include "content/browser/media/webrtc_internals_ui.h" |
21 #endif | 22 #endif |
22 | 23 |
23 namespace content { | 24 namespace content { |
24 | 25 |
25 WebUI::TypeID ContentWebUIControllerFactory::GetWebUIType( | 26 WebUI::TypeID ContentWebUIControllerFactory::GetWebUIType( |
26 BrowserContext* browser_context, const GURL& url) const { | 27 BrowserContext* browser_context, const GURL& url) const { |
27 if (!url.SchemeIs(kChromeUIScheme)) | 28 if (!url.SchemeIs(kChromeUIScheme)) |
28 return WebUI::kNoWebUI; | 29 return WebUI::kNoWebUI; |
29 | 30 |
30 if (url.host() == kChromeUIWebRTCInternalsHost || | 31 if (url.host() == kChromeUIWebRTCInternalsHost || |
31 #if !defined(OS_ANDROID) | 32 #if !defined(OS_ANDROID) |
32 url.host() == kChromeUITracingHost || | 33 url.host() == kChromeUITracingHost || |
33 #endif | 34 #endif |
34 url.host() == kChromeUIGpuHost || | 35 url.host() == kChromeUIGpuHost || |
35 url.host() == kChromeUIIndexedDBInternalsHost || | 36 url.host() == kChromeUIIndexedDBInternalsHost || |
36 url.host() == kChromeUIMediaInternalsHost || | 37 url.host() == kChromeUIMediaInternalsHost || |
37 url.host() == kChromeUIServiceWorkerInternalsHost || | 38 url.host() == kChromeUIServiceWorkerInternalsHost || |
38 url.host() == kChromeUIAccessibilityHost || | 39 url.host() == kChromeUIAccessibilityHost || |
39 url.host() == kChromeUIAppCacheInternalsHost) { | 40 url.host() == kChromeUIAppCacheInternalsHost || |
| 41 url.host() == kChromeUINetworkErrorsListingHost) { |
40 return const_cast<ContentWebUIControllerFactory*>(this); | 42 return const_cast<ContentWebUIControllerFactory*>(this); |
41 } | 43 } |
42 return WebUI::kNoWebUI; | 44 return WebUI::kNoWebUI; |
43 } | 45 } |
44 | 46 |
45 bool ContentWebUIControllerFactory::UseWebUIForURL( | 47 bool ContentWebUIControllerFactory::UseWebUIForURL( |
46 BrowserContext* browser_context, const GURL& url) const { | 48 BrowserContext* browser_context, const GURL& url) const { |
47 return GetWebUIType(browser_context, url) != WebUI::kNoWebUI; | 49 return GetWebUIType(browser_context, url) != WebUI::kNoWebUI; |
48 } | 50 } |
49 | 51 |
(...skipping 12 matching lines...) Expand all Loading... |
62 if (url.host() == kChromeUIGpuHost) | 64 if (url.host() == kChromeUIGpuHost) |
63 return new GpuInternalsUI(web_ui); | 65 return new GpuInternalsUI(web_ui); |
64 if (url.host() == kChromeUIIndexedDBInternalsHost) | 66 if (url.host() == kChromeUIIndexedDBInternalsHost) |
65 return new IndexedDBInternalsUI(web_ui); | 67 return new IndexedDBInternalsUI(web_ui); |
66 if (url.host() == kChromeUIMediaInternalsHost) | 68 if (url.host() == kChromeUIMediaInternalsHost) |
67 return new MediaInternalsUI(web_ui); | 69 return new MediaInternalsUI(web_ui); |
68 if (url.host() == kChromeUIAccessibilityHost) | 70 if (url.host() == kChromeUIAccessibilityHost) |
69 return new AccessibilityUI(web_ui); | 71 return new AccessibilityUI(web_ui); |
70 if (url.host() == kChromeUIServiceWorkerInternalsHost) | 72 if (url.host() == kChromeUIServiceWorkerInternalsHost) |
71 return new ServiceWorkerInternalsUI(web_ui); | 73 return new ServiceWorkerInternalsUI(web_ui); |
| 74 if (url.host() == kChromeUINetworkErrorsListingHost) |
| 75 return new NetworkErrorsListingUI(web_ui); |
72 #if !defined(OS_ANDROID) | 76 #if !defined(OS_ANDROID) |
73 if (url.host() == kChromeUITracingHost) | 77 if (url.host() == kChromeUITracingHost) |
74 return new TracingUI(web_ui); | 78 return new TracingUI(web_ui); |
75 #endif | 79 #endif |
76 | 80 |
77 #if defined(ENABLE_WEBRTC) | 81 #if defined(ENABLE_WEBRTC) |
78 if (url.host() == kChromeUIWebRTCInternalsHost) | 82 if (url.host() == kChromeUIWebRTCInternalsHost) |
79 return new WebRTCInternalsUI(web_ui); | 83 return new WebRTCInternalsUI(web_ui); |
80 #endif | 84 #endif |
81 | 85 |
82 return nullptr; | 86 return nullptr; |
83 } | 87 } |
84 | 88 |
85 // static | 89 // static |
86 ContentWebUIControllerFactory* ContentWebUIControllerFactory::GetInstance() { | 90 ContentWebUIControllerFactory* ContentWebUIControllerFactory::GetInstance() { |
87 return base::Singleton<ContentWebUIControllerFactory>::get(); | 91 return base::Singleton<ContentWebUIControllerFactory>::get(); |
88 } | 92 } |
89 | 93 |
90 ContentWebUIControllerFactory::ContentWebUIControllerFactory() { | 94 ContentWebUIControllerFactory::ContentWebUIControllerFactory() { |
91 } | 95 } |
92 | 96 |
93 ContentWebUIControllerFactory::~ContentWebUIControllerFactory() { | 97 ContentWebUIControllerFactory::~ContentWebUIControllerFactory() { |
94 } | 98 } |
95 | 99 |
96 } // namespace content | 100 } // namespace content |
OLD | NEW |