OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/json/json_writer.h" | 6 #include "base/json/json_writer.h" |
7 #include "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 if ((*extension)->devtools_url().is_empty()) | 306 if ((*extension)->devtools_url().is_empty()) |
307 continue; | 307 continue; |
308 DictionaryValue* extension_info = new DictionaryValue(); | 308 DictionaryValue* extension_info = new DictionaryValue(); |
309 extension_info->Set("startPage", | 309 extension_info->Set("startPage", |
310 new StringValue((*extension)->devtools_url().spec())); | 310 new StringValue((*extension)->devtools_url().spec())); |
311 results.Append(extension_info); | 311 results.Append(extension_info); |
312 } | 312 } |
313 CallClientFunction(ASCIIToUTF16("WebInspector.addExtensions"), results); | 313 CallClientFunction(ASCIIToUTF16("WebInspector.addExtensions"), results); |
314 } | 314 } |
315 | 315 |
| 316 void DevToolsWindow::OpenURLFromTab(TabContents* source, |
| 317 const GURL& url, |
| 318 const GURL& referrer, |
| 319 WindowOpenDisposition disposition, |
| 320 PageTransition::Type transition) { |
| 321 if (inspected_tab_) |
| 322 inspected_tab_->OpenURL(url, |
| 323 GURL(), |
| 324 NEW_FOREGROUND_TAB, |
| 325 PageTransition::LINK); |
| 326 } |
| 327 |
316 void DevToolsWindow::CallClientFunction(const string16& function_name, | 328 void DevToolsWindow::CallClientFunction(const string16& function_name, |
317 const Value& arg) { | 329 const Value& arg) { |
318 std::string json; | 330 std::string json; |
319 base::JSONWriter::Write(&arg, false, &json); | 331 base::JSONWriter::Write(&arg, false, &json); |
320 string16 javascript = function_name + char16('(') + UTF8ToUTF16(json) + | 332 string16 javascript = function_name + char16('(') + UTF8ToUTF16(json) + |
321 ASCIIToUTF16(");"); | 333 ASCIIToUTF16(");"); |
322 tab_contents_->render_view_host()-> | 334 tab_contents_->render_view_host()-> |
323 ExecuteJavascriptInWebFrame(string16(), javascript); | 335 ExecuteJavascriptInWebFrame(string16(), javascript); |
324 } | 336 } |
325 | 337 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 return false; | 453 return false; |
442 } | 454 } |
443 | 455 |
444 void DevToolsWindow::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { | 456 void DevToolsWindow::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { |
445 if (docked_) { | 457 if (docked_) { |
446 BrowserWindow* inspected_window = GetInspectedBrowserWindow(); | 458 BrowserWindow* inspected_window = GetInspectedBrowserWindow(); |
447 if (inspected_window) | 459 if (inspected_window) |
448 inspected_window->HandleKeyboardEvent(event); | 460 inspected_window->HandleKeyboardEvent(event); |
449 } | 461 } |
450 } | 462 } |
OLD | NEW |