summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/options/options_window_view.cc
diff options
context:
space:
mode:
authorpinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-23 19:05:32 +0000
committerpinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-23 19:05:32 +0000
commit17168e2b91dda05e2980b4c8e48585d77f3c96d2 (patch)
treecb67cea941d642b3fee47a832e1d64d204eaa342 /chrome/browser/views/options/options_window_view.cc
parent4a6861a33cc1848ef17c54f8f2209c2c2376b0a8 (diff)
downloadchromium_src-17168e2b91dda05e2980b4c8e48585d77f3c96d2.zip
chromium_src-17168e2b91dda05e2980b4c8e48585d77f3c96d2.tar.gz
chromium_src-17168e2b91dda05e2980b4c8e48585d77f3c96d2.tar.bz2
Save and restore the options window position instead of always centering the window.
BUG=34644 TEST=Open options window, move and close the window, re-open and ensure position is saved. Contributed by Steven Pennington <spenn@engr.uvic.ca> git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57086 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/options/options_window_view.cc')
-rw-r--r--chrome/browser/views/options/options_window_view.cc24
1 files changed, 7 insertions, 17 deletions
diff --git a/chrome/browser/views/options/options_window_view.cc b/chrome/browser/views/options/options_window_view.cc
index 5923acc..b414078 100644
--- a/chrome/browser/views/options/options_window_view.cc
+++ b/chrome/browser/views/options/options_window_view.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/options_window.h"
#include "app/l10n_util.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_window.h"
@@ -44,6 +45,7 @@ class OptionsWindowView : public views::View,
return MessageBoxFlags::DIALOGBUTTON_CANCEL;
}
virtual std::wstring GetWindowTitle() const;
+ virtual std::wstring GetWindowName() const;
virtual void WindowClosing();
virtual bool Cancel();
virtual views::View* GetContentsView();
@@ -102,23 +104,7 @@ OptionsWindowView::~OptionsWindowView() {
void OptionsWindowView::ShowOptionsPage(OptionsPage page,
OptionsGroup highlight_group) {
- if (Browser* b = BrowserList::GetLastActive()) {
- // Move dialog to user expected position.
- gfx::Rect frame_bounds = b->window()->GetRestoredBounds();
- if (b->window()->IsMaximized()) {
- // For maximized window get monitor size as a bounding box.
- WindowSizer::MonitorInfoProvider* provider =
- WindowSizer::CreateDefaultMonitorInfoProvider();
- frame_bounds = provider->GetMonitorWorkAreaMatching(frame_bounds);
- delete provider;
- }
- gfx::Point origin = frame_bounds.origin();
- origin.Offset(
- (frame_bounds.width() - window()->GetBounds().width()) / 2,
- (frame_bounds.height() - window()->GetBounds().height()) / 2);
- window()->SetBounds(gfx::Rect(origin, window()->GetBounds().size()), NULL);
- }
-
+ // Positioning is handled by window_delegate. we just need to show the window.
// This will show invisible windows and bring visible windows to the front.
window()->Show();
@@ -145,6 +131,10 @@ std::wstring OptionsWindowView::GetWindowTitle() const {
l10n_util::GetString(IDS_PRODUCT_NAME));
}
+std::wstring OptionsWindowView::GetWindowName() const {
+ return UTF8ToWide(prefs::kPreferencesWindowPlacement);
+}
+
void OptionsWindowView::WindowClosing() {
// Clear the static instance so that the next time ShowOptionsWindow() is
// called a new window is opened.