| 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/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 Browser* inspected_browser; | 202 Browser* inspected_browser; |
| 203 int inspected_tab_index; | 203 int inspected_tab_index; |
| 204 // Tell inspected browser to update splitter and switch to inspected panel. | 204 // Tell inspected browser to update splitter and switch to inspected panel. |
| 205 if (!IsInspectedBrowserPopupOrPanel() && | 205 if (!IsInspectedBrowserPopupOrPanel() && |
| 206 FindInspectedBrowserAndTabIndex(&inspected_browser, | 206 FindInspectedBrowserAndTabIndex(&inspected_browser, |
| 207 &inspected_tab_index)) { | 207 &inspected_tab_index)) { |
| 208 BrowserWindow* inspected_window = inspected_browser->window(); | 208 BrowserWindow* inspected_window = inspected_browser->window(); |
| 209 tab_contents_->tab_contents()->set_delegate(this); | 209 tab_contents_->tab_contents()->set_delegate(this); |
| 210 inspected_window->UpdateDevTools(); | 210 inspected_window->UpdateDevTools(); |
| 211 tab_contents_->view()->SetInitialFocus(); | 211 tab_contents_->view()->SetInitialFocus(); |
| 212 inspected_window->Show(); | 212 inspected_window->Show(BrowserWindow::SHOW_CONTEXT_NORMAL); |
| 213 TabStripModel* tabstrip_model = inspected_browser->tabstrip_model(); | 213 TabStripModel* tabstrip_model = inspected_browser->tabstrip_model(); |
| 214 tabstrip_model->ActivateTabAt(inspected_tab_index, true); | 214 tabstrip_model->ActivateTabAt(inspected_tab_index, true); |
| 215 ScheduleAction(action); | 215 ScheduleAction(action); |
| 216 return; | 216 return; |
| 217 } else { | 217 } else { |
| 218 // Sometimes we don't know where to dock. Stay undocked. | 218 // Sometimes we don't know where to dock. Stay undocked. |
| 219 docked_ = false; | 219 docked_ = false; |
| 220 UpdateFrontendAttachedState(); | 220 UpdateFrontendAttachedState(); |
| 221 } | 221 } |
| 222 } | 222 } |
| 223 | 223 |
| 224 // Avoid consecutive window switching if the devtools window has been opened | 224 // Avoid consecutive window switching if the devtools window has been opened |
| 225 // and the Inspect Element shortcut is pressed in the inspected tab. | 225 // and the Inspect Element shortcut is pressed in the inspected tab. |
| 226 bool should_show_window = | 226 bool should_show_window = |
| 227 !browser_ || action != DEVTOOLS_TOGGLE_ACTION_INSPECT; | 227 !browser_ || action != DEVTOOLS_TOGGLE_ACTION_INSPECT; |
| 228 | 228 |
| 229 if (!browser_) | 229 if (!browser_) |
| 230 CreateDevToolsBrowser(); | 230 CreateDevToolsBrowser(); |
| 231 | 231 |
| 232 if (should_show_window) { | 232 if (should_show_window) { |
| 233 browser_->window()->Show(); | 233 browser_->window()->Show(BrowserWindow::SHOW_CONTEXT_NORMAL); |
| 234 tab_contents_->view()->SetInitialFocus(); | 234 tab_contents_->view()->SetInitialFocus(); |
| 235 } | 235 } |
| 236 | 236 |
| 237 ScheduleAction(action); | 237 ScheduleAction(action); |
| 238 } | 238 } |
| 239 | 239 |
| 240 void DevToolsWindow::RequestActivate() { | 240 void DevToolsWindow::RequestActivate() { |
| 241 if (!docked_) { | 241 if (!docked_) { |
| 242 if (!browser_->window()->IsActive()) { | 242 if (!browser_->window()->IsActive()) { |
| 243 browser_->window()->Activate(); | 243 browser_->window()->Activate(); |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 return NULL; | 602 return NULL; |
| 603 } | 603 } |
| 604 | 604 |
| 605 content::JavaScriptDialogCreator* DevToolsWindow::GetJavaScriptDialogCreator() { | 605 content::JavaScriptDialogCreator* DevToolsWindow::GetJavaScriptDialogCreator() { |
| 606 if (inspected_tab_ && inspected_tab_->tab_contents()->delegate()) { | 606 if (inspected_tab_ && inspected_tab_->tab_contents()->delegate()) { |
| 607 return inspected_tab_->tab_contents()->delegate()-> | 607 return inspected_tab_->tab_contents()->delegate()-> |
| 608 GetJavaScriptDialogCreator(); | 608 GetJavaScriptDialogCreator(); |
| 609 } | 609 } |
| 610 return TabContentsDelegate::GetJavaScriptDialogCreator(); | 610 return TabContentsDelegate::GetJavaScriptDialogCreator(); |
| 611 } | 611 } |
| OLD | NEW |