Index: chrome/browser/devtools/devtools_window.cc |
diff --git a/chrome/browser/devtools/devtools_window.cc b/chrome/browser/devtools/devtools_window.cc |
index 254a004eaa9bb907df78ee1d1b8df63ff80e53df..e6b8e3eead27af7829eb4885a133bc775082b07a 100644 |
--- a/chrome/browser/devtools/devtools_window.cc |
+++ b/chrome/browser/devtools/devtools_window.cc |
@@ -241,8 +241,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). |
@@ -464,20 +462,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; |
@@ -496,51 +480,13 @@ 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::Insets DevToolsWindow::GetContentsInsets() const { |
+ return contents_insets_; |
} |
-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_; |
-} |
- |
-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 { |
+ const gfx::Size kMinDevToolsSize = gfx::Size(200, 100); |
+ return kMinDevToolsSize; |
} |
void DevToolsWindow::Show(const DevToolsToggleAction& action) { |
@@ -667,8 +613,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) { |
@@ -770,6 +714,7 @@ GURL DevToolsWindow::GetDevToolsURL(Profile* profile, |
switches::kEnableDevToolsExperiments)) |
url_string += "&experiments=true"; |
url_string += "&updateAppcache"; |
+ url_string += "&overlayContents=true"; |
return GURL(url_string); |
} |
@@ -1037,9 +982,22 @@ 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::SetContentsInsets( |
+ int top, int left, int bottom, int right) { |
+ if (contents_insets_.top() == top && |
+ contents_insets_.left() == left && |
+ contents_insets_.bottom() == bottom && |
+ contents_insets_.right() == right) { |
+ return; |
+ } |
+ |
+ contents_insets_ = gfx::Insets(top, left, bottom, right); |
+ if (IsDocked()) { |
+ // Update inspected window. |
+ BrowserWindow* inspected_window = GetInspectedBrowserWindow(); |
+ if (inspected_window) |
+ inspected_window->UpdateDevTools(); |
+ } |
} |
void DevToolsWindow::MoveWindow(int x, int y) { |