| 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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 | 372 |
| 373 | 373 |
| 374 void DevToolsWindow::AddDevToolsExtensionsToClient() { | 374 void DevToolsWindow::AddDevToolsExtensionsToClient() { |
| 375 if (inspected_tab_) { | 375 if (inspected_tab_) { |
| 376 FundamentalValue tabId( | 376 FundamentalValue tabId( |
| 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"), tabId); |
| 379 } | 379 } |
| 380 ListValue results; | 380 ListValue results; |
| 381 const ExtensionService* extension_service = | 381 const ExtensionService* extension_service = |
| 382 tab_contents_->tab_contents()->profile()-> | 382 tab_contents_->profile()->GetOriginalProfile()->GetExtensionService(); |
| 383 GetOriginalProfile()->GetExtensionService(); | |
| 384 if (!extension_service) | 383 if (!extension_service) |
| 385 return; | 384 return; |
| 386 | 385 |
| 387 const ExtensionList* extensions = extension_service->extensions(); | 386 const ExtensionList* extensions = extension_service->extensions(); |
| 388 | 387 |
| 389 for (ExtensionList::const_iterator extension = extensions->begin(); | 388 for (ExtensionList::const_iterator extension = extensions->begin(); |
| 390 extension != extensions->end(); ++extension) { | 389 extension != extensions->end(); ++extension) { |
| 391 if ((*extension)->devtools_url().is_empty()) | 390 if ((*extension)->devtools_url().is_empty()) |
| 392 continue; | 391 continue; |
| 393 DictionaryValue* extension_info = new DictionaryValue(); | 392 DictionaryValue* extension_info = new DictionaryValue(); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 | 557 |
| 559 DevToolsClientHost* host = manager->GetDevToolsClientHostFor(inspected_rvh); | 558 DevToolsClientHost* host = manager->GetDevToolsClientHostFor(inspected_rvh); |
| 560 DevToolsWindow* window = AsDevToolsWindow(host); | 559 DevToolsWindow* window = AsDevToolsWindow(host); |
| 561 if (host != NULL && window == NULL) { | 560 if (host != NULL && window == NULL) { |
| 562 // Break remote debugging / extension debugging session. | 561 // Break remote debugging / extension debugging session. |
| 563 manager->UnregisterDevToolsClientHostFor(inspected_rvh); | 562 manager->UnregisterDevToolsClientHostFor(inspected_rvh); |
| 564 } | 563 } |
| 565 | 564 |
| 566 bool do_open = force_open; | 565 bool do_open = force_open; |
| 567 if (!window) { | 566 if (!window) { |
| 568 Profile* profile = inspected_rvh->process()->profile(); | 567 Profile* profile = |
| 568 static_cast<Profile*>(inspected_rvh->process()->context()); |
| 569 bool docked = profile->GetPrefs()->GetBoolean(prefs::kDevToolsOpenDocked); | 569 bool docked = profile->GetPrefs()->GetBoolean(prefs::kDevToolsOpenDocked); |
| 570 window = new DevToolsWindow(profile, inspected_rvh, docked, false); | 570 window = new DevToolsWindow(profile, inspected_rvh, docked, false); |
| 571 manager->RegisterDevToolsClientHostFor(inspected_rvh, window); | 571 manager->RegisterDevToolsClientHostFor(inspected_rvh, window); |
| 572 do_open = true; | 572 do_open = true; |
| 573 } | 573 } |
| 574 | 574 |
| 575 // If window is docked and visible, we hide it on toggle. If window is | 575 // If window is docked and visible, we hide it on toggle. If window is |
| 576 // undocked, we show (activate) it. | 576 // undocked, we show (activate) it. |
| 577 if (!window->is_docked() || do_open) | 577 if (!window->is_docked() || do_open) |
| 578 window->Show(action); | 578 window->Show(action); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 592 return NULL; | 592 return NULL; |
| 593 } | 593 } |
| 594 | 594 |
| 595 content::JavaScriptDialogCreator* DevToolsWindow::GetJavaScriptDialogCreator() { | 595 content::JavaScriptDialogCreator* DevToolsWindow::GetJavaScriptDialogCreator() { |
| 596 if (inspected_tab_ && inspected_tab_->tab_contents()->delegate()) { | 596 if (inspected_tab_ && inspected_tab_->tab_contents()->delegate()) { |
| 597 return inspected_tab_->tab_contents()->delegate()-> | 597 return inspected_tab_->tab_contents()->delegate()-> |
| 598 GetJavaScriptDialogCreator(); | 598 GetJavaScriptDialogCreator(); |
| 599 } | 599 } |
| 600 return TabContentsDelegate::GetJavaScriptDialogCreator(); | 600 return TabContentsDelegate::GetJavaScriptDialogCreator(); |
| 601 } | 601 } |
| OLD | NEW |