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

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

Issue 13139004: Deprecate Browser::TYPE_PANEL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 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/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 delete this; 310 delete this;
311 browser->tab_strip_model()->CloseAllTabs(); 311 browser->tab_strip_model()->CloseAllTabs();
312 } 312 }
313 } 313 }
314 314
315 void DevToolsWindow::Show(DevToolsToggleAction action) { 315 void DevToolsWindow::Show(DevToolsToggleAction action) {
316 if (IsDocked()) { 316 if (IsDocked()) {
317 Browser* inspected_browser; 317 Browser* inspected_browser;
318 int inspected_tab_index; 318 int inspected_tab_index;
319 // Tell inspected browser to update splitter and switch to inspected panel. 319 // Tell inspected browser to update splitter and switch to inspected panel.
320 if (!IsInspectedBrowserPopupOrPanel() && 320 if (!IsInspectedBrowserPopup() &&
321 FindInspectedBrowserAndTabIndex(&inspected_browser, 321 FindInspectedBrowserAndTabIndex(&inspected_browser,
322 &inspected_tab_index)) { 322 &inspected_tab_index)) {
323 BrowserWindow* inspected_window = inspected_browser->window(); 323 BrowserWindow* inspected_window = inspected_browser->window();
324 web_contents_->SetDelegate(this); 324 web_contents_->SetDelegate(this);
325 inspected_window->UpdateDevTools(); 325 inspected_window->UpdateDevTools();
326 web_contents_->GetView()->SetInitialFocus(); 326 web_contents_->GetView()->SetInitialFocus();
327 inspected_window->Show(); 327 inspected_window->Show();
328 TabStripModel* tab_strip_model = inspected_browser->tab_strip_model(); 328 TabStripModel* tab_strip_model = inspected_browser->tab_strip_model();
329 tab_strip_model->ActivateTabAt(inspected_tab_index, true); 329 tab_strip_model->ActivateTabAt(inspected_tab_index, true);
330 ScheduleAction(action); 330 ScheduleAction(action);
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 return false; 462 return false;
463 } 463 }
464 464
465 BrowserWindow* DevToolsWindow::GetInspectedBrowserWindow() { 465 BrowserWindow* DevToolsWindow::GetInspectedBrowserWindow() {
466 Browser* browser = NULL; 466 Browser* browser = NULL;
467 int tab; 467 int tab;
468 return FindInspectedBrowserAndTabIndex(&browser, &tab) ? 468 return FindInspectedBrowserAndTabIndex(&browser, &tab) ?
469 browser->window() : NULL; 469 browser->window() : NULL;
470 } 470 }
471 471
472 bool DevToolsWindow::IsInspectedBrowserPopupOrPanel() { 472 bool DevToolsWindow::IsInspectedBrowserPopup() {
473 Browser* browser = NULL; 473 Browser* browser = NULL;
474 int tab; 474 int tab;
475 if (!FindInspectedBrowserAndTabIndex(&browser, &tab)) 475 if (!FindInspectedBrowserAndTabIndex(&browser, &tab))
476 return false; 476 return false;
477 477
478 return browser->is_type_popup() || browser->is_type_panel(); 478 return browser->is_type_popup();
479 } 479 }
480 480
481 void DevToolsWindow::UpdateFrontendDockSide() { 481 void DevToolsWindow::UpdateFrontendDockSide() {
482 base::StringValue dock_side(SideToString(dock_side_)); 482 base::StringValue dock_side(SideToString(dock_side_));
483 CallClientFunction("InspectorFrontendAPI.setDockSide", &dock_side); 483 CallClientFunction("InspectorFrontendAPI.setDockSide", &dock_side);
484 base::FundamentalValue docked(IsDocked()); 484 base::FundamentalValue docked(IsDocked());
485 CallClientFunction("InspectorFrontendAPI.setAttachedWindow", &docked); 485 CallClientFunction("InspectorFrontendAPI.setAttachedWindow", &docked);
486 } 486 }
487 487
488 488
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 } 805 }
806 } 806 }
807 807
808 void DevToolsWindow::SetDockSide(const std::string& side) { 808 void DevToolsWindow::SetDockSide(const std::string& side) {
809 DevToolsDockSide requested_side = SideFromString(side); 809 DevToolsDockSide requested_side = SideFromString(side);
810 bool dock_requested = requested_side != DEVTOOLS_DOCK_SIDE_UNDOCKED; 810 bool dock_requested = requested_side != DEVTOOLS_DOCK_SIDE_UNDOCKED;
811 bool is_docked = IsDocked(); 811 bool is_docked = IsDocked();
812 812
813 content::WebContents* inspected_web_contents = GetInspectedWebContents(); 813 content::WebContents* inspected_web_contents = GetInspectedWebContents();
814 if (dock_requested && (!inspected_web_contents || 814 if (dock_requested && (!inspected_web_contents ||
815 !GetInspectedBrowserWindow() || IsInspectedBrowserPopupOrPanel())) { 815 !GetInspectedBrowserWindow() || IsInspectedBrowserPopup())) {
816 // Cannot dock, avoid window flashing due to close-reopen cycle. 816 // Cannot dock, avoid window flashing due to close-reopen cycle.
817 return; 817 return;
818 } 818 }
819 819
820 if (dock_side_ != DEVTOOLS_DOCK_SIDE_MINIMIZED && 820 if (dock_side_ != DEVTOOLS_DOCK_SIDE_MINIMIZED &&
821 requested_side == DEVTOOLS_DOCK_SIDE_MINIMIZED) { 821 requested_side == DEVTOOLS_DOCK_SIDE_MINIMIZED) {
822 dock_side_before_minimized_ = dock_side_; 822 dock_side_before_minimized_ = dock_side_;
823 } 823 }
824 824
825 dock_side_ = requested_side; 825 dock_side_ = requested_side;
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 DevToolsDockSide DevToolsWindow::SideFromString( 1055 DevToolsDockSide DevToolsWindow::SideFromString(
1056 const std::string& dock_side) { 1056 const std::string& dock_side) {
1057 if (dock_side == kDockSideRight) 1057 if (dock_side == kDockSideRight)
1058 return DEVTOOLS_DOCK_SIDE_RIGHT; 1058 return DEVTOOLS_DOCK_SIDE_RIGHT;
1059 if (dock_side == kDockSideBottom) 1059 if (dock_side == kDockSideBottom)
1060 return DEVTOOLS_DOCK_SIDE_BOTTOM; 1060 return DEVTOOLS_DOCK_SIDE_BOTTOM;
1061 if (dock_side == kDockSideMinimized) 1061 if (dock_side == kDockSideMinimized)
1062 return DEVTOOLS_DOCK_SIDE_MINIMIZED; 1062 return DEVTOOLS_DOCK_SIDE_MINIMIZED;
1063 return DEVTOOLS_DOCK_SIDE_UNDOCKED; 1063 return DEVTOOLS_DOCK_SIDE_UNDOCKED;
1064 } 1064 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698