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

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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 delete this; 344 delete this;
345 browser->tab_strip_model()->CloseAllTabs(); 345 browser->tab_strip_model()->CloseAllTabs();
346 } 346 }
347 } 347 }
348 348
349 void DevToolsWindow::Show(DevToolsToggleAction action) { 349 void DevToolsWindow::Show(DevToolsToggleAction action) {
350 if (IsDocked()) { 350 if (IsDocked()) {
351 Browser* inspected_browser; 351 Browser* inspected_browser;
352 int inspected_tab_index; 352 int inspected_tab_index;
353 // Tell inspected browser to update splitter and switch to inspected panel. 353 // Tell inspected browser to update splitter and switch to inspected panel.
354 if (!IsInspectedBrowserPopupOrPanel() && 354 if (!IsInspectedBrowserPopup() &&
355 FindInspectedBrowserAndTabIndex(&inspected_browser, 355 FindInspectedBrowserAndTabIndex(&inspected_browser,
356 &inspected_tab_index)) { 356 &inspected_tab_index)) {
357 BrowserWindow* inspected_window = inspected_browser->window(); 357 BrowserWindow* inspected_window = inspected_browser->window();
358 web_contents_->SetDelegate(this); 358 web_contents_->SetDelegate(this);
359 inspected_window->UpdateDevTools(); 359 inspected_window->UpdateDevTools();
360 web_contents_->GetView()->SetInitialFocus(); 360 web_contents_->GetView()->SetInitialFocus();
361 inspected_window->Show(); 361 inspected_window->Show();
362 TabStripModel* tab_strip_model = inspected_browser->tab_strip_model(); 362 TabStripModel* tab_strip_model = inspected_browser->tab_strip_model();
363 tab_strip_model->ActivateTabAt(inspected_tab_index, true); 363 tab_strip_model->ActivateTabAt(inspected_tab_index, true);
364 ScheduleAction(action); 364 ScheduleAction(action);
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 return false; 496 return false;
497 } 497 }
498 498
499 BrowserWindow* DevToolsWindow::GetInspectedBrowserWindow() { 499 BrowserWindow* DevToolsWindow::GetInspectedBrowserWindow() {
500 Browser* browser = NULL; 500 Browser* browser = NULL;
501 int tab; 501 int tab;
502 return FindInspectedBrowserAndTabIndex(&browser, &tab) ? 502 return FindInspectedBrowserAndTabIndex(&browser, &tab) ?
503 browser->window() : NULL; 503 browser->window() : NULL;
504 } 504 }
505 505
506 bool DevToolsWindow::IsInspectedBrowserPopupOrPanel() { 506 bool DevToolsWindow::IsInspectedBrowserPopup() {
507 Browser* browser = NULL; 507 Browser* browser = NULL;
508 int tab; 508 int tab;
509 if (!FindInspectedBrowserAndTabIndex(&browser, &tab)) 509 if (!FindInspectedBrowserAndTabIndex(&browser, &tab))
510 return false; 510 return false;
511 511
512 return browser->is_type_popup() || browser->is_type_panel(); 512 return browser->is_type_popup();
513 } 513 }
514 514
515 void DevToolsWindow::UpdateFrontendDockSide() { 515 void DevToolsWindow::UpdateFrontendDockSide() {
516 base::StringValue dock_side(SideToString(dock_side_)); 516 base::StringValue dock_side(SideToString(dock_side_));
517 CallClientFunction("InspectorFrontendAPI.setDockSide", &dock_side); 517 CallClientFunction("InspectorFrontendAPI.setDockSide", &dock_side);
518 base::FundamentalValue docked(IsDocked()); 518 base::FundamentalValue docked(IsDocked());
519 CallClientFunction("InspectorFrontendAPI.setAttachedWindow", &docked); 519 CallClientFunction("InspectorFrontendAPI.setAttachedWindow", &docked);
520 } 520 }
521 521
522 522
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 } 844 }
845 } 845 }
846 846
847 void DevToolsWindow::SetDockSide(const std::string& side) { 847 void DevToolsWindow::SetDockSide(const std::string& side) {
848 DevToolsDockSide requested_side = SideFromString(side); 848 DevToolsDockSide requested_side = SideFromString(side);
849 bool dock_requested = requested_side != DEVTOOLS_DOCK_SIDE_UNDOCKED; 849 bool dock_requested = requested_side != DEVTOOLS_DOCK_SIDE_UNDOCKED;
850 bool is_docked = IsDocked(); 850 bool is_docked = IsDocked();
851 851
852 content::WebContents* inspected_web_contents = GetInspectedWebContents(); 852 content::WebContents* inspected_web_contents = GetInspectedWebContents();
853 if (dock_requested && (!inspected_web_contents || 853 if (dock_requested && (!inspected_web_contents ||
854 !GetInspectedBrowserWindow() || IsInspectedBrowserPopupOrPanel())) { 854 !GetInspectedBrowserWindow() || IsInspectedBrowserPopup())) {
855 // Cannot dock, avoid window flashing due to close-reopen cycle. 855 // Cannot dock, avoid window flashing due to close-reopen cycle.
856 return; 856 return;
857 } 857 }
858 858
859 if (dock_side_ != DEVTOOLS_DOCK_SIDE_MINIMIZED && 859 if (dock_side_ != DEVTOOLS_DOCK_SIDE_MINIMIZED &&
860 requested_side == DEVTOOLS_DOCK_SIDE_MINIMIZED) { 860 requested_side == DEVTOOLS_DOCK_SIDE_MINIMIZED) {
861 dock_side_before_minimized_ = dock_side_; 861 dock_side_before_minimized_ = dock_side_;
862 } 862 }
863 863
864 dock_side_ = requested_side; 864 dock_side_ = requested_side;
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 DevToolsDockSide DevToolsWindow::SideFromString( 1094 DevToolsDockSide DevToolsWindow::SideFromString(
1095 const std::string& dock_side) { 1095 const std::string& dock_side) {
1096 if (dock_side == kDockSideRight) 1096 if (dock_side == kDockSideRight)
1097 return DEVTOOLS_DOCK_SIDE_RIGHT; 1097 return DEVTOOLS_DOCK_SIDE_RIGHT;
1098 if (dock_side == kDockSideBottom) 1098 if (dock_side == kDockSideBottom)
1099 return DEVTOOLS_DOCK_SIDE_BOTTOM; 1099 return DEVTOOLS_DOCK_SIDE_BOTTOM;
1100 if (dock_side == kDockSideMinimized) 1100 if (dock_side == kDockSideMinimized)
1101 return DEVTOOLS_DOCK_SIDE_MINIMIZED; 1101 return DEVTOOLS_DOCK_SIDE_MINIMIZED;
1102 return DEVTOOLS_DOCK_SIDE_UNDOCKED; 1102 return DEVTOOLS_DOCK_SIDE_UNDOCKED;
1103 } 1103 }
OLDNEW
« no previous file with comments | « chrome/browser/devtools/devtools_window.h ('k') | chrome/browser/extensions/api/management/management_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698