OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "app/l10n_util.h" | 5 #include "app/l10n_util.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "chrome/browser/browser.h" | 7 #include "chrome/browser/browser.h" |
8 #include "chrome/browser/browser_list.h" | 8 #include "chrome/browser/browser_list.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/browser_window.h" | 10 #include "chrome/browser/browser_window.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "chrome/common/url_constants.h" | 24 #include "chrome/common/url_constants.h" |
25 #include "grit/generated_resources.h" | 25 #include "grit/generated_resources.h" |
26 | 26 |
27 const std::wstring DevToolsWindow::kDevToolsApp = L"DevToolsApp"; | 27 const std::wstring DevToolsWindow::kDevToolsApp = L"DevToolsApp"; |
28 | 28 |
29 // static | 29 // static |
30 TabContents* DevToolsWindow::GetDevToolsContents(TabContents* inspected_tab) { | 30 TabContents* DevToolsWindow::GetDevToolsContents(TabContents* inspected_tab) { |
31 if (!inspected_tab) { | 31 if (!inspected_tab) { |
32 return NULL; | 32 return NULL; |
33 } | 33 } |
| 34 |
| 35 if (!DevToolsManager::GetInstance()) |
| 36 return NULL; // Happens only in tests. |
| 37 |
34 DevToolsClientHost* client_host = DevToolsManager::GetInstance()-> | 38 DevToolsClientHost* client_host = DevToolsManager::GetInstance()-> |
35 GetDevToolsClientHostFor(inspected_tab->render_view_host()); | 39 GetDevToolsClientHostFor(inspected_tab->render_view_host()); |
36 if (!client_host) { | 40 if (!client_host) { |
37 return NULL; | 41 return NULL; |
38 } | 42 } |
39 | 43 |
40 DevToolsWindow* window = client_host->AsDevToolsWindow(); | 44 DevToolsWindow* window = client_host->AsDevToolsWindow(); |
41 if (!window || !window->is_docked()) { | 45 if (!window || !window->is_docked()) { |
42 return NULL; | 46 return NULL; |
43 } | 47 } |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 NotifyCloseListener(); | 240 NotifyCloseListener(); |
237 delete this; | 241 delete this; |
238 } | 242 } |
239 } | 243 } |
240 } | 244 } |
241 | 245 |
242 void DevToolsWindow::OpenConsole() { | 246 void DevToolsWindow::OpenConsole() { |
243 tab_contents_->render_view_host()-> | 247 tab_contents_->render_view_host()-> |
244 ExecuteJavascriptInWebFrame(L"", L"WebInspector.showConsole();"); | 248 ExecuteJavascriptInWebFrame(L"", L"WebInspector.showConsole();"); |
245 } | 249 } |
OLD | NEW |