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

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

Issue 2478573004: Convert GURL::{host,path} to GURL::{host_piece,path_piece} for ==. (Closed)
Patch Set: rebase to #431874 Created 4 years, 1 month 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
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 "build/build_config.h" 7 #include "build/build_config.h"
8 #include "content/browser/accessibility/accessibility_ui.h" 8 #include "content/browser/accessibility/accessibility_ui.h"
9 #include "content/browser/appcache/appcache_internals_ui.h" 9 #include "content/browser/appcache/appcache_internals_ui.h"
10 #include "content/browser/gpu/gpu_internals_ui.h" 10 #include "content/browser/gpu/gpu_internals_ui.h"
(...skipping 11 matching lines...) Expand all
22 #include "content/browser/webrtc/webrtc_internals_ui.h" 22 #include "content/browser/webrtc/webrtc_internals_ui.h"
23 #endif 23 #endif
24 24
25 namespace content { 25 namespace content {
26 26
27 WebUI::TypeID ContentWebUIControllerFactory::GetWebUIType( 27 WebUI::TypeID ContentWebUIControllerFactory::GetWebUIType(
28 BrowserContext* browser_context, const GURL& url) const { 28 BrowserContext* browser_context, const GURL& url) const {
29 if (!url.SchemeIs(kChromeUIScheme)) 29 if (!url.SchemeIs(kChromeUIScheme))
30 return WebUI::kNoWebUI; 30 return WebUI::kNoWebUI;
31 31
32 if (url.host() == kChromeUIWebRTCInternalsHost || 32 if (url.host_piece() == kChromeUIWebRTCInternalsHost ||
33 #if !defined(OS_ANDROID) 33 #if !defined(OS_ANDROID)
34 url.host() == kChromeUITracingHost || 34 url.host_piece() == kChromeUITracingHost ||
35 #endif 35 #endif
36 url.host() == kChromeUIGpuHost || 36 url.host_piece() == kChromeUIGpuHost ||
37 url.host() == kChromeUIIndexedDBInternalsHost || 37 url.host_piece() == kChromeUIIndexedDBInternalsHost ||
38 url.host() == kChromeUIMediaInternalsHost || 38 url.host_piece() == kChromeUIMediaInternalsHost ||
39 url.host() == kChromeUIServiceWorkerInternalsHost || 39 url.host_piece() == kChromeUIServiceWorkerInternalsHost ||
40 url.host() == kChromeUIAccessibilityHost || 40 url.host_piece() == kChromeUIAccessibilityHost ||
41 url.host() == kChromeUIAppCacheInternalsHost || 41 url.host_piece() == kChromeUIAppCacheInternalsHost ||
42 url.host() == kChromeUINetworkErrorsListingHost) { 42 url.host_piece() == kChromeUINetworkErrorsListingHost) {
43 return const_cast<ContentWebUIControllerFactory*>(this); 43 return const_cast<ContentWebUIControllerFactory*>(this);
44 } 44 }
45 return WebUI::kNoWebUI; 45 return WebUI::kNoWebUI;
46 } 46 }
47 47
48 bool ContentWebUIControllerFactory::UseWebUIForURL( 48 bool ContentWebUIControllerFactory::UseWebUIForURL(
49 BrowserContext* browser_context, const GURL& url) const { 49 BrowserContext* browser_context, const GURL& url) const {
50 return GetWebUIType(browser_context, url) != WebUI::kNoWebUI; 50 return GetWebUIType(browser_context, url) != WebUI::kNoWebUI;
51 } 51 }
52 52
53 bool ContentWebUIControllerFactory::UseWebUIBindingsForURL( 53 bool ContentWebUIControllerFactory::UseWebUIBindingsForURL(
54 BrowserContext* browser_context, const GURL& url) const { 54 BrowserContext* browser_context, const GURL& url) const {
55 return UseWebUIForURL(browser_context, url); 55 return UseWebUIForURL(browser_context, url);
56 } 56 }
57 57
58 WebUIController* ContentWebUIControllerFactory::CreateWebUIControllerForURL( 58 WebUIController* ContentWebUIControllerFactory::CreateWebUIControllerForURL(
59 WebUI* web_ui, const GURL& url) const { 59 WebUI* web_ui, const GURL& url) const {
60 if (!url.SchemeIs(kChromeUIScheme)) 60 if (!url.SchemeIs(kChromeUIScheme))
61 return nullptr; 61 return nullptr;
62 62
63 if (url.host() == kChromeUIAppCacheInternalsHost) 63 if (url.host_piece() == kChromeUIAppCacheInternalsHost)
64 return new AppCacheInternalsUI(web_ui); 64 return new AppCacheInternalsUI(web_ui);
65 if (url.host() == kChromeUIGpuHost) 65 if (url.host_piece() == kChromeUIGpuHost)
66 return new GpuInternalsUI(web_ui); 66 return new GpuInternalsUI(web_ui);
67 if (url.host() == kChromeUIIndexedDBInternalsHost) 67 if (url.host_piece() == kChromeUIIndexedDBInternalsHost)
68 return new IndexedDBInternalsUI(web_ui); 68 return new IndexedDBInternalsUI(web_ui);
69 if (url.host() == kChromeUIMediaInternalsHost) 69 if (url.host_piece() == kChromeUIMediaInternalsHost)
70 return new MediaInternalsUI(web_ui); 70 return new MediaInternalsUI(web_ui);
71 if (url.host() == kChromeUIAccessibilityHost) 71 if (url.host_piece() == kChromeUIAccessibilityHost)
72 return new AccessibilityUI(web_ui); 72 return new AccessibilityUI(web_ui);
73 if (url.host() == kChromeUIServiceWorkerInternalsHost) 73 if (url.host_piece() == kChromeUIServiceWorkerInternalsHost)
74 return new ServiceWorkerInternalsUI(web_ui); 74 return new ServiceWorkerInternalsUI(web_ui);
75 if (url.host() == kChromeUINetworkErrorsListingHost) 75 if (url.host_piece() == kChromeUINetworkErrorsListingHost)
76 return new NetworkErrorsListingUI(web_ui); 76 return new NetworkErrorsListingUI(web_ui);
77 #if !defined(OS_ANDROID) 77 #if !defined(OS_ANDROID)
78 if (url.host() == kChromeUITracingHost) 78 if (url.host_piece() == kChromeUITracingHost)
79 return new TracingUI(web_ui); 79 return new TracingUI(web_ui);
80 #endif 80 #endif
81 81
82 #if defined(ENABLE_WEBRTC) 82 #if defined(ENABLE_WEBRTC)
83 if (url.host() == kChromeUIWebRTCInternalsHost) 83 if (url.host_piece() == kChromeUIWebRTCInternalsHost)
84 return new WebRTCInternalsUI(web_ui); 84 return new WebRTCInternalsUI(web_ui);
85 #endif 85 #endif
86 86
87 return nullptr; 87 return nullptr;
88 } 88 }
89 89
90 // static 90 // static
91 ContentWebUIControllerFactory* ContentWebUIControllerFactory::GetInstance() { 91 ContentWebUIControllerFactory* ContentWebUIControllerFactory::GetInstance() {
92 return base::Singleton<ContentWebUIControllerFactory>::get(); 92 return base::Singleton<ContentWebUIControllerFactory>::get();
93 } 93 }
94 94
95 ContentWebUIControllerFactory::ContentWebUIControllerFactory() { 95 ContentWebUIControllerFactory::ContentWebUIControllerFactory() {
96 } 96 }
97 97
98 ContentWebUIControllerFactory::~ContentWebUIControllerFactory() { 98 ContentWebUIControllerFactory::~ContentWebUIControllerFactory() {
99 } 99 }
100 100
101 } // namespace content 101 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/net/view_http_cache_job_factory.cc ('k') | content/browser/webui/url_data_manager_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698