summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-22 21:55:36 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-22 21:55:36 +0000
commite63227d4c84e1a4410a8b0e8d4f7a0462994e390 (patch)
tree3c703097e2bf7b0c093bba17cf5bea0e990e85a8
parent475120563140c60d109b207cf77ca64e651005ad (diff)
downloadchromium_src-e63227d4c84e1a4410a8b0e8d4f7a0462994e390.zip
chromium_src-e63227d4c84e1a4410a8b0e8d4f7a0462994e390.tar.gz
chromium_src-e63227d4c84e1a4410a8b0e8d4f7a0462994e390.tar.bz2
Reverting 16796.
Review URL: http://codereview.chromium.org/113791 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16800 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/browser.cc15
-rw-r--r--chrome/browser/extensions/extension_tabs_module.cc6
-rw-r--r--chrome/browser/gtk/browser_window_gtk.cc13
-rw-r--r--chrome/browser/window_sizer_linux.cc85
-rw-r--r--chrome/chrome.gyp4
-rw-r--r--chrome/common/temp_scaffolding_stubs.cc16
-rw-r--r--chrome/common/temp_scaffolding_stubs.h11
7 files changed, 46 insertions, 104 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index cf30a20..618fb4a 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -37,7 +37,6 @@
#include "chrome/browser/tab_contents/site_instance.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/tab_contents_view.h"
-#include "chrome/browser/window_sizer.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/notification_service.h"
@@ -78,6 +77,10 @@
#include "chrome/common/child_process_host.h"
#endif // OS_WIN
+#if defined(OS_WIN) || defined(OS_MACOSX)
+#include "chrome/browser/window_sizer.h"
+#endif
+
#if defined(TOOLKIT_VIEWS)
#include "chrome/browser/dock_info.h"
#endif
@@ -1799,8 +1802,7 @@ void Browser::AddNewContents(TabContents* source,
// AddTabContents method does.
if (type_ & TYPE_APP)
transition = PageTransition::START_PAGE;
- b->tabstrip_model()->AddTabContents(new_contents, -1, false, transition,
- true);
+ b->tabstrip_model()->AddTabContents(new_contents, -1, false, transition, true);
b->window()->Show();
return;
}
@@ -1813,8 +1815,7 @@ void Browser::AddNewContents(TabContents* source,
initial_pos, user_gesture);
browser->window()->Show();
} else if (disposition != SUPPRESS_OPEN) {
- tabstrip_model_.AddTabContents(new_contents, -1, false,
- PageTransition::LINK,
+ tabstrip_model_.AddTabContents(new_contents, -1, false, PageTransition::LINK,
disposition == NEW_FOREGROUND_TAB);
}
}
@@ -2363,10 +2364,8 @@ void Browser::ProcessPendingUIUpdates() {
// Updating the URL happens synchronously in ScheduleUIUpdate.
TabContents* selected_tab = GetSelectedTabContents();
- if (selected_tab &&
- flags & TabContents::INVALIDATE_LOAD && GetStatusBubble()) {
+ if (selected_tab && flags & TabContents::INVALIDATE_LOAD && GetStatusBubble())
GetStatusBubble()->SetStatus(selected_tab->GetStatusText());
- }
if (flags & TabContents::INVALIDATE_TAB) {
tabstrip_model_.UpdateTabContentsStateAt(
diff --git a/chrome/browser/extensions/extension_tabs_module.cc b/chrome/browser/extensions/extension_tabs_module.cc
index 322239a..cddafa5 100644
--- a/chrome/browser/extensions/extension_tabs_module.cc
+++ b/chrome/browser/extensions/extension_tabs_module.cc
@@ -13,7 +13,13 @@
#include "chrome/browser/extensions/extensions_service.h"
#include "chrome/browser/renderer_host/render_view_host_delegate.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
+
+// TODO(port): Port these files.
+#if defined(OS_WIN) || defined(OS_MACOSX)
#include "chrome/browser/window_sizer.h"
+#else
+#include "chrome/common/temp_scaffolding_stubs.h"
+#endif
namespace {
// Error messages.
diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc
index 5be3667..34e42f0 100644
--- a/chrome/browser/gtk/browser_window_gtk.cc
+++ b/chrome/browser/gtk/browser_window_gtk.cc
@@ -746,21 +746,13 @@ void BrowserWindowGtk::AddFindBar(FindBarGtk* findbar) {
}
void BrowserWindowGtk::SetGeometryHints() {
+ gtk_window_set_default_size(window_, 640, 480);
+
// Allow the user to resize us arbitrarily small.
GdkGeometry geometry;
geometry.min_width = 1;
geometry.min_height = 1;
gtk_window_set_geometry_hints(window_, NULL, &geometry, GDK_HINT_MIN_SIZE);
-
- if (browser_->GetSavedMaximizedState())
- gtk_window_maximize(window_);
- else
- gtk_window_unmaximize(window_);
-
- gfx::Rect rect = browser_->GetSavedWindowBounds();
- gtk_window_set_default_size(window_,
- static_cast<gint>(rect.width()),
- static_cast<gint>(rect.height()));
}
void BrowserWindowGtk::SetWindowIcon() {
@@ -840,3 +832,4 @@ bool BrowserWindowGtk::IsToolbarSupported() {
return browser_->SupportsWindowFeature(Browser::FEATURE_TOOLBAR) ||
browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR);
}
+
diff --git a/chrome/browser/window_sizer_linux.cc b/chrome/browser/window_sizer_linux.cc
deleted file mode 100644
index 524dfb4..0000000
--- a/chrome/browser/window_sizer_linux.cc
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/window_sizer.h"
-
-#include <gtk/gtk.h>
-
-#include "base/logging.h"
-#include "chrome/browser/browser.h"
-
-// How much horizontal and vertical offset there is between newly
-// opened windows. We don't care on Linux since the window manager generally
-// does a good job of window placement.
-const int WindowSizer::kWindowTilePixels = 0;
-
-// An implementation of WindowSizer::MonitorInfoProvider that gets the actual
-// monitor information from X via GDK.
-class DefaultMonitorInfoProvider : public WindowSizer::MonitorInfoProvider {
- public:
- DefaultMonitorInfoProvider() { }
-
- virtual gfx::Rect GetPrimaryMonitorWorkArea() const {
- gfx::Rect rect = GetScreenWorkArea();
- return rect.Intersect(GetPrimaryMonitorBounds());
- }
-
- virtual gfx::Rect GetPrimaryMonitorBounds() const {
- GdkScreen* screen = gdk_screen_get_default();
- GdkRectangle rect;
- gdk_screen_get_monitor_geometry(screen, 0, &rect);
- return gfx::Rect(rect);
- }
-
- virtual gfx::Rect GetMonitorWorkAreaMatching(
- const gfx::Rect& match_rect) const {
- // TODO(thestig) Implement multi-monitor support.
- return GetPrimaryMonitorWorkArea();
- }
-
- virtual gfx::Point GetBoundsOffsetMatching(
- const gfx::Rect& match_rect) const {
- // TODO(thestig) Implement multi-monitor support.
- return GetPrimaryMonitorWorkArea().origin();
- }
-
- void UpdateWorkAreas() {
- // TODO(thestig) Implement multi-monitor support.
- work_areas_.clear();
- work_areas_.push_back(GetPrimaryMonitorBounds());
- }
-
- private:
- gfx::Rect GetScreenWorkArea() const {
- gboolean r;
- glong *data;
- gint data_len;
- r = gdk_property_get(gdk_get_default_root_window(), // a gdk window
- gdk_atom_intern("_NET_WORKAREA", FALSE), // property
- gdk_atom_intern("CARDINAL", FALSE), // property type
- 0, // byte offset into property
- 0xff, // property length to retrieve
- false, // delete property after retrieval?
- NULL, // returned property type
- NULL, // returned data format
- &data_len, // returned data len
- reinterpret_cast<guchar**>(&data)); // returned data
- CHECK(r);
- CHECK(data_len >= 16);
- gint x = data[0];
- gint y = data[1];
- gint width = data[0] + data[2];
- gint height = data[1] + data[3];
- g_free(data);
- return gfx::Rect(x, y, width, height);
- }
-
- DISALLOW_COPY_AND_ASSIGN(DefaultMonitorInfoProvider);
-};
-
-// static
-WindowSizer::MonitorInfoProvider*
-WindowSizer::CreateDefaultMonitorInfoProvider() {
- return new DefaultMonitorInfoProvider();
-}
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index 0ab9824..8e852f3 100644
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -1519,7 +1519,6 @@
'browser/window_sizer.cc',
'browser/window_sizer.h',
'browser/window_sizer_mac.mm',
- 'browser/window_sizer_linux.cc',
'browser/window_sizer_win.cc',
'browser/worker_host/worker_process_host.cc',
'browser/worker_host/worker_process_host.h',
@@ -1546,6 +1545,9 @@
'../build/linux/system.gyp:gtk',
],
'sources!': [
+ # TODO(port): add this to the Linux build once a
+ # window_sizer_linux.cc is written
+ 'browser/window_sizer.cc',
'browser/debugger/debugger_shell_stubs.cc',
# Windows-specific files.
'browser/download/download_exe.cc',
diff --git a/chrome/common/temp_scaffolding_stubs.cc b/chrome/common/temp_scaffolding_stubs.cc
index 4c05c9a..de4babc 100644
--- a/chrome/common/temp_scaffolding_stubs.cc
+++ b/chrome/common/temp_scaffolding_stubs.cc
@@ -293,6 +293,22 @@ void DragDownload(const DownloadItem* download, SkBitmap* icon) {
} // namespace download_util
+#if defined(OS_LINUX)
+void WindowSizer::GetBrowserWindowBounds(const std::wstring& app_name,
+ const gfx::Rect& specified_bounds,
+ Browser* browser,
+ gfx::Rect* window_bounds,
+ bool* maximized) {
+ // If we're given a bounds, use it (for things like tearing off tabs during
+ // drags). If not, make up something reasonable until the rest of the
+ // WindowSizer infrastructure is in place.
+ *window_bounds = specified_bounds;
+ if (specified_bounds.IsEmpty()) {
+ *window_bounds = gfx::Rect(0, 0, 1024, 768);
+ }
+}
+#endif
+
#if defined(OS_MACOSX)
void HungRendererDialog::HideForTabContents(TabContents*) {
NOTIMPLEMENTED();
diff --git a/chrome/common/temp_scaffolding_stubs.h b/chrome/common/temp_scaffolding_stubs.h
index 3cb8bcb..b0b7d1a 100644
--- a/chrome/common/temp_scaffolding_stubs.h
+++ b/chrome/common/temp_scaffolding_stubs.h
@@ -345,6 +345,17 @@ class DockInfo {
};
#endif
+#if defined(OS_LINUX)
+class WindowSizer {
+ public:
+ static void GetBrowserWindowBounds(const std::wstring& app_name,
+ const gfx::Rect& specified_bounds,
+ Browser* browser,
+ gfx::Rect* window_bounds,
+ bool* maximized);
+};
+#endif
+
//---------------------------------------------------------------------------
// These stubs are for Profile