OLD | NEW |
---|---|
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
83 const char kPrefBottom[] = "dock_bottom"; | 83 const char kPrefBottom[] = "dock_bottom"; |
84 const char kPrefRight[] = "dock_right"; | 84 const char kPrefRight[] = "dock_right"; |
85 const char kPrefUndocked[] = "undocked"; | 85 const char kPrefUndocked[] = "undocked"; |
86 | 86 |
87 const char kDockSideBottom[] = "bottom"; | 87 const char kDockSideBottom[] = "bottom"; |
88 const char kDockSideRight[] = "right"; | 88 const char kDockSideRight[] = "right"; |
89 const char kDockSideUndocked[] = "undocked"; | 89 const char kDockSideUndocked[] = "undocked"; |
90 | 90 |
91 // Minimal height of devtools pane or content pane when devtools are docked | 91 // Minimal height of devtools pane or content pane when devtools are docked |
92 // to the browser window. | 92 // to the browser window. |
93 const int kMinDevToolsHeight = 50; | 93 const int kMinDevToolsHeight = 23; |
pfeldman
2013/03/19 10:42:06
I'd leave this 50.
dgozman
2013/03/21 09:55:26
Done.
| |
94 const int kMinDevToolsWidth = 150; | 94 const int kMinDevToolsWidth = 150; |
95 const int kMinContentsSize = 50; | 95 const int kMinContentsSize = 50; |
96 | 96 |
97 class DevToolsWindow::InspectedWebContentsObserver | 97 class DevToolsWindow::InspectedWebContentsObserver |
98 : public content::WebContentsObserver { | 98 : public content::WebContentsObserver { |
99 public: | 99 public: |
100 explicit InspectedWebContentsObserver(content::WebContents* web_contents) | 100 explicit InspectedWebContentsObserver(content::WebContents* web_contents) |
101 : WebContentsObserver(web_contents) { | 101 : WebContentsObserver(web_contents) { |
102 } | 102 } |
103 | 103 |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 Loading... | |
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 } |
OLD | NEW |