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/gpu/gpu_internals_ui.h" | 8 #include "content/browser/gpu/gpu_internals_ui.h" |
9 #include "content/browser/indexed_db/indexed_db_internals_ui.h" | 9 #include "content/browser/indexed_db/indexed_db_internals_ui.h" |
10 #include "content/browser/media/media_internals_ui.h" | 10 #include "content/browser/media/media_internals_ui.h" |
11 #include "content/browser/media/webrtc_internals_ui.h" | 11 #include "content/browser/media/webrtc_internals_ui.h" |
| 12 #include "content/browser/service_worker/service_worker_internals_ui.h" |
12 #include "content/browser/tracing/tracing_ui.h" | 13 #include "content/browser/tracing/tracing_ui.h" |
| 14 #include "content/public/browser/storage_partition.h" |
13 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
14 #include "content/public/browser/web_ui.h" | 16 #include "content/public/browser/web_ui.h" |
15 #include "content/public/common/url_constants.h" | 17 #include "content/public/common/url_constants.h" |
16 | 18 |
17 namespace content { | 19 namespace content { |
18 | 20 |
19 WebUI::TypeID ContentWebUIControllerFactory::GetWebUIType( | 21 WebUI::TypeID ContentWebUIControllerFactory::GetWebUIType( |
20 BrowserContext* browser_context, const GURL& url) const { | 22 BrowserContext* browser_context, const GURL& url) const { |
21 if (url.host() == kChromeUIWebRTCInternalsHost || | 23 if (url.host() == kChromeUIWebRTCInternalsHost || |
22 #if !defined(OS_ANDROID) | 24 #if !defined(OS_ANDROID) |
23 url.host() == kChromeUITracingHost || | 25 url.host() == kChromeUITracingHost || |
24 #endif | 26 #endif |
25 url.host() == kChromeUIGpuHost || | 27 url.host() == kChromeUIGpuHost || |
26 url.host() == kChromeUIIndexedDBInternalsHost || | 28 url.host() == kChromeUIIndexedDBInternalsHost || |
27 url.host() == kChromeUIMediaInternalsHost || | 29 url.host() == kChromeUIMediaInternalsHost || |
| 30 url.host() == kChromeUIServiceWorkerInternalsHost || |
28 url.host() == kChromeUIAccessibilityHost) { | 31 url.host() == kChromeUIAccessibilityHost) { |
29 return const_cast<ContentWebUIControllerFactory*>(this); | 32 return const_cast<ContentWebUIControllerFactory*>(this); |
30 } | 33 } |
31 return WebUI::kNoWebUI; | 34 return WebUI::kNoWebUI; |
32 } | 35 } |
33 | 36 |
34 bool ContentWebUIControllerFactory::UseWebUIForURL( | 37 bool ContentWebUIControllerFactory::UseWebUIForURL( |
35 BrowserContext* browser_context, const GURL& url) const { | 38 BrowserContext* browser_context, const GURL& url) const { |
36 return GetWebUIType(browser_context, url) != WebUI::kNoWebUI; | 39 return GetWebUIType(browser_context, url) != WebUI::kNoWebUI; |
37 } | 40 } |
38 | 41 |
39 bool ContentWebUIControllerFactory::UseWebUIBindingsForURL( | 42 bool ContentWebUIControllerFactory::UseWebUIBindingsForURL( |
40 BrowserContext* browser_context, const GURL& url) const { | 43 BrowserContext* browser_context, const GURL& url) const { |
41 return UseWebUIForURL(browser_context, url); | 44 return UseWebUIForURL(browser_context, url); |
42 } | 45 } |
43 | 46 |
44 WebUIController* ContentWebUIControllerFactory::CreateWebUIControllerForURL( | 47 WebUIController* ContentWebUIControllerFactory::CreateWebUIControllerForURL( |
45 WebUI* web_ui, const GURL& url) const { | 48 WebUI* web_ui, const GURL& url) const { |
46 if (url.host() == kChromeUIWebRTCInternalsHost) | 49 if (url.host() == kChromeUIWebRTCInternalsHost) |
47 return new WebRTCInternalsUI(web_ui); | 50 return new WebRTCInternalsUI(web_ui); |
48 if (url.host() == kChromeUIGpuHost) | 51 if (url.host() == kChromeUIGpuHost) |
49 return new GpuInternalsUI(web_ui); | 52 return new GpuInternalsUI(web_ui); |
50 if (url.host() == kChromeUIIndexedDBInternalsHost) | 53 if (url.host() == kChromeUIIndexedDBInternalsHost) |
51 return new IndexedDBInternalsUI(web_ui); | 54 return new IndexedDBInternalsUI(web_ui); |
52 if (url.host() == kChromeUIMediaInternalsHost) | 55 if (url.host() == kChromeUIMediaInternalsHost) |
53 return new MediaInternalsUI(web_ui); | 56 return new MediaInternalsUI(web_ui); |
54 if (url.host() == kChromeUIAccessibilityHost) | 57 if (url.host() == kChromeUIAccessibilityHost) |
55 return new AccessibilityUI(web_ui); | 58 return new AccessibilityUI(web_ui); |
| 59 if (url.host() == kChromeUIServiceWorkerInternalsHost) |
| 60 return new ServiceWorkerInternalsUI(web_ui); |
56 #if !defined(OS_ANDROID) | 61 #if !defined(OS_ANDROID) |
57 if (url.host() == kChromeUITracingHost) | 62 if (url.host() == kChromeUITracingHost) |
58 return new TracingUI(web_ui); | 63 return new TracingUI(web_ui); |
59 #endif | 64 #endif |
60 | 65 |
61 return NULL; | 66 return NULL; |
62 } | 67 } |
63 | 68 |
64 // static | 69 // static |
65 ContentWebUIControllerFactory* ContentWebUIControllerFactory::GetInstance() { | 70 ContentWebUIControllerFactory* ContentWebUIControllerFactory::GetInstance() { |
66 return Singleton<ContentWebUIControllerFactory>::get(); | 71 return Singleton<ContentWebUIControllerFactory>::get(); |
67 } | 72 } |
68 | 73 |
69 ContentWebUIControllerFactory::ContentWebUIControllerFactory() { | 74 ContentWebUIControllerFactory::ContentWebUIControllerFactory() { |
70 } | 75 } |
71 | 76 |
72 ContentWebUIControllerFactory::~ContentWebUIControllerFactory() { | 77 ContentWebUIControllerFactory::~ContentWebUIControllerFactory() { |
73 } | 78 } |
74 | 79 |
75 } // namespace content | 80 } // namespace content |
OLD | NEW |