| 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/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 bool docked) | 187 bool docked) |
| 188 : profile_(profile), | 188 : profile_(profile), |
| 189 inspected_tab_(NULL), | 189 inspected_tab_(NULL), |
| 190 tab_contents_(tab_contents), | 190 tab_contents_(tab_contents), |
| 191 browser_(NULL), | 191 browser_(NULL), |
| 192 docked_(docked), | 192 docked_(docked), |
| 193 is_loaded_(false), | 193 is_loaded_(false), |
| 194 action_on_load_(DEVTOOLS_TOGGLE_ACTION_NONE), | 194 action_on_load_(DEVTOOLS_TOGGLE_ACTION_NONE), |
| 195 frontend_host_(NULL) { | 195 frontend_host_(NULL) { |
| 196 frontend_host_ = DevToolsClientHost::CreateDevToolsFrontendHost( | 196 frontend_host_ = DevToolsClientHost::CreateDevToolsFrontendHost( |
| 197 tab_contents->tab_contents(), | 197 tab_contents->web_contents(), |
| 198 this); | 198 this); |
| 199 g_instances.Get().push_back(this); | 199 g_instances.Get().push_back(this); |
| 200 // Wipe out page icon so that the default application icon is used. | 200 // Wipe out page icon so that the default application icon is used. |
| 201 NavigationEntry* entry = | 201 NavigationEntry* entry = |
| 202 tab_contents_->tab_contents()->GetController().GetActiveEntry(); | 202 tab_contents_->tab_contents()->GetController().GetActiveEntry(); |
| 203 entry->GetFavicon().bitmap = SkBitmap(); | 203 entry->GetFavicon().bitmap = SkBitmap(); |
| 204 entry->GetFavicon().valid = true; | 204 entry->GetFavicon().valid = true; |
| 205 | 205 |
| 206 // Register on-load actions. | 206 // Register on-load actions. |
| 207 registrar_.Add( | 207 registrar_.Add( |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 } else { | 250 } else { |
| 251 // First, initiate self-destruct to free all the registrars. | 251 // First, initiate self-destruct to free all the registrars. |
| 252 // Then close all tabs. Browser will take care of deleting tab_contents | 252 // Then close all tabs. Browser will take care of deleting tab_contents |
| 253 // for us. | 253 // for us. |
| 254 Browser* browser = browser_; | 254 Browser* browser = browser_; |
| 255 delete this; | 255 delete this; |
| 256 browser->CloseAllTabs(); | 256 browser->CloseAllTabs(); |
| 257 } | 257 } |
| 258 } | 258 } |
| 259 | 259 |
| 260 void DevToolsWindow::TabReplaced(TabContents* new_tab) { | 260 void DevToolsWindow::TabReplaced(WebContents* new_tab) { |
| 261 TabContentsWrapper* new_tab_wrapper = | 261 TabContentsWrapper* new_tab_wrapper = |
| 262 TabContentsWrapper::GetCurrentWrapperForContents(new_tab); | 262 TabContentsWrapper::GetCurrentWrapperForContents(new_tab); |
| 263 DCHECK(new_tab_wrapper); | 263 DCHECK(new_tab_wrapper); |
| 264 if (!new_tab_wrapper) | 264 if (!new_tab_wrapper) |
| 265 return; | 265 return; |
| 266 DCHECK_EQ(profile_, new_tab_wrapper->profile()); | 266 DCHECK_EQ(profile_, new_tab_wrapper->profile()); |
| 267 inspected_tab_ = new_tab_wrapper; | 267 inspected_tab_ = new_tab_wrapper; |
| 268 } | 268 } |
| 269 | 269 |
| 270 void DevToolsWindow::Show(DevToolsToggleAction action) { | 270 void DevToolsWindow::Show(DevToolsToggleAction action) { |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 content); | 723 content); |
| 724 } | 724 } |
| 725 | 725 |
| 726 content::JavaScriptDialogCreator* DevToolsWindow::GetJavaScriptDialogCreator() { | 726 content::JavaScriptDialogCreator* DevToolsWindow::GetJavaScriptDialogCreator() { |
| 727 if (inspected_tab_ && inspected_tab_->tab_contents()->GetDelegate()) { | 727 if (inspected_tab_ && inspected_tab_->tab_contents()->GetDelegate()) { |
| 728 return inspected_tab_->tab_contents()->GetDelegate()-> | 728 return inspected_tab_->tab_contents()->GetDelegate()-> |
| 729 GetJavaScriptDialogCreator(); | 729 GetJavaScriptDialogCreator(); |
| 730 } | 730 } |
| 731 return content::WebContentsDelegate::GetJavaScriptDialogCreator(); | 731 return content::WebContentsDelegate::GetJavaScriptDialogCreator(); |
| 732 } | 732 } |
| OLD | NEW |