Index: chrome/browser/devtools/devtools_window.cc |
diff --git a/chrome/browser/devtools/devtools_window.cc b/chrome/browser/devtools/devtools_window.cc |
index afc97d28120c0b53b8883bfba28f170313e79286..9c6c6caa62e59fee16ed37e924f73a9a78554533 100644 |
--- a/chrome/browser/devtools/devtools_window.cc |
+++ b/chrome/browser/devtools/devtools_window.cc |
@@ -239,8 +239,6 @@ static const char kFrontendHostId[] = "id"; |
static const char kFrontendHostMethod[] = "method"; |
static const char kFrontendHostParams[] = "params"; |
-const int kMinContentsSize = 50; |
- |
std::string SkColorToRGBAString(SkColor color) { |
// We avoid StringPrintf because it will use locale specific formatters for |
// the double (e.g. ',' instead of '.' in German). |
@@ -461,20 +459,6 @@ void DevToolsWindow::InspectElement(content::RenderViewHost* inspected_rvh, |
} |
// static |
-int DevToolsWindow::GetMinimumWidth() { |
- const int kMinDevToolsWidth = 150; |
- return kMinDevToolsWidth; |
-} |
- |
-// static |
-int DevToolsWindow::GetMinimumHeight() { |
- // Minimal height of devtools pane or content pane when devtools are docked |
- // to the browser window. |
- const int kMinDevToolsHeight = 50; |
- return kMinDevToolsHeight; |
-} |
- |
-// static |
int DevToolsWindow::GetMinimizedHeight() { |
const int kMinimizedDevToolsHeight = 24; |
return kMinimizedDevToolsHeight; |
@@ -492,51 +476,24 @@ content::DevToolsClientHost* DevToolsWindow::GetDevToolsClientHostForTest() { |
return frontend_host_.get(); |
} |
-int DevToolsWindow::GetWidth(int container_width) { |
- if (width_ == -1) { |
- width_ = profile_->GetPrefs()-> |
- GetInteger(prefs::kDevToolsVSplitLocation); |
- } |
- |
- // By default, size devtools as 1/3 of the browser window. |
- if (width_ == -1) |
- width_ = container_width / 3; |
- |
- // Respect the minimum devtools width preset. |
- width_ = std::max(GetMinimumWidth(), width_); |
- |
- // But it should never compromise the content window size unless the entire |
- // window is tiny. |
- width_ = std::min(container_width - kMinContentsSize, width_); |
- return width_; |
+gfx::Size DevToolsWindow::GetTopLeftContentsOffset() const { |
+ return top_left_contents_offset_; |
} |
-int DevToolsWindow::GetHeight(int container_height) { |
- if (height_ == -1) { |
- height_ = profile_->GetPrefs()-> |
- GetInteger(prefs::kDevToolsHSplitLocation); |
- } |
- |
- // By default, size devtools as 1/3 of the browser window. |
- if (height_ == -1) |
- height_ = container_height / 3; |
- |
- // Respect the minimum devtools width preset. |
- height_ = std::max(GetMinimumHeight(), height_); |
- |
- // But it should never compromise the content window size. |
- height_ = std::min(container_height - kMinContentsSize, height_); |
- return height_; |
+gfx::Size DevToolsWindow::GetBottomRightContentsOffset() const { |
+ return bottom_right_contents_offset_; |
} |
-void DevToolsWindow::SetWidth(int width) { |
- width_ = width; |
- profile_->GetPrefs()->SetInteger(prefs::kDevToolsVSplitLocation, width); |
-} |
- |
-void DevToolsWindow::SetHeight(int height) { |
- height_ = height; |
- profile_->GetPrefs()->SetInteger(prefs::kDevToolsHSplitLocation, height); |
+gfx::Size DevToolsWindow::GetMinimumSize() const { |
+ int min_width = 150; |
pfeldman
2013/11/18 14:18:27
Extract constants for these.
|
+ int min_height = 50; |
+ // Add minimum 50x50 size for inspected WebContents. |
+ if (dock_side_ == DEVTOOLS_DOCK_SIDE_BOTTOM) { |
pfeldman
2013/11/18 14:18:27
drop {}
|
+ min_height += 50; |
+ } else if (dock_side_ == DEVTOOLS_DOCK_SIDE_RIGHT) { |
+ min_width += 50; |
+ } |
+ return gfx::Size(min_width, min_height); |
pfeldman
2013/11/18 14:18:27
DevTools window should not be aware of dock side a
|
} |
void DevToolsWindow::Show(const DevToolsToggleAction& action) { |
@@ -660,8 +617,6 @@ DevToolsWindow::DevToolsWindow(Profile* profile, |
dock_side_(dock_side), |
is_loaded_(false), |
action_on_load_(DevToolsToggleAction::Show()), |
- width_(-1), |
- height_(-1), |
dock_side_before_minimized_(dock_side), |
intercepted_page_beforeunload_(false), |
weak_factory_(this) { |
@@ -745,6 +700,7 @@ GURL DevToolsWindow::GetDevToolsURL(Profile* profile, |
switches::kEnableDevToolsExperiments)) |
url_string += "&experiments=true"; |
url_string += "&updateAppcache"; |
+ url_string += "&overlayContents=true"; |
return GURL(url_string); |
} |
@@ -1010,9 +966,16 @@ void DevToolsWindow::CloseWindow() { |
web_contents_->GetRenderViewHost()->FirePageBeforeUnload(false); |
} |
-void DevToolsWindow::SetWindowBounds(int x, int y, int width, int height) { |
- if (!IsDocked()) |
- browser_->window()->SetBounds(gfx::Rect(x, y, width, height)); |
+void DevToolsWindow::SetContentsOffsets( |
+ int left, int top, int right, int bottom) { |
+ top_left_contents_offset_ = gfx::Size(left, top); |
+ bottom_right_contents_offset_ = gfx::Size(right, bottom); |
+ if (IsDocked()) { |
+ // Update inspected window. |
+ BrowserWindow* inspected_window = GetInspectedBrowserWindow(); |
+ if (inspected_window) |
+ inspected_window->UpdateDevTools(); |
+ } |
} |
void DevToolsWindow::MoveWindow(int x, int y) { |