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

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

Issue 10065017: TabContents -> WebContentsImpl, part 8. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
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);
241 } 241 }
242 242
243 void DevToolsWindow::InspectedTabClosing() { 243 void DevToolsWindow::InspectedContentsClosing() {
244 if (docked_) { 244 if (docked_) {
245 // Update dev tools to reflect removed dev tools window. 245 // Update dev tools to reflect removed dev tools window.
246 246
247 BrowserWindow* inspected_window = GetInspectedBrowserWindow(); 247 BrowserWindow* inspected_window = GetInspectedBrowserWindow();
248 if (inspected_window) 248 if (inspected_window)
249 inspected_window->UpdateDevTools(); 249 inspected_window->UpdateDevTools();
250 // In case of docked tab_contents we own it, so delete here. 250 // In case of docked tab_contents we own it, so delete here.
251 delete tab_contents_; 251 delete tab_contents_;
252 252
253 delete this; 253 delete this;
254 } else { 254 } else {
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::TabReplaced(WebContents* new_tab) { 264 void DevToolsWindow::ContentsReplaced(WebContents* new_contents) {
265 TabContentsWrapper* new_tab_wrapper = 265 TabContentsWrapper* new_tab_wrapper =
266 TabContentsWrapper::GetCurrentWrapperForContents(new_tab); 266 TabContentsWrapper::GetCurrentWrapperForContents(new_contents);
267 DCHECK(new_tab_wrapper); 267 DCHECK(new_tab_wrapper);
268 if (!new_tab_wrapper) 268 if (!new_tab_wrapper)
269 return; 269 return;
270 DCHECK_EQ(profile_, new_tab_wrapper->profile()); 270 DCHECK_EQ(profile_, new_tab_wrapper->profile());
271 inspected_tab_ = new_tab_wrapper; 271 inspected_tab_ = new_tab_wrapper;
272 } 272 }
273 273
274 void DevToolsWindow::Show(DevToolsToggleAction action) { 274 void DevToolsWindow::Show(DevToolsToggleAction action) {
275 if (docked_) { 275 if (docked_) {
276 Browser* inspected_browser; 276 Browser* inspected_browser;
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 } else { 675 } else {
676 BrowserWindow* inspected_window = GetInspectedBrowserWindow(); 676 BrowserWindow* inspected_window = GetInspectedBrowserWindow();
677 if (inspected_window) 677 if (inspected_window)
678 tab_contents_->web_contents()->GetView()->Focus(); 678 tab_contents_->web_contents()->GetView()->Focus();
679 } 679 }
680 } 680 }
681 681
682 void DevToolsWindow::CloseWindow() { 682 void DevToolsWindow::CloseWindow() {
683 DCHECK(docked_); 683 DCHECK(docked_);
684 DevToolsManager::GetInstance()->ClientHostClosing(frontend_host_); 684 DevToolsManager::GetInstance()->ClientHostClosing(frontend_host_);
685 InspectedTabClosing(); 685 InspectedContentsClosing();
686 } 686 }
687 687
688 void DevToolsWindow::MoveWindow(int x, int y) { 688 void DevToolsWindow::MoveWindow(int x, int y) {
689 if (!docked_) { 689 if (!docked_) {
690 gfx::Rect bounds = browser_->window()->GetBounds(); 690 gfx::Rect bounds = browser_->window()->GetBounds();
691 bounds.Offset(x, y); 691 bounds.Offset(x, y);
692 browser_->window()->SetBounds(bounds); 692 browser_->window()->SetBounds(bounds);
693 } 693 }
694 } 694 }
695 695
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 CallClientFunction("InspectorFrontendAPI.savedURL", &url_value); 744 CallClientFunction("InspectorFrontendAPI.savedURL", &url_value);
745 } 745 }
746 746
747 content::JavaScriptDialogCreator* DevToolsWindow::GetJavaScriptDialogCreator() { 747 content::JavaScriptDialogCreator* DevToolsWindow::GetJavaScriptDialogCreator() {
748 if (inspected_tab_ && inspected_tab_->web_contents()->GetDelegate()) { 748 if (inspected_tab_ && inspected_tab_->web_contents()->GetDelegate()) {
749 return inspected_tab_->web_contents()->GetDelegate()-> 749 return inspected_tab_->web_contents()->GetDelegate()->
750 GetJavaScriptDialogCreator(); 750 GetJavaScriptDialogCreator();
751 } 751 }
752 return content::WebContentsDelegate::GetJavaScriptDialogCreator(); 752 return content::WebContentsDelegate::GetJavaScriptDialogCreator();
753 } 753 }
OLDNEW
« no previous file with comments | « chrome/browser/debugger/devtools_window.h ('k') | chrome/browser/extensions/extension_debugger_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698