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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 void DevToolsWindow::UpdateFrontendAttachedState() { | 366 void DevToolsWindow::UpdateFrontendAttachedState() { |
367 tab_contents_->render_view_host()->ExecuteJavascriptInWebFrame( | 367 tab_contents_->render_view_host()->ExecuteJavascriptInWebFrame( |
368 string16(), | 368 string16(), |
369 docked_ ? ASCIIToUTF16("WebInspector.setAttachedWindow(true);") | 369 docked_ ? ASCIIToUTF16("WebInspector.setAttachedWindow(true);") |
370 : ASCIIToUTF16("WebInspector.setAttachedWindow(false);")); | 370 : ASCIIToUTF16("WebInspector.setAttachedWindow(false);")); |
371 } | 371 } |
372 | 372 |
373 | 373 |
374 void DevToolsWindow::AddDevToolsExtensionsToClient() { | 374 void DevToolsWindow::AddDevToolsExtensionsToClient() { |
375 if (inspected_tab_) { | 375 if (inspected_tab_) { |
376 base::FundamentalValue tabId( | 376 base::NumberValue tab_id( |
377 inspected_tab_->restore_tab_helper()->session_id().id()); | 377 inspected_tab_->restore_tab_helper()->session_id().id()); |
378 CallClientFunction(ASCIIToUTF16("WebInspector.setInspectedTabId"), tabId); | 378 CallClientFunction(ASCIIToUTF16("WebInspector.setInspectedTabId"), tab_id); |
379 } | 379 } |
380 ListValue results; | 380 ListValue results; |
381 const ExtensionService* extension_service = | 381 const ExtensionService* extension_service = |
382 tab_contents_->profile()->GetOriginalProfile()->GetExtensionService(); | 382 tab_contents_->profile()->GetOriginalProfile()->GetExtensionService(); |
383 if (!extension_service) | 383 if (!extension_service) |
384 return; | 384 return; |
385 | 385 |
386 const ExtensionList* extensions = extension_service->extensions(); | 386 const ExtensionList* extensions = extension_service->extensions(); |
387 | 387 |
388 for (ExtensionList::const_iterator extension = extensions->begin(); | 388 for (ExtensionList::const_iterator extension = extensions->begin(); |
389 extension != extensions->end(); ++extension) { | 389 extension != extensions->end(); ++extension) { |
390 if ((*extension)->devtools_url().is_empty()) | 390 if ((*extension)->devtools_url().is_empty()) |
391 continue; | 391 continue; |
392 DictionaryValue* extension_info = new DictionaryValue(); | 392 DictionaryValue* extension_info = new DictionaryValue(); |
393 extension_info->Set("startPage", | 393 extension_info->Set("startPage", |
394 new StringValue((*extension)->devtools_url().spec())); | 394 base::StringValue::New((*extension)->devtools_url().spec())); |
395 results.Append(extension_info); | 395 results.Append(extension_info); |
396 } | 396 } |
397 CallClientFunction(ASCIIToUTF16("WebInspector.addExtensions"), results); | 397 CallClientFunction(ASCIIToUTF16("WebInspector.addExtensions"), results); |
398 } | 398 } |
399 | 399 |
400 // TODO(adriansc): Remove this method once refactoring changed all call sites. | 400 // TODO(adriansc): Remove this method once refactoring changed all call sites. |
401 TabContents* DevToolsWindow::OpenURLFromTab(TabContents* source, | 401 TabContents* DevToolsWindow::OpenURLFromTab(TabContents* source, |
402 const GURL& url, | 402 const GURL& url, |
403 const GURL& referrer, | 403 const GURL& referrer, |
404 WindowOpenDisposition disposition, | 404 WindowOpenDisposition disposition, |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 return NULL; | 602 return NULL; |
603 } | 603 } |
604 | 604 |
605 content::JavaScriptDialogCreator* DevToolsWindow::GetJavaScriptDialogCreator() { | 605 content::JavaScriptDialogCreator* DevToolsWindow::GetJavaScriptDialogCreator() { |
606 if (inspected_tab_ && inspected_tab_->tab_contents()->delegate()) { | 606 if (inspected_tab_ && inspected_tab_->tab_contents()->delegate()) { |
607 return inspected_tab_->tab_contents()->delegate()-> | 607 return inspected_tab_->tab_contents()->delegate()-> |
608 GetJavaScriptDialogCreator(); | 608 GetJavaScriptDialogCreator(); |
609 } | 609 } |
610 return TabContentsDelegate::GetJavaScriptDialogCreator(); | 610 return TabContentsDelegate::GetJavaScriptDialogCreator(); |
611 } | 611 } |
OLD | NEW |