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

Unified Diff: chrome/views/window_delegate.cc

Issue 10896: Re-do the way browser windows are shown:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 1 month 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
« no previous file with comments | « chrome/views/window_delegate.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/views/window_delegate.cc
===================================================================
--- chrome/views/window_delegate.cc (revision 5374)
+++ chrome/views/window_delegate.cc (working copy)
@@ -4,6 +4,9 @@
#include "chrome/views/window_delegate.h"
+// TODO(beng): hrmp.
+#include "chrome/browser/browser_process.h"
+#include "chrome/common/pref_service.h"
#include "chrome/views/client_view.h"
#include "chrome/views/window.h"
#include "skia/include/SkBitmap.h"
@@ -22,6 +25,63 @@
return SkBitmap();
}
+void WindowDelegate::SaveWindowPlacement(const gfx::Rect& bounds,
+ bool maximized,
+ bool always_on_top) {
+ std::wstring window_name = GetWindowName();
+ if (window_name.empty())
+ return;
+
+ DictionaryValue* window_preferences =
+ g_browser_process->local_state()->GetMutableDictionary(
+ window_name.c_str());
+ window_preferences->SetInteger(L"left", bounds.x());
+ window_preferences->SetInteger(L"top", bounds.y());
+ window_preferences->SetInteger(L"right", bounds.right());
+ window_preferences->SetInteger(L"bottom", bounds.bottom());
+ window_preferences->SetBoolean(L"maximized", maximized);
+ window_preferences->SetBoolean(L"always_on_top", always_on_top);
+}
+
+bool WindowDelegate::GetSavedWindowBounds(gfx::Rect* bounds) const {
+ std::wstring window_name = GetWindowName();
+ if (window_name.empty())
+ return false;
+
+ const DictionaryValue* dictionary =
+ g_browser_process->local_state()->GetDictionary(window_name.c_str());
+ int left, top, right, bottom;
+ if (!dictionary || !dictionary->GetInteger(L"left", &left) ||
+ !dictionary->GetInteger(L"top", &top) ||
+ !dictionary->GetInteger(L"right", &right) ||
+ !dictionary->GetInteger(L"bottom", &bottom))
+ return false;
+
+ bounds->SetRect(left, top, right, bottom);
+ return true;
+}
+
+bool WindowDelegate::GetSavedMaximizedState(bool* maximized) const {
+ std::wstring window_name = GetWindowName();
+ if (window_name.empty())
+ return false;
+
+ const DictionaryValue* dictionary =
+ g_browser_process->local_state()->GetDictionary(window_name.c_str());
+ return dictionary && dictionary->GetBoolean(L"maximized", maximized);
+}
+
+bool WindowDelegate::GetSavedAlwaysOnTopState(bool* always_on_top) const {
+ std::wstring window_name = GetWindowName();
+ if (window_name.empty())
+ return false;
+
+ const DictionaryValue* dictionary =
+ g_browser_process->local_state()->GetDictionary(window_name.c_str());
sky 2008/11/14 00:28:09 nit: 4 spaces.
+ return dictionary && dictionary->GetBoolean(L"always_on_top", always_on_top);
+}
+
+
ClientView* WindowDelegate::CreateClientView(Window* window) {
return new ClientView(window, GetContentsView());
}
« no previous file with comments | « chrome/views/window_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698