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