| 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 "app/gfx/canvas.h" | 7 #include "app/gfx/canvas.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "app/theme_provider.h" | 9 #include "app/theme_provider.h" |
| 10 #include "chrome/browser/browser_theme_provider.h" | 10 #include "chrome/browser/browser_theme_provider.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 // In maximized mode, the OTR avatar starts 2 px below the top of the screen, so | 34 // In maximized mode, the OTR avatar starts 2 px below the top of the screen, so |
| 35 // that it doesn't extend into the "3D edge" portion of the titlebar. | 35 // that it doesn't extend into the "3D edge" portion of the titlebar. |
| 36 const int kOTRMaximizedTopSpacing = 2; | 36 const int kOTRMaximizedTopSpacing = 2; |
| 37 // The OTR avatar ends 2 px above the bottom of the tabstrip (which, given the | 37 // The OTR avatar ends 2 px above the bottom of the tabstrip (which, given the |
| 38 // way the tabstrip draws its bottom edge, will appear like a 1 px gap to the | 38 // way the tabstrip draws its bottom edge, will appear like a 1 px gap to the |
| 39 // user). | 39 // user). |
| 40 const int kOTRBottomSpacing = 2; | 40 const int kOTRBottomSpacing = 2; |
| 41 // There are 2 px on each side of the OTR avatar (between the frame border and | 41 // There are 2 px on each side of the OTR avatar (between the frame border and |
| 42 // it on the left, and between it and the tabstrip on the right). | 42 // it on the left, and between it and the tabstrip on the right). |
| 43 const int kOTRSideSpacing = 2; | 43 const int kOTRSideSpacing = 2; |
| 44 // The top 1 px of the tabstrip is shadow; in maximized mode we push this off |
| 45 // the top of the screen so the tabs appear flush against the screen edge. |
| 46 const int kTabstripTopShadowThickness = 1; |
| 44 // In restored mode, the New Tab button isn't at the same height as the caption | 47 // In restored mode, the New Tab button isn't at the same height as the caption |
| 45 // buttons, but the space will look cluttered if it actually slides under them, | 48 // buttons, but the space will look cluttered if it actually slides under them, |
| 46 // so we stop it when the gap between the two is down to 5 px. | 49 // so we stop it when the gap between the two is down to 5 px. |
| 47 const int kNewTabCaptionRestoredSpacing = 5; | 50 const int kNewTabCaptionRestoredSpacing = 5; |
| 48 // In maximized mode, where the New Tab button and the caption buttons are at | 51 // In maximized mode, where the New Tab button and the caption buttons are at |
| 49 // similar vertical coordinates, we need to reserve a larger, 16 px gap to avoid | 52 // similar vertical coordinates, we need to reserve a larger, 16 px gap to avoid |
| 50 // looking too cluttered. | 53 // looking too cluttered. |
| 51 const int kNewTabCaptionMaximizedSpacing = 16; | 54 const int kNewTabCaptionMaximizedSpacing = 16; |
| 52 // When there's a distributor logo, we leave a 7 px gap between it and the | 55 // When there's a distributor logo, we leave a 7 px gap between it and the |
| 53 // caption buttons. | 56 // caption buttons. |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 return (window->IsMaximized() || window->IsFullscreen()) ? | 215 return (window->IsMaximized() || window->IsFullscreen()) ? |
| 213 0 : kNonClientBorderThickness; | 216 0 : kNonClientBorderThickness; |
| 214 } | 217 } |
| 215 | 218 |
| 216 int GlassBrowserFrameView::NonClientTopBorderHeight() const { | 219 int GlassBrowserFrameView::NonClientTopBorderHeight() const { |
| 217 if (frame_->GetWindow()->IsFullscreen()) | 220 if (frame_->GetWindow()->IsFullscreen()) |
| 218 return 0; | 221 return 0; |
| 219 // We'd like to use FrameBorderThickness() here, but the maximized Aero glass | 222 // We'd like to use FrameBorderThickness() here, but the maximized Aero glass |
| 220 // frame has a 0 frame border around most edges and a CXSIZEFRAME-thick border | 223 // frame has a 0 frame border around most edges and a CXSIZEFRAME-thick border |
| 221 // at the top (see AeroGlassFrame::OnGetMinMaxInfo()). | 224 // at the top (see AeroGlassFrame::OnGetMinMaxInfo()). |
| 222 return GetSystemMetrics(SM_CXSIZEFRAME) + | 225 return GetSystemMetrics(SM_CXSIZEFRAME) + (browser_view_->IsMaximized() ? |
| 223 (browser_view_->IsMaximized() ? 0 : kNonClientRestoredExtraThickness); | 226 -kTabstripTopShadowThickness : kNonClientRestoredExtraThickness); |
| 224 } | 227 } |
| 225 | 228 |
| 226 void GlassBrowserFrameView::PaintDistributorLogo(gfx::Canvas* canvas) { | 229 void GlassBrowserFrameView::PaintDistributorLogo(gfx::Canvas* canvas) { |
| 227 // The distributor logo is only painted when the frame is not maximized and | 230 // The distributor logo is only painted when the frame is not maximized and |
| 228 // when we actually have a logo. | 231 // when we actually have a logo. |
| 229 if (!frame_->GetWindow()->IsMaximized() && distributor_logo_ && | 232 if (!frame_->GetWindow()->IsMaximized() && distributor_logo_ && |
| 230 browser_view_->ShouldShowDistributorLogo()) { | 233 browser_view_->ShouldShowDistributorLogo()) { |
| 231 // NOTE: We don't mirror the logo placement here because the outer frame | 234 // NOTE: We don't mirror the logo placement here because the outer frame |
| 232 // itself isn't mirrored in RTL. This is a bug; if it is fixed, this should | 235 // itself isn't mirrored in RTL. This is a bug; if it is fixed, this should |
| 233 // be mirrored as in opaque_non_client_view.cc. | 236 // be mirrored as in opaque_non_client_view.cc. |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 static bool initialized = false; | 436 static bool initialized = false; |
| 434 if (!initialized) { | 437 if (!initialized) { |
| 435 #if defined(GOOGLE_CHROME_BUILD) | 438 #if defined(GOOGLE_CHROME_BUILD) |
| 436 distributor_logo_ = ResourceBundle::GetSharedInstance(). | 439 distributor_logo_ = ResourceBundle::GetSharedInstance(). |
| 437 GetBitmapNamed(IDR_DISTRIBUTOR_LOGO); | 440 GetBitmapNamed(IDR_DISTRIBUTOR_LOGO); |
| 438 #endif | 441 #endif |
| 439 | 442 |
| 440 initialized = true; | 443 initialized = true; |
| 441 } | 444 } |
| 442 } | 445 } |
| OLD | NEW |