summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/chrome_views_delegate.cc
diff options
context:
space:
mode:
authoryuzo@chromium.org <yuzo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-29 07:16:00 +0000
committeryuzo@chromium.org <yuzo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-29 07:16:00 +0000
commit70a11c0044fdfc456e1fdb4c9a85de49f3b62201 (patch)
treebb1604068982e6cdb947696da1fa3e1b1c057202 /chrome/browser/views/chrome_views_delegate.cc
parentea392a6705010fe7d2ceec3980bf5df39aaf2f82 (diff)
downloadchromium_src-70a11c0044fdfc456e1fdb4c9a85de49f3b62201.zip
chromium_src-70a11c0044fdfc456e1fdb4c9a85de49f3b62201.tar.gz
chromium_src-70a11c0044fdfc456e1fdb4c9a85de49f3b62201.tar.bz2
Move window to workarea origin if it is completely off-screen.
BUG=17822 TEST=Use multiple monitors. Start Chrome, move the window to a non-primary monitor, and exit Chrome. Disconnect or disable the monitor and start Chrome again. Chrome should appear at the origin of a remaining monitor. Also try chaning the resolution of the non-primary monitor. As far as the window fits within the monitor, it should be shown as-is. If not, it is moved to the origin and resized, if necessary. Review URL: http://codereview.chromium.org/160246 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21946 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/chrome_views_delegate.cc')
-rw-r--r--chrome/browser/views/chrome_views_delegate.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/chrome/browser/views/chrome_views_delegate.cc b/chrome/browser/views/chrome_views_delegate.cc
index c793a54..bc87e19 100644
--- a/chrome/browser/views/chrome_views_delegate.cc
+++ b/chrome/browser/views/chrome_views_delegate.cc
@@ -6,8 +6,10 @@
#include "base/clipboard.h"
#include "base/gfx/rect.h"
+#include "base/scoped_ptr.h"
#include "chrome/app/chrome_dll_resource.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/window_sizer.h"
#include "chrome/common/pref_service.h"
///////////////////////////////////////////////////////////////////////////////
@@ -31,6 +33,15 @@ void ChromeViewsDelegate::SaveWindowPlacement(const std::wstring& window_name,
window_preferences->SetInteger(L"right", bounds.right());
window_preferences->SetInteger(L"bottom", bounds.bottom());
window_preferences->SetBoolean(L"maximized", maximized);
+
+ scoped_ptr<WindowSizer::MonitorInfoProvider> monitor_info_provider(
+ WindowSizer::CreateDefaultMonitorInfoProvider());
+ gfx::Rect work_area(
+ monitor_info_provider->GetMonitorWorkAreaMatching(bounds));
+ window_preferences->SetInteger(L"work_area_left", work_area.x());
+ window_preferences->SetInteger(L"work_area_top", work_area.y());
+ window_preferences->SetInteger(L"work_area_right", work_area.right());
+ window_preferences->SetInteger(L"work_area_bottom", work_area.bottom());
}
bool ChromeViewsDelegate::GetSavedWindowBounds(const std::wstring& window_name,