Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: chrome/browser/debugger/devtools_window.cc

Issue 9473001: Extract minimal RenderViewHost interface for embedders, leaving (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ready for initial review. Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 content::NOTIFICATION_TAB_CLOSING, 213 content::NOTIFICATION_TAB_CLOSING,
214 content::Source<NavigationController>( 214 content::Source<NavigationController>(
215 &tab_contents_->web_contents()->GetController())); 215 &tab_contents_->web_contents()->GetController()));
216 registrar_.Add( 216 registrar_.Add(
217 this, 217 this,
218 chrome::NOTIFICATION_BROWSER_THEME_CHANGED, 218 chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
219 content::Source<ThemeService>( 219 content::Source<ThemeService>(
220 ThemeServiceFactory::GetForProfile(profile_))); 220 ThemeServiceFactory::GetForProfile(profile_)));
221 // There is no inspected_rvh in case of shared workers. 221 // There is no inspected_rvh in case of shared workers.
222 if (inspected_rvh) { 222 if (inspected_rvh) {
223 WebContents* tab = inspected_rvh->delegate()->GetAsWebContents(); 223 WebContents* tab = inspected_rvh->GetDelegate()->GetAsWebContents();
224 if (tab) 224 if (tab)
225 inspected_tab_ = TabContentsWrapper::GetCurrentWrapperForContents(tab); 225 inspected_tab_ = TabContentsWrapper::GetCurrentWrapperForContents(tab);
226 } 226 }
227 } 227 }
228 228
229 DevToolsWindow::~DevToolsWindow() { 229 DevToolsWindow::~DevToolsWindow() {
230 DevToolsWindowList& instances = g_instances.Get(); 230 DevToolsWindowList& instances = g_instances.Get();
231 DevToolsWindowList::iterator it = std::find(instances.begin(), 231 DevToolsWindowList::iterator it = std::find(instances.begin(),
232 instances.end(), 232 instances.end(),
233 this); 233 this);
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 DevToolsClientHost* host = manager->GetDevToolsClientHostFor(agent); 630 DevToolsClientHost* host = manager->GetDevToolsClientHostFor(agent);
631 DevToolsWindow* window = AsDevToolsWindow(host); 631 DevToolsWindow* window = AsDevToolsWindow(host);
632 if (host != NULL && window == NULL) { 632 if (host != NULL && window == NULL) {
633 // Break remote debugging / extension debugging session. 633 // Break remote debugging / extension debugging session.
634 manager->UnregisterDevToolsClientHostFor(agent); 634 manager->UnregisterDevToolsClientHostFor(agent);
635 } 635 }
636 636
637 bool do_open = force_open; 637 bool do_open = force_open;
638 if (!window) { 638 if (!window) {
639 Profile* profile = Profile::FromBrowserContext( 639 Profile* profile = Profile::FromBrowserContext(
640 inspected_rvh->process()->GetBrowserContext()); 640 inspected_rvh->GetProcess()->GetBrowserContext());
641 bool docked = profile->GetPrefs()->GetBoolean(prefs::kDevToolsOpenDocked); 641 bool docked = profile->GetPrefs()->GetBoolean(prefs::kDevToolsOpenDocked);
642 window = Create(profile, inspected_rvh, docked, false); 642 window = Create(profile, inspected_rvh, docked, false);
643 manager->RegisterDevToolsClientHostFor(agent, window->frontend_host_); 643 manager->RegisterDevToolsClientHostFor(agent, window->frontend_host_);
644 do_open = true; 644 do_open = true;
645 } 645 }
646 646
647 // If window is docked and visible, we hide it on toggle. If window is 647 // If window is docked and visible, we hide it on toggle. If window is
648 // undocked, we show (activate) it. 648 // undocked, we show (activate) it.
649 if (!window->is_docked() || do_open) 649 if (!window->is_docked() || do_open)
650 window->Show(action); 650 window->Show(action);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 content); 741 content);
742 } 742 }
743 743
744 content::JavaScriptDialogCreator* DevToolsWindow::GetJavaScriptDialogCreator() { 744 content::JavaScriptDialogCreator* DevToolsWindow::GetJavaScriptDialogCreator() {
745 if (inspected_tab_ && inspected_tab_->web_contents()->GetDelegate()) { 745 if (inspected_tab_ && inspected_tab_->web_contents()->GetDelegate()) {
746 return inspected_tab_->web_contents()->GetDelegate()-> 746 return inspected_tab_->web_contents()->GetDelegate()->
747 GetJavaScriptDialogCreator(); 747 GetJavaScriptDialogCreator();
748 } 748 }
749 return content::WebContentsDelegate::GetJavaScriptDialogCreator(); 749 return content::WebContentsDelegate::GetJavaScriptDialogCreator();
750 } 750 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698