| 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/media_internals_ui.h" |
| 8 #include "content/browser/media/webrtc_internals_ui.h" | 9 #include "content/browser/media/webrtc_internals_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 || |
| 18 url.host() == chrome::kChromeUIGpuHost) { | 19 url.host() == chrome::kChromeUIGpuHost || |
| 20 url.host() == chrome::kChromeUIMediaInternalsHost) { |
| 19 return const_cast<ContentWebUIControllerFactory*>(this); | 21 return const_cast<ContentWebUIControllerFactory*>(this); |
| 20 } | 22 } |
| 21 return WebUI::kNoWebUI; | 23 return WebUI::kNoWebUI; |
| 22 } | 24 } |
| 23 | 25 |
| 24 bool ContentWebUIControllerFactory::UseWebUIForURL( | 26 bool ContentWebUIControllerFactory::UseWebUIForURL( |
| 25 BrowserContext* browser_context, const GURL& url) const { | 27 BrowserContext* browser_context, const GURL& url) const { |
| 26 return GetWebUIType(browser_context, url) != WebUI::kNoWebUI; | 28 return GetWebUIType(browser_context, url) != WebUI::kNoWebUI; |
| 27 } | 29 } |
| 28 | 30 |
| 29 bool ContentWebUIControllerFactory::UseWebUIBindingsForURL( | 31 bool ContentWebUIControllerFactory::UseWebUIBindingsForURL( |
| 30 BrowserContext* browser_context, const GURL& url) const { | 32 BrowserContext* browser_context, const GURL& url) const { |
| 31 return UseWebUIForURL(browser_context, url); | 33 return UseWebUIForURL(browser_context, url); |
| 32 } | 34 } |
| 33 | 35 |
| 34 WebUIController* ContentWebUIControllerFactory::CreateWebUIControllerForURL( | 36 WebUIController* ContentWebUIControllerFactory::CreateWebUIControllerForURL( |
| 35 WebUI* web_ui, const GURL& url) const { | 37 WebUI* web_ui, const GURL& url) const { |
| 36 if (url.host() == chrome::kChromeUIWebRTCInternalsHost) | 38 if (url.host() == chrome::kChromeUIWebRTCInternalsHost) |
| 37 return new WebRTCInternalsUI(web_ui); | 39 return new WebRTCInternalsUI(web_ui); |
| 38 if (url.host() == chrome::kChromeUIGpuHost) | 40 if (url.host() == chrome::kChromeUIGpuHost) |
| 39 return new GpuInternalsUI(web_ui); | 41 return new GpuInternalsUI(web_ui); |
| 42 if (url.host() == chrome::kChromeUIMediaInternalsHost) |
| 43 return new MediaInternalsUI(web_ui); |
| 40 | 44 |
| 41 return NULL; | 45 return NULL; |
| 42 } | 46 } |
| 43 | 47 |
| 44 // static | 48 // static |
| 45 ContentWebUIControllerFactory* ContentWebUIControllerFactory::GetInstance() { | 49 ContentWebUIControllerFactory* ContentWebUIControllerFactory::GetInstance() { |
| 46 return Singleton<ContentWebUIControllerFactory>::get(); | 50 return Singleton<ContentWebUIControllerFactory>::get(); |
| 47 } | 51 } |
| 48 | 52 |
| 49 ContentWebUIControllerFactory::ContentWebUIControllerFactory() { | 53 ContentWebUIControllerFactory::ContentWebUIControllerFactory() { |
| 50 } | 54 } |
| 51 | 55 |
| 52 ContentWebUIControllerFactory::~ContentWebUIControllerFactory() { | 56 ContentWebUIControllerFactory::~ContentWebUIControllerFactory() { |
| 53 } | 57 } |
| 54 | 58 |
| 55 } // namespace content | 59 } // namespace content |
| OLD | NEW |