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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 | 558 |
560 DevToolsClientHost* host = manager->GetDevToolsClientHostFor(inspected_rvh); | 559 DevToolsClientHost* host = manager->GetDevToolsClientHostFor(inspected_rvh); |
561 DevToolsWindow* window = AsDevToolsWindow(host); | 560 DevToolsWindow* window = AsDevToolsWindow(host); |
562 if (host != NULL && window == NULL) { | 561 if (host != NULL && window == NULL) { |
563 // Break remote debugging / extension debugging session. | 562 // Break remote debugging / extension debugging session. |
564 manager->UnregisterDevToolsClientHostFor(inspected_rvh); | 563 manager->UnregisterDevToolsClientHostFor(inspected_rvh); |
565 } | 564 } |
566 | 565 |
567 bool do_open = force_open; | 566 bool do_open = force_open; |
568 if (!window) { | 567 if (!window) { |
569 Profile* profile = inspected_rvh->process()->profile(); | 568 Profile* profile = |
| 569 static_cast<Profile*>(inspected_rvh->process()->context()); |
570 bool docked = profile->GetPrefs()->GetBoolean(prefs::kDevToolsOpenDocked); | 570 bool docked = profile->GetPrefs()->GetBoolean(prefs::kDevToolsOpenDocked); |
571 window = new DevToolsWindow(profile, inspected_rvh, docked, false); | 571 window = new DevToolsWindow(profile, inspected_rvh, docked, false); |
572 manager->RegisterDevToolsClientHostFor(inspected_rvh, window); | 572 manager->RegisterDevToolsClientHostFor(inspected_rvh, window); |
573 do_open = true; | 573 do_open = true; |
574 } | 574 } |
575 | 575 |
576 // If window is docked and visible, we hide it on toggle. If window is | 576 // If window is docked and visible, we hide it on toggle. If window is |
577 // undocked, we show (activate) it. | 577 // undocked, we show (activate) it. |
578 if (!window->is_docked() || do_open) | 578 if (!window->is_docked() || do_open) |
579 window->Show(action); | 579 window->Show(action); |
(...skipping 13 matching lines...) Expand all Loading... |
593 return NULL; | 593 return NULL; |
594 } | 594 } |
595 | 595 |
596 content::JavaScriptDialogCreator* DevToolsWindow::GetJavaScriptDialogCreator() { | 596 content::JavaScriptDialogCreator* DevToolsWindow::GetJavaScriptDialogCreator() { |
597 if (inspected_tab_ && inspected_tab_->tab_contents()->delegate()) { | 597 if (inspected_tab_ && inspected_tab_->tab_contents()->delegate()) { |
598 return inspected_tab_->tab_contents()->delegate()-> | 598 return inspected_tab_->tab_contents()->delegate()-> |
599 GetJavaScriptDialogCreator(); | 599 GetJavaScriptDialogCreator(); |
600 } | 600 } |
601 return TabContentsDelegate::GetJavaScriptDialogCreator(); | 601 return TabContentsDelegate::GetJavaScriptDialogCreator(); |
602 } | 602 } |
OLD | NEW |