OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/views/frame/aero_glass_frame.h" | 5 #include "chrome/browser/views/frame/aero_glass_frame.h" |
6 | 6 |
7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
8 | 8 |
9 #include "chrome/app/theme/theme_resources.h" | 9 #include "chrome/app/theme/theme_resources.h" |
10 #include "chrome/browser/frame_util.h" | 10 #include "chrome/browser/frame_util.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 non_client_view_ = new AeroGlassNonClientView(this, browser_view); | 38 non_client_view_ = new AeroGlassNonClientView(this, browser_view); |
39 browser_view_->set_frame(this); | 39 browser_view_->set_frame(this); |
40 | 40 |
41 if (window_delegate()->ShouldShowWindowIcon()) | 41 if (window_delegate()->ShouldShowWindowIcon()) |
42 InitThrobberIcons(); | 42 InitThrobberIcons(); |
43 } | 43 } |
44 | 44 |
45 AeroGlassFrame::~AeroGlassFrame() { | 45 AeroGlassFrame::~AeroGlassFrame() { |
46 } | 46 } |
47 | 47 |
48 void AeroGlassFrame::Init(const gfx::Rect& bounds) { | 48 void AeroGlassFrame::Init() { |
49 Window::Init(NULL, bounds); | 49 Window::Init(NULL, gfx::Rect()); |
50 } | 50 } |
51 | 51 |
52 int AeroGlassFrame::GetMinimizeButtonOffset() const { | 52 int AeroGlassFrame::GetMinimizeButtonOffset() const { |
53 TITLEBARINFOEX titlebar_info; | 53 TITLEBARINFOEX titlebar_info; |
54 titlebar_info.cbSize = sizeof(TITLEBARINFOEX); | 54 titlebar_info.cbSize = sizeof(TITLEBARINFOEX); |
55 SendMessage(GetHWND(), WM_GETTITLEBARINFOEX, 0, (WPARAM)&titlebar_info); | 55 SendMessage(GetHWND(), WM_GETTITLEBARINFOEX, 0, (WPARAM)&titlebar_info); |
56 | 56 |
57 RECT wr; | 57 RECT wr; |
58 GetWindowRect(&wr); | 58 GetWindowRect(&wr); |
59 | 59 |
(...skipping 24 matching lines...) Expand all Loading... |
84 } else if (running) { | 84 } else if (running) { |
85 StartThrobber(); | 85 StartThrobber(); |
86 } | 86 } |
87 } | 87 } |
88 | 88 |
89 views::Window* AeroGlassFrame::GetWindow() { | 89 views::Window* AeroGlassFrame::GetWindow() { |
90 return this; | 90 return this; |
91 } | 91 } |
92 | 92 |
93 /////////////////////////////////////////////////////////////////////////////// | 93 /////////////////////////////////////////////////////////////////////////////// |
94 // AeroGlassFrame, views::ContainerWin implementation: | 94 // AeroGlassFrame, views::ContainerWin overrides: |
| 95 |
| 96 bool AeroGlassFrame::AcceleratorPressed(views::Accelerator* accelerator) { |
| 97 return browser_view_->AcceleratorPressed(*accelerator); |
| 98 } |
| 99 |
| 100 bool AeroGlassFrame::GetAccelerator(int cmd_id, |
| 101 views::Accelerator* accelerator) { |
| 102 return browser_view_->GetAccelerator(cmd_id, accelerator); |
| 103 } |
95 | 104 |
96 void AeroGlassFrame::OnInitMenuPopup(HMENU menu, UINT position, | 105 void AeroGlassFrame::OnInitMenuPopup(HMENU menu, UINT position, |
97 BOOL is_system_menu) { | 106 BOOL is_system_menu) { |
98 browser_view_->PrepareToRunSystemMenu(menu); | 107 browser_view_->PrepareToRunSystemMenu(menu); |
99 } | 108 } |
100 | 109 |
101 void AeroGlassFrame::OnEndSession(BOOL ending, UINT logoff) { | 110 void AeroGlassFrame::OnEndSession(BOOL ending, UINT logoff) { |
102 FrameUtil::EndSession(); | 111 FrameUtil::EndSession(); |
103 } | 112 } |
104 | 113 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 LRESULT AeroGlassFrame::OnNCHitTest(const CPoint& pt) { | 181 LRESULT AeroGlassFrame::OnNCHitTest(const CPoint& pt) { |
173 LRESULT result; | 182 LRESULT result; |
174 if (DwmDefWindowProc(GetHWND(), WM_NCHITTEST, 0, MAKELPARAM(pt.x, pt.y), | 183 if (DwmDefWindowProc(GetHWND(), WM_NCHITTEST, 0, MAKELPARAM(pt.x, pt.y), |
175 &result)) { | 184 &result)) { |
176 return result; | 185 return result; |
177 } | 186 } |
178 return Window::OnNCHitTest(pt); | 187 return Window::OnNCHitTest(pt); |
179 } | 188 } |
180 | 189 |
181 /////////////////////////////////////////////////////////////////////////////// | 190 /////////////////////////////////////////////////////////////////////////////// |
182 // AeroGlassFrame, views::ContainerWin overrides: | 191 // AeroGlassFrame, views::CustomFrameWindow overrides: |
183 | 192 |
184 bool AeroGlassFrame::AcceleratorPressed(views::Accelerator* accelerator) { | 193 int AeroGlassFrame::GetShowState() const { |
185 return browser_view_->AcceleratorPressed(*accelerator); | 194 return browser_view_->GetShowState(); |
186 } | |
187 | |
188 bool AeroGlassFrame::GetAccelerator(int cmd_id, | |
189 views::Accelerator* accelerator) { | |
190 return browser_view_->GetAccelerator(cmd_id, accelerator); | |
191 } | 195 } |
192 | 196 |
193 /////////////////////////////////////////////////////////////////////////////// | 197 /////////////////////////////////////////////////////////////////////////////// |
194 // AeroGlassFrame, private: | 198 // AeroGlassFrame, private: |
195 | 199 |
196 void AeroGlassFrame::UpdateDWMFrame() { | 200 void AeroGlassFrame::UpdateDWMFrame() { |
197 // Nothing to do yet. | 201 // Nothing to do yet. |
198 if (!client_view()) | 202 if (!client_view()) |
199 return; | 203 return; |
200 | 204 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 static bool initialized = false; | 262 static bool initialized = false; |
259 if (!initialized) { | 263 if (!initialized) { |
260 ResourceBundle &rb = ResourceBundle::GetSharedInstance(); | 264 ResourceBundle &rb = ResourceBundle::GetSharedInstance(); |
261 for (int i = 0; i < kThrobberIconCount; ++i) { | 265 for (int i = 0; i < kThrobberIconCount; ++i) { |
262 throbber_icons_[i] = rb.LoadThemeIcon(IDR_THROBBER_01 + i); | 266 throbber_icons_[i] = rb.LoadThemeIcon(IDR_THROBBER_01 + i); |
263 DCHECK(throbber_icons_[i]); | 267 DCHECK(throbber_icons_[i]); |
264 } | 268 } |
265 initialized = true; | 269 initialized = true; |
266 } | 270 } |
267 } | 271 } |
OLD | NEW |