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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
7 #include "base/process/process.h" | 7 #include "base/process/process.h" |
8 #include "base/test/test_timeouts.h" | 8 #include "base/test/test_timeouts.h" |
9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/browser/devtools/devtools_window.h" | 10 #include "chrome/browser/devtools/devtools_window.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 } | 47 } |
48 return count; | 48 return count; |
49 } | 49 } |
50 | 50 |
51 WebContents* FindFirstDevToolsContents() { | 51 WebContents* FindFirstDevToolsContents() { |
52 scoped_ptr<content::RenderWidgetHostIterator> widgets( | 52 scoped_ptr<content::RenderWidgetHostIterator> widgets( |
53 RenderWidgetHost::GetRenderWidgetHosts()); | 53 RenderWidgetHost::GetRenderWidgetHosts()); |
54 while (content::RenderWidgetHost* widget = widgets->GetNextHost()) { | 54 while (content::RenderWidgetHost* widget = widgets->GetNextHost()) { |
55 if (!widget->GetProcess()->HasConnection()) | 55 if (!widget->GetProcess()->HasConnection()) |
56 continue; | 56 continue; |
57 if (!widget->IsRenderView()) | 57 RenderViewHost* view_host = RenderViewHost::From(widget); |
| 58 if (!view_host) |
58 continue; | 59 continue; |
59 RenderViewHost* host = RenderViewHost::From(widget); | 60 WebContents* contents = WebContents::FromRenderViewHost(view_host); |
60 WebContents* contents = WebContents::FromRenderViewHost(host); | |
61 GURL url = contents->GetURL(); | 61 GURL url = contents->GetURL(); |
62 if (url.SchemeIs(content::kChromeDevToolsScheme)) | 62 if (url.SchemeIs(content::kChromeDevToolsScheme)) |
63 return contents; | 63 return contents; |
64 } | 64 } |
65 return NULL; | 65 return NULL; |
66 } | 66 } |
67 | 67 |
68 // TODO(rvargas) crbug.com/417532: Remove this code. | 68 // TODO(rvargas) crbug.com/417532: Remove this code. |
69 base::Process ProcessFromHandle(base::ProcessHandle handle) { | 69 base::Process ProcessFromHandle(base::ProcessHandle handle) { |
70 #if defined(OS_WIN) | 70 #if defined(OS_WIN) |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 content::ExecuteScript(audio_tab_web_contents_, | 677 content::ExecuteScript(audio_tab_web_contents_, |
678 "document.getElementById('audioPlayer').play();")); | 678 "document.getElementById('audioPlayer').play();")); |
679 | 679 |
680 // Wait until the two pages are not backgrounded. | 680 // Wait until the two pages are not backgrounded. |
681 while (no_audio_process_.IsProcessBackgrounded() || | 681 while (no_audio_process_.IsProcessBackgrounded() || |
682 audio_process_.IsProcessBackgrounded()) { | 682 audio_process_.IsProcessBackgrounded()) { |
683 base::RunLoop().RunUntilIdle(); | 683 base::RunLoop().RunUntilIdle(); |
684 base::PlatformThread::Sleep(TestTimeouts::tiny_timeout()); | 684 base::PlatformThread::Sleep(TestTimeouts::tiny_timeout()); |
685 } | 685 } |
686 } | 686 } |
OLD | NEW |