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/glass_browser_frame_view.h" | 5 #include "chrome/browser/views/frame/glass_browser_frame_view.h" |
6 | 6 |
7 #include "chrome/browser/views/frame/browser_view.h" | 7 #include "chrome/browser/views/frame/browser_view.h" |
8 #include "chrome/browser/views/tabs/tab_strip.h" | 8 #include "chrome/browser/views/tabs/tab_strip.h" |
9 #include "chrome/common/gfx/chrome_canvas.h" | 9 #include "chrome/common/gfx/chrome_canvas.h" |
10 #include "chrome/common/resource_bundle.h" | 10 #include "chrome/common/resource_bundle.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 } | 177 } |
178 | 178 |
179 gfx::Point GlassBrowserFrameView::GetSystemMenuPoint() const { | 179 gfx::Point GlassBrowserFrameView::GetSystemMenuPoint() const { |
180 gfx::Point system_menu_point; | 180 gfx::Point system_menu_point; |
181 if (browser_view_->IsBrowserTypeNormal()) { | 181 if (browser_view_->IsBrowserTypeNormal()) { |
182 // The X coordinate conditional is because in maximized mode the frame edge | 182 // The X coordinate conditional is because in maximized mode the frame edge |
183 // and the client edge are both offscreen, whereas in the opaque frame | 183 // and the client edge are both offscreen, whereas in the opaque frame |
184 // (where we don't do this trick) maximized windows have no client edge and | 184 // (where we don't do this trick) maximized windows have no client edge and |
185 // only the frame edge is offscreen. | 185 // only the frame edge is offscreen. |
186 system_menu_point.SetPoint(NonClientBorderThickness() - | 186 system_menu_point.SetPoint(NonClientBorderThickness() - |
187 (browser_view_->CanCurrentlyResize() ? kClientEdgeThickness : 0), | 187 ((frame_->IsMaximized() || frame_->IsFullscreen()) ? |
| 188 0 : kClientEdgeThickness), |
188 NonClientTopBorderHeight() + browser_view_->GetTabStripHeight() - | 189 NonClientTopBorderHeight() + browser_view_->GetTabStripHeight() - |
189 (browser_view_->IsFullscreen() ? 0 : kClientEdgeThickness)); | 190 (frame_->IsFullscreen() ? 0 : kClientEdgeThickness)); |
190 } else { | 191 } else { |
191 system_menu_point.SetPoint(0, -kFrameShadowThickness); | 192 system_menu_point.SetPoint(0, -kFrameShadowThickness); |
192 } | 193 } |
193 ConvertPointToScreen(this, &system_menu_point); | 194 ConvertPointToScreen(this, &system_menu_point); |
194 return system_menu_point; | 195 return system_menu_point; |
195 } | 196 } |
196 | 197 |
197 int GlassBrowserFrameView::NonClientHitTest(const gfx::Point& point) { | 198 int GlassBrowserFrameView::NonClientHitTest(const gfx::Point& point) { |
198 // If the browser isn't in normal mode, we haven't customized the frame, so | 199 // If the browser isn't in normal mode, we haven't customized the frame, so |
199 // Windows can figure this out. If the point isn't within our bounds, then | 200 // Windows can figure this out. If the point isn't within our bounds, then |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 void GlassBrowserFrameView::Layout() { | 233 void GlassBrowserFrameView::Layout() { |
233 LayoutDistributorLogo(); | 234 LayoutDistributorLogo(); |
234 LayoutOTRAvatar(); | 235 LayoutOTRAvatar(); |
235 LayoutClientView(); | 236 LayoutClientView(); |
236 } | 237 } |
237 | 238 |
238 /////////////////////////////////////////////////////////////////////////////// | 239 /////////////////////////////////////////////////////////////////////////////// |
239 // GlassBrowserFrameView, private: | 240 // GlassBrowserFrameView, private: |
240 | 241 |
241 int GlassBrowserFrameView::FrameBorderThickness() const { | 242 int GlassBrowserFrameView::FrameBorderThickness() const { |
242 return browser_view_->CanCurrentlyResize() ? | 243 return (frame_->IsMaximized() || frame_->IsFullscreen()) ? |
243 GetSystemMetrics(SM_CXSIZEFRAME) : 0; | 244 0 : GetSystemMetrics(SM_CXSIZEFRAME); |
244 } | 245 } |
245 | 246 |
246 int GlassBrowserFrameView::NonClientBorderThickness() const { | 247 int GlassBrowserFrameView::NonClientBorderThickness() const { |
247 return browser_view_->CanCurrentlyResize() ? kNonClientBorderThickness : 0; | 248 return (frame_->IsMaximized() || frame_->IsFullscreen()) ? |
| 249 0 : kNonClientBorderThickness; |
248 } | 250 } |
249 | 251 |
250 int GlassBrowserFrameView::NonClientTopBorderHeight() const { | 252 int GlassBrowserFrameView::NonClientTopBorderHeight() const { |
251 if (browser_view_->IsFullscreen()) | 253 if (frame_->IsFullscreen()) |
252 return 0; | 254 return 0; |
253 // We'd like to use FrameBorderThickness() here, but the maximized Aero glass | 255 // We'd like to use FrameBorderThickness() here, but the maximized Aero glass |
254 // frame has a 0 frame border around most edges and a CXSIZEFRAME-thick border | 256 // frame has a 0 frame border around most edges and a CXSIZEFRAME-thick border |
255 // at the top (see AeroGlassFrame::OnGetMinMaxInfo()). | 257 // at the top (see AeroGlassFrame::OnGetMinMaxInfo()). |
256 return GetSystemMetrics(SM_CXSIZEFRAME) + | 258 return GetSystemMetrics(SM_CXSIZEFRAME) + |
257 (browser_view_->IsMaximized() ? 0 : kNonClientRestoredExtraThickness); | 259 (browser_view_->IsMaximized() ? 0 : kNonClientRestoredExtraThickness); |
258 } | 260 } |
259 | 261 |
260 void GlassBrowserFrameView::PaintDistributorLogo(ChromeCanvas* canvas) { | 262 void GlassBrowserFrameView::PaintDistributorLogo(ChromeCanvas* canvas) { |
261 // The distributor logo is only painted when the frame is not maximized and | 263 // The distributor logo is only painted when the frame is not maximized and |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 resources_ = new GlassBrowserWindowResources; | 426 resources_ = new GlassBrowserWindowResources; |
425 | 427 |
426 #if defined(GOOGLE_CHROME_BUILD) | 428 #if defined(GOOGLE_CHROME_BUILD) |
427 distributor_logo_ = ResourceBundle::GetSharedInstance(). | 429 distributor_logo_ = ResourceBundle::GetSharedInstance(). |
428 GetBitmapNamed(IDR_DISTRIBUTOR_LOGO); | 430 GetBitmapNamed(IDR_DISTRIBUTOR_LOGO); |
429 #endif | 431 #endif |
430 | 432 |
431 initialized = true; | 433 initialized = true; |
432 } | 434 } |
433 } | 435 } |
OLD | NEW |