OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser_url_handler_impl.h" | 5 #include "content/browser/browser_url_handler_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "cc/base/switches.h" |
9 #include "content/browser/frame_host/debug_urls.h" | 10 #include "content/browser/frame_host/debug_urls.h" |
10 #include "content/browser/webui/web_ui_impl.h" | 11 #include "content/browser/webui/web_ui_impl.h" |
11 #include "content/public/browser/content_browser_client.h" | 12 #include "content/public/browser/content_browser_client.h" |
12 #include "content/public/common/content_switches.h" | |
13 #include "content/public/common/url_constants.h" | 13 #include "content/public/common/url_constants.h" |
14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 | 17 |
18 // Handles rewriting view-source URLs for what we'll actually load. | 18 // Handles rewriting view-source URLs for what we'll actually load. |
19 static bool HandleViewSource(GURL* url, BrowserContext* browser_context) { | 19 static bool HandleViewSource(GURL* url, BrowserContext* browser_context) { |
20 if (url->SchemeIs(kViewSourceScheme)) { | 20 if (url->SchemeIs(kViewSourceScheme)) { |
21 // Load the inner URL instead. | 21 // Load the inner URL instead. |
22 *url = GURL(url->GetContent()); | 22 *url = GURL(url->GetContent()); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 *url = url->ReplaceComponents(repl); | 69 *url = url->ReplaceComponents(repl); |
70 return true; | 70 return true; |
71 } | 71 } |
72 | 72 |
73 static bool DebugURLHandler(GURL* url, BrowserContext* browser_context) { | 73 static bool DebugURLHandler(GURL* url, BrowserContext* browser_context) { |
74 // If running inside the Telemetry test harness, allow automated | 74 // If running inside the Telemetry test harness, allow automated |
75 // navigations to access browser-side debug URLs. They must use the | 75 // navigations to access browser-side debug URLs. They must use the |
76 // chrome:// scheme, since the about: scheme won't be rewritten in | 76 // chrome:// scheme, since the about: scheme won't be rewritten in |
77 // this code path. | 77 // this code path. |
78 if (CommandLine::ForCurrentProcess()->HasSwitch( | 78 if (CommandLine::ForCurrentProcess()->HasSwitch( |
79 switches::kEnableGpuBenchmarking)) { | 79 cc::switches::kEnableGpuBenchmarking)) { |
80 if (HandleDebugURL(*url, PAGE_TRANSITION_FROM_ADDRESS_BAR)) { | 80 if (HandleDebugURL(*url, PAGE_TRANSITION_FROM_ADDRESS_BAR)) { |
81 return true; | 81 return true; |
82 } | 82 } |
83 } | 83 } |
84 | 84 |
85 // Circumvent processing URLs that the renderer process will handle. | 85 // Circumvent processing URLs that the renderer process will handle. |
86 return *url == GURL(kChromeUICrashURL) || | 86 return *url == GURL(kChromeUICrashURL) || |
87 *url == GURL(kChromeUIHangURL) || | 87 *url == GURL(kChromeUIHangURL) || |
88 *url == GURL(kChromeUIKillURL) || | 88 *url == GURL(kChromeUIKillURL) || |
89 *url == GURL(kChromeUIShorthangURL); | 89 *url == GURL(kChromeUIShorthangURL); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 return true; | 147 return true; |
148 } else if (handler(&test_url, browser_context)) { | 148 } else if (handler(&test_url, browser_context)) { |
149 return reverse_rewriter(url, browser_context); | 149 return reverse_rewriter(url, browser_context); |
150 } | 150 } |
151 } | 151 } |
152 } | 152 } |
153 return false; | 153 return false; |
154 } | 154 } |
155 | 155 |
156 } // namespace content | 156 } // namespace content |
OLD | NEW |