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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 &tab_contents_->web_contents()->GetController())); | 220 &tab_contents_->web_contents()->GetController())); |
221 registrar_.Add( | 221 registrar_.Add( |
222 this, | 222 this, |
223 chrome::NOTIFICATION_BROWSER_THEME_CHANGED, | 223 chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
224 content::Source<ThemeService>( | 224 content::Source<ThemeService>( |
225 ThemeServiceFactory::GetForProfile(profile_))); | 225 ThemeServiceFactory::GetForProfile(profile_))); |
226 // There is no inspected_rvh in case of shared workers. | 226 // There is no inspected_rvh in case of shared workers. |
227 if (inspected_rvh) { | 227 if (inspected_rvh) { |
228 WebContents* tab = WebContents::FromRenderViewHost(inspected_rvh); | 228 WebContents* tab = WebContents::FromRenderViewHost(inspected_rvh); |
229 if (tab) | 229 if (tab) |
230 inspected_tab_ = TabContents::GetOwningTabContentsForWebContents(tab); | 230 inspected_tab_ = TabContents::FromWebContents(tab); |
231 } | 231 } |
232 } | 232 } |
233 | 233 |
234 DevToolsWindow::~DevToolsWindow() { | 234 DevToolsWindow::~DevToolsWindow() { |
235 DevToolsWindowList& instances = g_instances.Get(); | 235 DevToolsWindowList& instances = g_instances.Get(); |
236 DevToolsWindowList::iterator it = std::find(instances.begin(), | 236 DevToolsWindowList::iterator it = std::find(instances.begin(), |
237 instances.end(), | 237 instances.end(), |
238 this); | 238 this); |
239 DCHECK(it != instances.end()); | 239 DCHECK(it != instances.end()); |
240 instances.erase(it); | 240 instances.erase(it); |
(...skipping 14 matching lines...) Expand all Loading... |
255 // First, initiate self-destruct to free all the registrars. | 255 // First, initiate self-destruct to free all the registrars. |
256 // Then close all tabs. Browser will take care of deleting tab_contents | 256 // Then close all tabs. Browser will take care of deleting tab_contents |
257 // for us. | 257 // for us. |
258 Browser* browser = browser_; | 258 Browser* browser = browser_; |
259 delete this; | 259 delete this; |
260 browser->CloseAllTabs(); | 260 browser->CloseAllTabs(); |
261 } | 261 } |
262 } | 262 } |
263 | 263 |
264 void DevToolsWindow::ContentsReplaced(WebContents* new_contents) { | 264 void DevToolsWindow::ContentsReplaced(WebContents* new_contents) { |
265 TabContents* new_tab_contents = | 265 TabContents* new_tab_contents = TabContents::FromWebContents(new_contents); |
266 TabContents::GetOwningTabContentsForWebContents(new_contents); | |
267 DCHECK(new_tab_contents); | 266 DCHECK(new_tab_contents); |
268 if (!new_tab_contents) | 267 if (!new_tab_contents) |
269 return; | 268 return; |
270 DCHECK_EQ(profile_, new_tab_contents->profile()); | 269 DCHECK_EQ(profile_, new_tab_contents->profile()); |
271 inspected_tab_ = new_tab_contents; | 270 inspected_tab_ = new_tab_contents; |
272 } | 271 } |
273 | 272 |
274 void DevToolsWindow::Show(DevToolsToggleAction action) { | 273 void DevToolsWindow::Show(DevToolsToggleAction action) { |
275 if (docked_) { | 274 if (docked_) { |
276 Browser* inspected_browser; | 275 Browser* inspected_browser; |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 CallClientFunction("InspectorFrontendAPI.appendedToURL", &url_value); | 749 CallClientFunction("InspectorFrontendAPI.appendedToURL", &url_value); |
751 } | 750 } |
752 | 751 |
753 content::JavaScriptDialogCreator* DevToolsWindow::GetJavaScriptDialogCreator() { | 752 content::JavaScriptDialogCreator* DevToolsWindow::GetJavaScriptDialogCreator() { |
754 if (inspected_tab_ && inspected_tab_->web_contents()->GetDelegate()) { | 753 if (inspected_tab_ && inspected_tab_->web_contents()->GetDelegate()) { |
755 return inspected_tab_->web_contents()->GetDelegate()-> | 754 return inspected_tab_->web_contents()->GetDelegate()-> |
756 GetJavaScriptDialogCreator(); | 755 GetJavaScriptDialogCreator(); |
757 } | 756 } |
758 return content::WebContentsDelegate::GetJavaScriptDialogCreator(); | 757 return content::WebContentsDelegate::GetJavaScriptDialogCreator(); |
759 } | 758 } |
OLD | NEW |