OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 content::NOTIFICATION_TAB_CLOSING, | 215 content::NOTIFICATION_TAB_CLOSING, |
216 content::Source<NavigationController>( | 216 content::Source<NavigationController>( |
217 &tab_contents_->web_contents()->GetController())); | 217 &tab_contents_->web_contents()->GetController())); |
218 registrar_.Add( | 218 registrar_.Add( |
219 this, | 219 this, |
220 chrome::NOTIFICATION_BROWSER_THEME_CHANGED, | 220 chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
221 content::Source<ThemeService>( | 221 content::Source<ThemeService>( |
222 ThemeServiceFactory::GetForProfile(profile_))); | 222 ThemeServiceFactory::GetForProfile(profile_))); |
223 // There is no inspected_rvh in case of shared workers. | 223 // There is no inspected_rvh in case of shared workers. |
224 if (inspected_rvh) { | 224 if (inspected_rvh) { |
225 WebContents* tab = inspected_rvh->delegate()->GetAsWebContents(); | 225 WebContents* tab = inspected_rvh->GetDelegate()->GetAsWebContents(); |
226 if (tab) | 226 if (tab) |
227 inspected_tab_ = TabContentsWrapper::GetCurrentWrapperForContents(tab); | 227 inspected_tab_ = TabContentsWrapper::GetCurrentWrapperForContents(tab); |
228 } | 228 } |
229 } | 229 } |
230 | 230 |
231 DevToolsWindow::~DevToolsWindow() { | 231 DevToolsWindow::~DevToolsWindow() { |
232 DevToolsWindowList& instances = g_instances.Get(); | 232 DevToolsWindowList& instances = g_instances.Get(); |
233 DevToolsWindowList::iterator it = std::find(instances.begin(), | 233 DevToolsWindowList::iterator it = std::find(instances.begin(), |
234 instances.end(), | 234 instances.end(), |
235 this); | 235 this); |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 DevToolsClientHost* host = manager->GetDevToolsClientHostFor(agent); | 632 DevToolsClientHost* host = manager->GetDevToolsClientHostFor(agent); |
633 DevToolsWindow* window = AsDevToolsWindow(host); | 633 DevToolsWindow* window = AsDevToolsWindow(host); |
634 if (host != NULL && window == NULL) { | 634 if (host != NULL && window == NULL) { |
635 // Break remote debugging / extension debugging session. | 635 // Break remote debugging / extension debugging session. |
636 manager->UnregisterDevToolsClientHostFor(agent); | 636 manager->UnregisterDevToolsClientHostFor(agent); |
637 } | 637 } |
638 | 638 |
639 bool do_open = force_open; | 639 bool do_open = force_open; |
640 if (!window) { | 640 if (!window) { |
641 Profile* profile = Profile::FromBrowserContext( | 641 Profile* profile = Profile::FromBrowserContext( |
642 inspected_rvh->process()->GetBrowserContext()); | 642 inspected_rvh->GetProcess()->GetBrowserContext()); |
643 bool docked = profile->GetPrefs()->GetBoolean(prefs::kDevToolsOpenDocked); | 643 bool docked = profile->GetPrefs()->GetBoolean(prefs::kDevToolsOpenDocked); |
644 window = Create(profile, inspected_rvh, docked, false); | 644 window = Create(profile, inspected_rvh, docked, false); |
645 manager->RegisterDevToolsClientHostFor(agent, window->frontend_host_); | 645 manager->RegisterDevToolsClientHostFor(agent, window->frontend_host_); |
646 do_open = true; | 646 do_open = true; |
647 } | 647 } |
648 | 648 |
649 // If window is docked and visible, we hide it on toggle. If window is | 649 // If window is docked and visible, we hide it on toggle. If window is |
650 // undocked, we show (activate) it. | 650 // undocked, we show (activate) it. |
651 if (!window->is_docked() || do_open) | 651 if (!window->is_docked() || do_open) |
652 window->Show(action); | 652 window->Show(action); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 content); | 743 content); |
744 } | 744 } |
745 | 745 |
746 content::JavaScriptDialogCreator* DevToolsWindow::GetJavaScriptDialogCreator() { | 746 content::JavaScriptDialogCreator* DevToolsWindow::GetJavaScriptDialogCreator() { |
747 if (inspected_tab_ && inspected_tab_->web_contents()->GetDelegate()) { | 747 if (inspected_tab_ && inspected_tab_->web_contents()->GetDelegate()) { |
748 return inspected_tab_->web_contents()->GetDelegate()-> | 748 return inspected_tab_->web_contents()->GetDelegate()-> |
749 GetJavaScriptDialogCreator(); | 749 GetJavaScriptDialogCreator(); |
750 } | 750 } |
751 return content::WebContentsDelegate::GetJavaScriptDialogCreator(); | 751 return content::WebContentsDelegate::GetJavaScriptDialogCreator(); |
752 } | 752 } |
OLD | NEW |