| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/frame_host/debug_urls.h" | 5 #include "content/browser/frame_host/debug_urls.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 10 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #endif | 36 #endif |
| 37 } | 37 } |
| 38 | 38 |
| 39 } // namespace | 39 } // namespace |
| 40 | 40 |
| 41 bool HandleDebugURL(const GURL& url, PageTransition transition) { | 41 bool HandleDebugURL(const GURL& url, PageTransition transition) { |
| 42 // Ensure that the user explicitly navigated to this URL. | 42 // Ensure that the user explicitly navigated to this URL. |
| 43 if (!(transition & PAGE_TRANSITION_FROM_ADDRESS_BAR)) | 43 if (!(transition & PAGE_TRANSITION_FROM_ADDRESS_BAR)) |
| 44 return false; | 44 return false; |
| 45 | 45 |
| 46 // NOTE: when you add handling of any URLs to this function, also |
| 47 // update IsDebugURL, below. |
| 48 |
| 46 if (url.host() == kChromeUIBrowserCrashHost) { | 49 if (url.host() == kChromeUIBrowserCrashHost) { |
| 47 // Induce an intentional crash in the browser process. | 50 // Induce an intentional crash in the browser process. |
| 48 CHECK(false); | 51 CHECK(false); |
| 49 return true; | 52 return true; |
| 50 } | 53 } |
| 51 | 54 |
| 52 if (url == GURL(kChromeUIGpuCleanURL)) { | 55 if (url == GURL(kChromeUIGpuCleanURL)) { |
| 53 GpuProcessHostUIShim* shim = GpuProcessHostUIShim::GetOneInstance(); | 56 GpuProcessHostUIShim* shim = GpuProcessHostUIShim::GetOneInstance(); |
| 54 if (shim) | 57 if (shim) |
| 55 shim->SimulateRemoveAllContext(); | 58 shim->SimulateRemoveAllContext(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 73 if (url == GURL(kChromeUIPpapiFlashCrashURL) || | 76 if (url == GURL(kChromeUIPpapiFlashCrashURL) || |
| 74 url == GURL(kChromeUIPpapiFlashHangURL)) { | 77 url == GURL(kChromeUIPpapiFlashHangURL)) { |
| 75 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 78 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 76 base::Bind(&HandlePpapiFlashDebugURL, url)); | 79 base::Bind(&HandlePpapiFlashDebugURL, url)); |
| 77 return true; | 80 return true; |
| 78 } | 81 } |
| 79 | 82 |
| 80 return false; | 83 return false; |
| 81 } | 84 } |
| 82 | 85 |
| 86 bool IsDebugURL(const GURL& url) { |
| 87 // NOTE: when you add any URLs to this list, also update |
| 88 // HandleDebugURL, above. |
| 89 return IsRendererDebugURL(url) || |
| 90 (url.is_valid() && |
| 91 (url.host() == kChromeUIBrowserCrashHost || |
| 92 url == GURL(kChromeUIGpuCleanURL) || |
| 93 url == GURL(kChromeUIGpuCrashURL) || |
| 94 url == GURL(kChromeUIGpuHangURL) || |
| 95 url == GURL(kChromeUIPpapiFlashCrashURL) || |
| 96 url == GURL(kChromeUIPpapiFlashHangURL))); |
| 97 } |
| 98 |
| 83 bool IsRendererDebugURL(const GURL& url) { | 99 bool IsRendererDebugURL(const GURL& url) { |
| 84 if (!url.is_valid()) | 100 if (!url.is_valid()) |
| 85 return false; | 101 return false; |
| 86 | 102 |
| 87 if (url.SchemeIs(kJavaScriptScheme)) | 103 if (url.SchemeIs(kJavaScriptScheme)) |
| 88 return true; | 104 return true; |
| 89 | 105 |
| 90 return url == GURL(kChromeUICrashURL) || | 106 return url == GURL(kChromeUICrashURL) || |
| 91 url == GURL(kChromeUIKillURL) || | 107 url == GURL(kChromeUIKillURL) || |
| 92 url == GURL(kChromeUIHangURL) || | 108 url == GURL(kChromeUIHangURL) || |
| 93 url == GURL(kChromeUIShorthangURL); | 109 url == GURL(kChromeUIShorthangURL); |
| 94 } | 110 } |
| 95 | 111 |
| 96 } // namespace content | 112 } // namespace content |
| OLD | NEW |