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