Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: content/browser/webui/content_web_ui_controller_factory.cc

Issue 1129123004: Don't treat http://gpu as a WebUI url (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CONTENT_EXPORT Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/webui/content_web_ui_controller_factory.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/service_worker/service_worker_internals_ui.h" 11 #include "content/browser/service_worker/service_worker_internals_ui.h"
12 #include "content/browser/tracing/tracing_ui.h" 12 #include "content/browser/tracing/tracing_ui.h"
13 #include "content/public/browser/storage_partition.h" 13 #include "content/public/browser/storage_partition.h"
14 #include "content/public/browser/web_contents.h" 14 #include "content/public/browser/web_contents.h"
15 #include "content/public/browser/web_ui.h" 15 #include "content/public/browser/web_ui.h"
16 #include "content/public/common/url_constants.h" 16 #include "content/public/common/url_constants.h"
17 17
18 #if defined(ENABLE_WEBRTC) 18 #if defined(ENABLE_WEBRTC)
19 #include "content/browser/media/webrtc_internals_ui.h" 19 #include "content/browser/media/webrtc_internals_ui.h"
20 #endif 20 #endif
21 21
22 namespace content { 22 namespace content {
23 23
24 WebUI::TypeID ContentWebUIControllerFactory::GetWebUIType( 24 WebUI::TypeID ContentWebUIControllerFactory::GetWebUIType(
25 BrowserContext* browser_context, const GURL& url) const { 25 BrowserContext* browser_context, const GURL& url) const {
26 if (!url.SchemeIs(kChromeUIScheme))
27 return WebUI::kNoWebUI;
28
26 if (url.host() == kChromeUIWebRTCInternalsHost || 29 if (url.host() == kChromeUIWebRTCInternalsHost ||
27 #if !defined(OS_ANDROID) 30 #if !defined(OS_ANDROID)
28 url.host() == kChromeUITracingHost || 31 url.host() == kChromeUITracingHost ||
29 #endif 32 #endif
30 url.host() == kChromeUIGpuHost || 33 url.host() == kChromeUIGpuHost ||
31 url.host() == kChromeUIIndexedDBInternalsHost || 34 url.host() == kChromeUIIndexedDBInternalsHost ||
32 url.host() == kChromeUIMediaInternalsHost || 35 url.host() == kChromeUIMediaInternalsHost ||
33 url.host() == kChromeUIServiceWorkerInternalsHost || 36 url.host() == kChromeUIServiceWorkerInternalsHost ||
34 url.host() == kChromeUIAccessibilityHost) { 37 url.host() == kChromeUIAccessibilityHost) {
35 return const_cast<ContentWebUIControllerFactory*>(this); 38 return const_cast<ContentWebUIControllerFactory*>(this);
36 } 39 }
37 return WebUI::kNoWebUI; 40 return WebUI::kNoWebUI;
38 } 41 }
39 42
40 bool ContentWebUIControllerFactory::UseWebUIForURL( 43 bool ContentWebUIControllerFactory::UseWebUIForURL(
41 BrowserContext* browser_context, const GURL& url) const { 44 BrowserContext* browser_context, const GURL& url) const {
42 return GetWebUIType(browser_context, url) != WebUI::kNoWebUI; 45 return GetWebUIType(browser_context, url) != WebUI::kNoWebUI;
43 } 46 }
44 47
45 bool ContentWebUIControllerFactory::UseWebUIBindingsForURL( 48 bool ContentWebUIControllerFactory::UseWebUIBindingsForURL(
46 BrowserContext* browser_context, const GURL& url) const { 49 BrowserContext* browser_context, const GURL& url) const {
47 return UseWebUIForURL(browser_context, url); 50 return UseWebUIForURL(browser_context, url);
48 } 51 }
49 52
50 WebUIController* ContentWebUIControllerFactory::CreateWebUIControllerForURL( 53 WebUIController* ContentWebUIControllerFactory::CreateWebUIControllerForURL(
51 WebUI* web_ui, const GURL& url) const { 54 WebUI* web_ui, const GURL& url) const {
55 if (!url.SchemeIs(kChromeUIScheme))
56 return nullptr;
57
52 if (url.host() == kChromeUIGpuHost) 58 if (url.host() == kChromeUIGpuHost)
53 return new GpuInternalsUI(web_ui); 59 return new GpuInternalsUI(web_ui);
54 if (url.host() == kChromeUIIndexedDBInternalsHost) 60 if (url.host() == kChromeUIIndexedDBInternalsHost)
55 return new IndexedDBInternalsUI(web_ui); 61 return new IndexedDBInternalsUI(web_ui);
56 if (url.host() == kChromeUIMediaInternalsHost) 62 if (url.host() == kChromeUIMediaInternalsHost)
57 return new MediaInternalsUI(web_ui); 63 return new MediaInternalsUI(web_ui);
58 if (url.host() == kChromeUIAccessibilityHost) 64 if (url.host() == kChromeUIAccessibilityHost)
59 return new AccessibilityUI(web_ui); 65 return new AccessibilityUI(web_ui);
60 if (url.host() == kChromeUIServiceWorkerInternalsHost) 66 if (url.host() == kChromeUIServiceWorkerInternalsHost)
61 return new ServiceWorkerInternalsUI(web_ui); 67 return new ServiceWorkerInternalsUI(web_ui);
62 #if !defined(OS_ANDROID) 68 #if !defined(OS_ANDROID)
63 if (url.host() == kChromeUITracingHost) 69 if (url.host() == kChromeUITracingHost)
64 return new TracingUI(web_ui); 70 return new TracingUI(web_ui);
65 #endif 71 #endif
66 72
67 #if defined(ENABLE_WEBRTC) 73 #if defined(ENABLE_WEBRTC)
68 if (url.host() == kChromeUIWebRTCInternalsHost) 74 if (url.host() == kChromeUIWebRTCInternalsHost)
69 return new WebRTCInternalsUI(web_ui); 75 return new WebRTCInternalsUI(web_ui);
70 #endif 76 #endif
71 77
72 return NULL; 78 return nullptr;
73 } 79 }
74 80
75 // static 81 // static
76 ContentWebUIControllerFactory* ContentWebUIControllerFactory::GetInstance() { 82 ContentWebUIControllerFactory* ContentWebUIControllerFactory::GetInstance() {
77 return Singleton<ContentWebUIControllerFactory>::get(); 83 return Singleton<ContentWebUIControllerFactory>::get();
78 } 84 }
79 85
80 ContentWebUIControllerFactory::ContentWebUIControllerFactory() { 86 ContentWebUIControllerFactory::ContentWebUIControllerFactory() {
81 } 87 }
82 88
83 ContentWebUIControllerFactory::~ContentWebUIControllerFactory() { 89 ContentWebUIControllerFactory::~ContentWebUIControllerFactory() {
84 } 90 }
85 91
86 } // namespace content 92 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/webui/content_web_ui_controller_factory.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698