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/web_contents/debug_urls.h" | 5 #include "content/browser/web_contents/debug_urls.h" |
6 | 6 |
| 7 #include <vector> |
| 8 |
| 9 #include "base/utf_string_conversions.h" |
7 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 10 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
| 11 #include "content/browser/ppapi_plugin_process_host.h" |
| 12 #include "content/public/browser/browser_thread.h" |
8 #include "content/public/common/url_constants.h" | 13 #include "content/public/common/url_constants.h" |
9 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
| 15 #include "ppapi/proxy/ppapi_messages.h" |
| 16 #include "webkit/plugins/plugin_constants.h" |
10 | 17 |
11 namespace content { | 18 namespace content { |
12 | 19 |
| 20 namespace { |
| 21 |
| 22 void HandlePpapiFlashDebugURL(const GURL& url) { |
| 23 #if defined(ENABLE_PLUGINS) |
| 24 bool crash = url == GURL(chrome::kChromeUIPpapiFlashCrashURL); |
| 25 |
| 26 std::vector<PpapiPluginProcessHost*> hosts; |
| 27 PpapiPluginProcessHost::FindByName(UTF8ToUTF16(kFlashPluginName), &hosts); |
| 28 for (std::vector<PpapiPluginProcessHost*>::iterator iter = hosts.begin(); |
| 29 iter != hosts.end(); ++iter) { |
| 30 if (crash) |
| 31 (*iter)->Send(new PpapiMsg_Crash()); |
| 32 else |
| 33 (*iter)->Send(new PpapiMsg_Hang()); |
| 34 } |
| 35 #endif |
| 36 } |
| 37 |
| 38 } // namespace |
| 39 |
13 bool HandleDebugURL(const GURL& url, PageTransition transition) { | 40 bool HandleDebugURL(const GURL& url, PageTransition transition) { |
14 // Ensure that the user explicitly navigated to this URL. | 41 // Ensure that the user explicitly navigated to this URL. |
15 if (!(transition & PAGE_TRANSITION_FROM_ADDRESS_BAR)) | 42 if (!(transition & PAGE_TRANSITION_FROM_ADDRESS_BAR)) |
16 return false; | 43 return false; |
17 | 44 |
18 if (url.host() == chrome::kChromeUIBrowserCrashHost) { | 45 if (url.host() == chrome::kChromeUIBrowserCrashHost) { |
19 // Induce an intentional crash in the browser process. | 46 // Induce an intentional crash in the browser process. |
20 CHECK(false); | 47 CHECK(false); |
21 return true; | 48 return true; |
22 } | 49 } |
(...skipping 12 matching lines...) Expand all Loading... |
35 return true; | 62 return true; |
36 } | 63 } |
37 | 64 |
38 if (url == GURL(chrome::kChromeUIGpuHangURL)) { | 65 if (url == GURL(chrome::kChromeUIGpuHangURL)) { |
39 GpuProcessHostUIShim* shim = GpuProcessHostUIShim::GetOneInstance(); | 66 GpuProcessHostUIShim* shim = GpuProcessHostUIShim::GetOneInstance(); |
40 if (shim) | 67 if (shim) |
41 shim->SimulateHang(); | 68 shim->SimulateHang(); |
42 return true; | 69 return true; |
43 } | 70 } |
44 | 71 |
| 72 if (url == GURL(chrome::kChromeUIPpapiFlashCrashURL) || |
| 73 url == GURL(chrome::kChromeUIPpapiFlashHangURL)) { |
| 74 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 75 base::Bind(&HandlePpapiFlashDebugURL, url)); |
| 76 return true; |
| 77 } |
| 78 |
45 return false; | 79 return false; |
46 } | 80 } |
47 | 81 |
48 } // namespace content | 82 } // namespace content |
OLD | NEW |