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

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

Issue 12871013: DevTools: respect minimum width/height when resizing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 9 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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 // Respect the minimum devtools width preset. 389 // Respect the minimum devtools width preset.
390 height_ = std::max(kMinDevToolsHeight, height_); 390 height_ = std::max(kMinDevToolsHeight, height_);
391 391
392 // But it should never compromise the content window size. 392 // But it should never compromise the content window size.
393 height_ = std::min(container_height - kMinContentsSize, height_); 393 height_ = std::min(container_height - kMinContentsSize, height_);
394 if (height_ < (kMinContentsSize / 2)) 394 if (height_ < (kMinContentsSize / 2))
395 height_ = container_height / 3; 395 height_ = container_height / 3;
396 return height_; 396 return height_;
397 } 397 }
398 398
399 int DevToolsWindow::GetMinimumWidth() {
400 return kMinDevToolsWidth;
401 }
402
403 int DevToolsWindow::GetMinimumHeight() {
404 return kMinDevToolsHeight;
405 }
406
399 void DevToolsWindow::SetWidth(int width) { 407 void DevToolsWindow::SetWidth(int width) {
400 width_ = width; 408 width_ = width;
401 profile_->GetPrefs()->SetInteger(prefs::kDevToolsVSplitLocation, width); 409 profile_->GetPrefs()->SetInteger(prefs::kDevToolsVSplitLocation, width);
402 } 410 }
403 411
404 void DevToolsWindow::SetHeight(int height) { 412 void DevToolsWindow::SetHeight(int height) {
405 height_ = height; 413 height_ = height;
406 profile_->GetPrefs()->SetInteger(prefs::kDevToolsHSplitLocation, height); 414 profile_->GetPrefs()->SetInteger(prefs::kDevToolsHSplitLocation, height);
407 } 415 }
408 416
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 1041
1034 // static 1042 // static
1035 DevToolsDockSide DevToolsWindow::SideFromString( 1043 DevToolsDockSide DevToolsWindow::SideFromString(
1036 const std::string& dock_side) { 1044 const std::string& dock_side) {
1037 if (dock_side == kDockSideRight) 1045 if (dock_side == kDockSideRight)
1038 return DEVTOOLS_DOCK_SIDE_RIGHT; 1046 return DEVTOOLS_DOCK_SIDE_RIGHT;
1039 if (dock_side == kDockSideBottom) 1047 if (dock_side == kDockSideBottom)
1040 return DEVTOOLS_DOCK_SIDE_BOTTOM; 1048 return DEVTOOLS_DOCK_SIDE_BOTTOM;
1041 return DEVTOOLS_DOCK_SIDE_UNDOCKED; 1049 return DEVTOOLS_DOCK_SIDE_UNDOCKED;
1042 } 1050 }
OLDNEW
« no previous file with comments | « chrome/browser/devtools/devtools_window.h ('k') | chrome/browser/ui/cocoa/dev_tools_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698