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

Side by Side Diff: chrome/browser/views/chrome_views_delegate.cc

Issue 115378: Move Always On Top setting out of Window/WindowDelegate and into task manager... (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // LICENSE file.
4 4
5 #include "chrome/browser/views/chrome_views_delegate.h" 5 #include "chrome/browser/views/chrome_views_delegate.h"
6 6
7 #include "base/clipboard.h" 7 #include "base/clipboard.h"
8 #include "base/gfx/rect.h" 8 #include "base/gfx/rect.h"
9 #include "chrome/app/chrome_dll_resource.h" 9 #include "chrome/app/chrome_dll_resource.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
11 #include "chrome/common/pref_service.h" 11 #include "chrome/common/pref_service.h"
12 12
13 /////////////////////////////////////////////////////////////////////////////// 13 ///////////////////////////////////////////////////////////////////////////////
14 // ChromeViewsDelegate, views::ViewsDelegate implementation: 14 // ChromeViewsDelegate, views::ViewsDelegate implementation:
15 15
16 Clipboard* ChromeViewsDelegate::GetClipboard() const { 16 Clipboard* ChromeViewsDelegate::GetClipboard() const {
17 return g_browser_process->clipboard(); 17 return g_browser_process->clipboard();
18 } 18 }
19 19
20 void ChromeViewsDelegate::SaveWindowPlacement(const std::wstring& window_name, 20 void ChromeViewsDelegate::SaveWindowPlacement(const std::wstring& window_name,
21 const gfx::Rect& bounds, 21 const gfx::Rect& bounds,
22 bool maximized, 22 bool maximized) {
23 bool always_on_top) {
24 if (!g_browser_process->local_state()) 23 if (!g_browser_process->local_state())
25 return; 24 return;
26 25
27 DictionaryValue* window_preferences = 26 DictionaryValue* window_preferences =
28 g_browser_process->local_state()->GetMutableDictionary( 27 g_browser_process->local_state()->GetMutableDictionary(
29 window_name.c_str()); 28 window_name.c_str());
30 window_preferences->SetInteger(L"left", bounds.x()); 29 window_preferences->SetInteger(L"left", bounds.x());
31 window_preferences->SetInteger(L"top", bounds.y()); 30 window_preferences->SetInteger(L"top", bounds.y());
32 window_preferences->SetInteger(L"right", bounds.right()); 31 window_preferences->SetInteger(L"right", bounds.right());
33 window_preferences->SetInteger(L"bottom", bounds.bottom()); 32 window_preferences->SetInteger(L"bottom", bounds.bottom());
34 window_preferences->SetBoolean(L"maximized", maximized); 33 window_preferences->SetBoolean(L"maximized", maximized);
35 window_preferences->SetBoolean(L"always_on_top", always_on_top);
36 } 34 }
37 35
38 bool ChromeViewsDelegate::GetSavedWindowBounds(const std::wstring& window_name, 36 bool ChromeViewsDelegate::GetSavedWindowBounds(const std::wstring& window_name,
39 gfx::Rect* bounds) const { 37 gfx::Rect* bounds) const {
40 if (!g_browser_process->local_state()) 38 if (!g_browser_process->local_state())
41 return false; 39 return false;
42 40
43 const DictionaryValue* dictionary = 41 const DictionaryValue* dictionary =
44 g_browser_process->local_state()->GetDictionary(window_name.c_str()); 42 g_browser_process->local_state()->GetDictionary(window_name.c_str());
45 int left, top, right, bottom; 43 int left, top, right, bottom;
(...skipping 12 matching lines...) Expand all
58 bool* maximized) const { 56 bool* maximized) const {
59 if (!g_browser_process->local_state()) 57 if (!g_browser_process->local_state())
60 return false; 58 return false;
61 59
62 const DictionaryValue* dictionary = 60 const DictionaryValue* dictionary =
63 g_browser_process->local_state()->GetDictionary(window_name.c_str()); 61 g_browser_process->local_state()->GetDictionary(window_name.c_str());
64 return dictionary && dictionary->GetBoolean(L"maximized", maximized) && 62 return dictionary && dictionary->GetBoolean(L"maximized", maximized) &&
65 maximized; 63 maximized;
66 } 64 }
67 65
68 bool ChromeViewsDelegate::GetSavedAlwaysOnTopState(
69 const std::wstring& window_name,
70 bool* always_on_top) const {
71 if (!g_browser_process->local_state())
72 return false;
73
74 const DictionaryValue* dictionary =
75 g_browser_process->local_state()->GetDictionary(window_name.c_str());
76 return dictionary && dictionary->GetBoolean(L"always_on_top", always_on_top) & &
77 always_on_top;
78 }
79
80 #if defined(OS_WIN) 66 #if defined(OS_WIN)
81 HICON ChromeViewsDelegate::GetDefaultWindowIcon() const { 67 HICON ChromeViewsDelegate::GetDefaultWindowIcon() const {
82 return LoadIcon(GetModuleHandle(L"chrome.dll"), 68 return LoadIcon(GetModuleHandle(L"chrome.dll"),
83 MAKEINTRESOURCE(IDR_MAINFRAME)); 69 MAKEINTRESOURCE(IDR_MAINFRAME));
84 } 70 }
85 #endif 71 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698