summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/chrome_views_delegate.cc
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-10 06:21:49 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-10 06:21:49 +0000
commit609eeec226e06466acb6ccc0ea5d59d453e6623e (patch)
tree146aaa76b852537768c9b894904e502aed8a912c /chrome/browser/views/chrome_views_delegate.cc
parent3ee83f2c99cecee4f712cbb6fd9084cb676287a0 (diff)
downloadchromium_src-609eeec226e06466acb6ccc0ea5d59d453e6623e.zip
chromium_src-609eeec226e06466acb6ccc0ea5d59d453e6623e.tar.gz
chromium_src-609eeec226e06466acb6ccc0ea5d59d453e6623e.tar.bz2
Forgot to add these files as part of last change.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15734 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/chrome_views_delegate.cc')
-rw-r--r--chrome/browser/views/chrome_views_delegate.cc85
1 files changed, 85 insertions, 0 deletions
diff --git a/chrome/browser/views/chrome_views_delegate.cc b/chrome/browser/views/chrome_views_delegate.cc
new file mode 100644
index 0000000..1c04bc6
--- /dev/null
+++ b/chrome/browser/views/chrome_views_delegate.cc
@@ -0,0 +1,85 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
+// source code is governed by a BSD-style license that can be found in the
+// LICENSE file.
+
+#include "chrome/browser/views/chrome_views_delegate.h"
+
+#include "base/clipboard.h"
+#include "base/gfx/rect.h"
+#include "chrome/app/chrome_dll_resource.h"
+#include "chrome/browser/browser_process.h"
+#include "chrome/common/pref_service.h"
+
+///////////////////////////////////////////////////////////////////////////////
+// ChromeViewsDelegate, views::ViewsDelegate implementation:
+
+Clipboard* ChromeViewsDelegate::GetClipboard() const {
+ return g_browser_process->clipboard();
+}
+
+void ChromeViewsDelegate::SaveWindowPlacement(const std::wstring& window_name,
+ const gfx::Rect& bounds,
+ bool maximized,
+ bool always_on_top) {
+ if (!g_browser_process->local_state())
+ 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 ChromeViewsDelegate::GetSavedWindowBounds(const std::wstring& window_name,
+ gfx::Rect* bounds) const {
+ if (!g_browser_process->local_state())
+ 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 - left, bottom - top);
+ return true;
+}
+
+bool ChromeViewsDelegate::GetSavedMaximizedState(
+ const std::wstring& window_name,
+ bool* maximized) const {
+ if (!g_browser_process->local_state())
+ return false;
+
+ const DictionaryValue* dictionary =
+ g_browser_process->local_state()->GetDictionary(window_name.c_str());
+ return dictionary && dictionary->GetBoolean(L"maximized", maximized) &&
+ maximized;
+}
+
+bool ChromeViewsDelegate::GetSavedAlwaysOnTopState(
+ const std::wstring& window_name,
+ bool* always_on_top) const {
+ if (!g_browser_process->local_state())
+ return false;
+
+ const DictionaryValue* dictionary =
+ g_browser_process->local_state()->GetDictionary(window_name.c_str());
+ return dictionary && dictionary->GetBoolean(L"always_on_top", always_on_top) &&
+ always_on_top;
+}
+
+#if defined(OS_WIN)
+HICON ChromeViewsDelegate::GetDefaultWindowIcon() const {
+ return LoadIcon(GetModuleHandle(L"chrome.dll"),
+ MAKEINTRESOURCE(IDR_MAINFRAME));
+}
+#endif