summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-22 17:02:45 +0000
committerxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-22 17:02:45 +0000
commit38ab46563875871094169fb1152a8b21ebbf841f (patch)
tree1c14d216e0c5ac5621285ea4146b1ec706958bb4 /chrome
parent9cd6def3b735220b4dd0d00ec5c8633a2dfa8acd (diff)
downloadchromium_src-38ab46563875871094169fb1152a8b21ebbf841f.zip
chromium_src-38ab46563875871094169fb1152a8b21ebbf841f.tar.gz
chromium_src-38ab46563875871094169fb1152a8b21ebbf841f.tar.bz2
Reland r41641 "Make DevTools open docked by default..."
- Fix DevToolsSanityTest time out. The timeout is because the tests wait for Browser closed notification. However, docked DevTools does not have its own Browser object and hence the wait times out. BUG=none TEST=none Review URL: http://codereview.chromium.org/1025005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42226 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/debugger/devtools_manager.cc2
-rw-r--r--chrome/browser/debugger/devtools_sanity_unittest.cc6
-rw-r--r--chrome/browser/gtk/browser_window_gtk.cc7
-rw-r--r--chrome/browser/views/frame/browser_view.cc27
-rw-r--r--chrome/browser/views/tab_contents/tab_contents_view_gtk.cc11
-rw-r--r--chrome/browser/views/tab_contents/tab_contents_view_gtk.h4
6 files changed, 33 insertions, 24 deletions
diff --git a/chrome/browser/debugger/devtools_manager.cc b/chrome/browser/debugger/devtools_manager.cc
index fe3462e..d4d3971 100644
--- a/chrome/browser/debugger/devtools_manager.cc
+++ b/chrome/browser/debugger/devtools_manager.cc
@@ -29,7 +29,7 @@ DevToolsManager* DevToolsManager::GetInstance() {
// static
void DevToolsManager::RegisterUserPrefs(PrefService* prefs) {
- prefs->RegisterBooleanPref(prefs::kDevToolsOpenDocked, false);
+ prefs->RegisterBooleanPref(prefs::kDevToolsOpenDocked, true);
}
DevToolsManager::DevToolsManager()
diff --git a/chrome/browser/debugger/devtools_sanity_unittest.cc b/chrome/browser/debugger/devtools_sanity_unittest.cc
index bf7d9f9..d88a0c5 100644
--- a/chrome/browser/debugger/devtools_sanity_unittest.cc
+++ b/chrome/browser/debugger/devtools_sanity_unittest.cc
@@ -137,7 +137,11 @@ class DevToolsSanityTest : public InProcessBrowserTest {
// first.
Browser* browser = window_->browser();
devtools_manager->UnregisterDevToolsClientHostFor(inspected_rvh_);
- BrowserClosedObserver close_observer(browser);
+
+ // Wait only when DevToolsWindow has a browser. For docked DevTools, this
+ // is NULL and we skip the wait.
+ if (browser)
+ BrowserClosedObserver close_observer(browser);
}
TabContents* client_contents_;
diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc
index 873ad44..e0d60adf 100644
--- a/chrome/browser/gtk/browser_window_gtk.cc
+++ b/chrome/browser/gtk/browser_window_gtk.cc
@@ -1178,13 +1178,6 @@ void BrowserWindowGtk::UpdateDevToolsForContents(TabContents* contents) {
TabContents* devtools_contents = contents ?
DevToolsWindow::GetDevToolsContents(contents) : NULL;
devtools_container_->SetTabContents(devtools_contents);
- if (devtools_contents) {
- // TabContentsViewGtk::WasShown is not called when tab contents is shown by
- // anything other than user selecting a Tab.
- // See TabContentsViewWin::OnWindowPosChanged for reference on how it should
- // be implemented.
- devtools_contents->ShowContents();
- }
bool should_show = old_devtools == NULL && devtools_contents != NULL;
bool should_hide = old_devtools != NULL && devtools_contents == NULL;
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index 1970be1..d484765 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/views/frame/browser_view.cc
@@ -679,19 +679,6 @@ void BrowserView::Show() {
// that should be added and this should be removed.
RestoreFocus();
- // Restore split offset.
- int split_offset = g_browser_process->local_state()->GetInteger(
- prefs::kDevToolsSplitLocation);
- if (split_offset == -1) {
- // Initial load, set to default value.
- split_offset = 2 * contents_split_->height() / 3;
- }
- // Make sure user can see both panes.
- int min_split_size = contents_split_->height() / 10;
- split_offset = std::min(contents_split_->height() - min_split_size,
- std::max(min_split_size, split_offset));
- contents_split_->set_divider_offset(split_offset);
-
frame_->GetWindow()->Show();
}
@@ -1816,6 +1803,20 @@ void BrowserView::UpdateDevToolsForContents(TabContents* tab_contents) {
new views::ExternalFocusTracker(devtools_container_,
GetFocusManager()));
}
+
+ // Restore split offset.
+ int split_offset = g_browser_process->local_state()->GetInteger(
+ prefs::kDevToolsSplitLocation);
+ if (split_offset == -1) {
+ // Initial load, set to default value.
+ split_offset = 2 * contents_split_->height() / 3;
+ }
+ // Make sure user can see both panes.
+ int min_split_size = contents_split_->height() / 10;
+ split_offset = std::min(contents_split_->height() - min_split_size,
+ std::max(min_split_size, split_offset));
+ contents_split_->set_divider_offset(split_offset);
+
devtools_container_->SetVisible(true);
contents_split_->Layout();
} else if (should_hide) {
diff --git a/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc b/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc
index 4a9870e..bbeb841 100644
--- a/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc
+++ b/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc
@@ -367,7 +367,7 @@ void TabContentsViewGtk::OnSizeAllocate(GtkWidget* widget,
WasSized(new_size);
}
-void TabContentsViewGtk::OnPaint(GtkWidget* widget, GdkEventExpose* event) {
+gboolean TabContentsViewGtk::OnPaint(GtkWidget* widget, GdkEventExpose* event) {
if (tab_contents()->render_view_host() &&
!tab_contents()->render_view_host()->IsRenderViewLive()) {
if (sad_tab_ == NULL) {
@@ -380,6 +380,15 @@ void TabContentsViewGtk::OnPaint(GtkWidget* widget, GdkEventExpose* event) {
gfx::CanvasPaint canvas(event);
sad_tab_->ProcessPaint(&canvas);
}
+ return false; // False indicates other widgets should get the event as well.
+}
+
+void TabContentsViewGtk::OnShow(GtkWidget* widget) {
+ WasShown();
+}
+
+void TabContentsViewGtk::OnHide(GtkWidget* widget) {
+ WasHidden();
}
void TabContentsViewGtk::WasHidden() {
diff --git a/chrome/browser/views/tab_contents/tab_contents_view_gtk.h b/chrome/browser/views/tab_contents/tab_contents_view_gtk.h
index e88c3f9..540274a 100644
--- a/chrome/browser/views/tab_contents/tab_contents_view_gtk.h
+++ b/chrome/browser/views/tab_contents/tab_contents_view_gtk.h
@@ -78,7 +78,9 @@ class TabContentsViewGtk : public TabContentsView,
// Overridden from views::WidgetGtk:
virtual gboolean OnButtonPress(GtkWidget* widget, GdkEventButton* event);
virtual void OnSizeAllocate(GtkWidget* widget, GtkAllocation* allocation);
- virtual void OnPaint(GtkWidget* widget, GdkEventExpose* event);
+ virtual gboolean OnPaint(GtkWidget* widget, GdkEventExpose* event);
+ virtual void OnShow(GtkWidget* widget);
+ virtual void OnHide(GtkWidget* widget);
// Handles notifying the TabContents and other operations when the window was
// shown or hidden.