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

Unified Diff: chrome/browser/devtools/devtools_window.cc

Issue 63173016: DevTools: place DevTools WebContents underneath inspected WebContents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/devtools/devtools_window.h ('k') | chrome/browser/prefs/browser_prefs.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/devtools/devtools_window.cc
diff --git a/chrome/browser/devtools/devtools_window.cc b/chrome/browser/devtools/devtools_window.cc
index b1979344e2aa93d1c2ce9490c113991c0c029b67..3c2e2643eca0bd91d5bdb09ceffc1fe65c9bf8b6 100644
--- a/chrome/browser/devtools/devtools_window.cc
+++ b/chrome/browser/devtools/devtools_window.cc
@@ -240,8 +240,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).
@@ -462,20 +460,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;
@@ -494,51 +478,17 @@ 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_;
-}
-
-void DevToolsWindow::SetWidth(int width) {
- width_ = width;
- profile_->GetPrefs()->SetInteger(prefs::kDevToolsVSplitLocation, width);
+gfx::Size DevToolsWindow::GetBottomRightContentsOffset() const {
+ return bottom_right_contents_offset_;
}
-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) {
@@ -664,8 +614,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) {
@@ -749,6 +697,9 @@ GURL DevToolsWindow::GetDevToolsURL(Profile* profile,
switches::kEnableDevToolsExperiments))
url_string += "&experiments=true";
url_string += "&updateAppcache";
+#if defined(OS_MACOSX) || defined(USE_AURA)
pfeldman 2013/12/05 15:54:07 You probably want this everywhere or nowhere.
+ url_string += "&overlayContents=true";
+#endif
return GURL(url_string);
}
@@ -782,6 +733,10 @@ DevToolsWindow* DevToolsWindow::AsDevToolsWindow(
// static
DevToolsDockSide DevToolsWindow::GetDockSideFromPrefs(Profile* profile) {
+#if !defined(OS_MACOSX) && !defined(USE_AURA)
pfeldman 2013/12/05 15:54:07 ditto
+ return DEVTOOLS_DOCK_SIDE_UNDOCKED;
+#endif
+
std::string dock_side =
profile->GetPrefs()->GetString(prefs::kDevToolsDockSide);
@@ -1015,9 +970,23 @@ 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) {
+ if (top_left_contents_offset_.width() == left &&
+ top_left_contents_offset_.height() == top &&
+ bottom_right_contents_offset_.width() == right &&
+ bottom_right_contents_offset_.height() == bottom) {
+ return;
+ }
+
+ 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) {
@@ -1501,6 +1470,9 @@ void DevToolsWindow::UpdateBrowserToolbar() {
}
bool DevToolsWindow::IsDocked() {
+#if !defined(OS_MACOSX) && !defined(USE_AURA)
pfeldman 2013/12/05 15:54:07 ditto
+ return false;
+#endif
return dock_side_ != DEVTOOLS_DOCK_SIDE_UNDOCKED;
}
« no previous file with comments | « chrome/browser/devtools/devtools_window.h ('k') | chrome/browser/prefs/browser_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698