Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(207)

Unified Diff: chrome/browser/ui/views/chrome_views_delegate.cc

Issue 7748036: Restoring a session should restore window minimization state on Windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: GetSavedWindowPlacement consolidation, Test, and All case. Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/chrome_views_delegate.cc
diff --git a/chrome/browser/ui/views/chrome_views_delegate.cc b/chrome/browser/ui/views/chrome_views_delegate.cc
index e198f84547c275a066f191e7709c70c750e1ab7e..0ff54954a2d6ae283a9d5b0bbd3e12f2b89b934f 100644
--- a/chrome/browser/ui/views/chrome_views_delegate.cc
+++ b/chrome/browser/ui/views/chrome_views_delegate.cc
@@ -65,7 +65,7 @@ views::View* ChromeViewsDelegate::GetDefaultParentView() {
void ChromeViewsDelegate::SaveWindowPlacement(const views::Widget* window,
const std::wstring& window_name,
const gfx::Rect& bounds,
- bool maximized) {
+ ui::WindowShowState show_state) {
bool using_local_state = false;
PrefService* prefs = GetPrefsForWindow(window, &using_local_state);
if (!prefs)
@@ -80,7 +80,8 @@ void ChromeViewsDelegate::SaveWindowPlacement(const views::Widget* window,
window_preferences->SetInteger("top", bounds.y());
window_preferences->SetInteger("right", bounds.right());
window_preferences->SetInteger("bottom", bounds.bottom());
- window_preferences->SetBoolean("maximized", maximized);
+ window_preferences->SetBoolean("maximized",
+ show_state == ui::SHOW_STATE_MAXIMIZED);
scoped_ptr<WindowSizer::MonitorInfoProvider> monitor_info_provider(
WindowSizer::CreateDefaultMonitorInfoProvider());
@@ -92,8 +93,10 @@ void ChromeViewsDelegate::SaveWindowPlacement(const views::Widget* window,
window_preferences->SetInteger("work_area_bottom", work_area.bottom());
}
-bool ChromeViewsDelegate::GetSavedWindowBounds(const std::wstring& window_name,
- gfx::Rect* bounds) const {
+bool ChromeViewsDelegate::GetSavedWindowPlacement(
+ const std::wstring& window_name,
+ gfx::Rect* bounds,
+ ui::WindowShowState* show_state) const {
PrefService* prefs = g_browser_process->local_state();
if (!prefs)
return false;
@@ -109,22 +112,12 @@ bool ChromeViewsDelegate::GetSavedWindowBounds(const std::wstring& window_name,
return false;
bounds->SetRect(left, top, right - left, bottom - top);
- return true;
-}
-
-bool ChromeViewsDelegate::GetSavedMaximizedState(
- const std::wstring& window_name,
- bool* maximized) const {
- PrefService* prefs = g_browser_process->local_state();
- if (!prefs)
- return false;
- DCHECK(prefs->FindPreference(WideToUTF8(window_name).c_str()));
- const DictionaryValue* dictionary =
- prefs->GetDictionary(WideToUTF8(window_name).c_str());
+ bool maximized = false;
+ return dictionary && dictionary->GetBoolean("maximized", &maximized);
+ *show_state = maximized ? ui::SHOW_STATE_MAXIMIZED : ui::SHOW_STATE_NORMAL;
- return dictionary && dictionary->GetBoolean("maximized", maximized) &&
- maximized;
+ return true;
}
void ChromeViewsDelegate::NotifyAccessibilityEvent(

Powered by Google App Engine
This is Rietveld 408576698