diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-15 00:32:04 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-15 00:32:04 +0000 |
commit | bc9a5157e6843721680e49185dc86ac5885a0c11 (patch) | |
tree | 8b94dcceb7ac4a1970846a71ef7bf28cb1603432 /chrome/browser/browser.cc | |
parent | e0ab532efa30307f09fdb62e5648f71ec704d378 (diff) | |
download | chromium_src-bc9a5157e6843721680e49185dc86ac5885a0c11.zip chromium_src-bc9a5157e6843721680e49185dc86ac5885a0c11.tar.gz chromium_src-bc9a5157e6843721680e49185dc86ac5885a0c11.tar.bz2 |
Make the Browser restore saved last size/position using the WindowDelegate code rather than hand-rolling its own.
Review URL: http://codereview.chromium.org/10959
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5520 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser.cc')
-rw-r--r-- | chrome/browser/browser.cc | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 19ecce9..69f23a9e 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -309,33 +309,25 @@ bool Browser::IsCommandEnabled(int id) const { /////////////////////////////////////////////////////////////////////////////// // Browser, State Storage and Retrieval for UI: -void Browser::SaveWindowPlacement(const gfx::Rect& bounds, bool maximized) { - // We don't save window position for popups. - if (type() == BrowserType::BROWSER) - return; - - // First save to local state, this is for remembering on subsequent starts. - PrefService* prefs = g_browser_process->local_state(); - DCHECK(prefs); +std::wstring Browser::GetWindowPlacementKey() const { std::wstring name(prefs::kBrowserWindowPlacement); if (!app_name_.empty()) { name.append(L"_"); name.append(app_name_); } + return name; +} - DictionaryValue* win_pref = prefs->GetMutableDictionary(name.c_str()); - DCHECK(win_pref); - win_pref->SetInteger(L"top", bounds.y()); - win_pref->SetInteger(L"left", bounds.x()); - win_pref->SetInteger(L"bottom", bounds.bottom()); - win_pref->SetInteger(L"right", bounds.right()); - win_pref->SetBoolean(L"maximized", maximized); +bool Browser::ShouldSaveWindowPlacement() const { + // We don't save window position for popups. + return type() != BrowserType::BROWSER; +} - // Then save to the session storage service, used when reloading a past - // session. Note that we don't want to be the ones who cause lazy - // initialization of the session service. This function gets called during - // initial window showing, and we don't want to bring in the session service - // this early. +void Browser::SaveWindowPlacement(const gfx::Rect& bounds, bool maximized) { + // Save to the session storage service, used when reloading a past session. + // Note that we don't want to be the ones who cause lazy initialization of + // the session service. This function gets called during initial window + // showing, and we don't want to bring in the session service this early. if (profile()->HasSessionService()) { SessionService* session_service = profile()->GetSessionService(); if (session_service) |