Chromium Code Reviews| 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_non_client_view.h" | 5 #include "chrome/browser/views/frame/aero_glass_non_client_view.h" |
| 6 | 6 |
| 7 #include "chrome/app/theme/theme_resources.h" | 7 #include "chrome/app/theme/theme_resources.h" |
| 8 #include "chrome/browser/views/frame/browser_view.h" | 8 #include "chrome/browser/views/frame/browser_view.h" |
| 9 #include "chrome/browser/views/tabs/tab_strip.h" | 9 #include "chrome/browser/views/tabs/tab_strip.h" |
| 10 #include "chrome/common/gfx/chrome_canvas.h" | 10 #include "chrome/common/gfx/chrome_canvas.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 SkBitmap AeroGlassWindowResources::app_top_center_; | 86 SkBitmap AeroGlassWindowResources::app_top_center_; |
| 87 SkBitmap AeroGlassWindowResources::app_top_right_; | 87 SkBitmap AeroGlassWindowResources::app_top_right_; |
| 88 | 88 |
| 89 AeroGlassWindowResources* AeroGlassNonClientView::resources_ = NULL; | 89 AeroGlassWindowResources* AeroGlassNonClientView::resources_ = NULL; |
| 90 SkBitmap AeroGlassNonClientView::distributor_logo_; | 90 SkBitmap AeroGlassNonClientView::distributor_logo_; |
| 91 | 91 |
| 92 // The distance between the top of the TabStrip and the top of the non-client | 92 // The distance between the top of the TabStrip and the top of the non-client |
| 93 // area of the window. | 93 // area of the window. |
| 94 static const int kNoTitleTopSpacing = 8; | 94 static const int kNoTitleTopSpacing = 8; |
| 95 // The width of the client edge to the left and right of the window. | 95 // The width of the client edge to the left and right of the window. |
| 96 static const int kWindowHorizontalClientEdgeWidth = 2; | 96 static const int kWindowHorizontalClientEdgeWidth = 3; |
| 97 // The height of the client edge to the bottom of the window. | 97 // The height of the client edge to the bottom of the window. |
| 98 static const int kWindowBottomClientEdgeHeight = 2; | 98 static const int kWindowBottomClientEdgeHeight = 2; |
| 99 // The horizontal distance between the left of the minimize button and the | 99 // The horizontal distance between the left of the minimize button and the |
| 100 // right edge of the distributor logo. | 100 // right edge of the distributor logo. |
| 101 static const int kDistributorLogoHorizontalOffset = 7; | 101 static const int kDistributorLogoHorizontalOffset = 7; |
| 102 // The distance from the top of the non-client view and the top edge of the | 102 // The distance from the top of the non-client view and the top edge of the |
| 103 // distributor logo. | 103 // distributor logo. |
| 104 static const int kDistributorLogoVerticalOffset = 3; | 104 static const int kDistributorLogoVerticalOffset = 3; |
| 105 // The distance of the TabStrip from the top of the window's client area. | 105 // The distance of the TabStrip from the top of the window's client area. |
| 106 static const int kTabStripY = 14; | 106 static const int kTabStripY = 19; |
| 107 // How much space on the right is not used for the tab strip (to provide | |
| 108 // separation between the tabs and the window controls). | |
| 109 static const int kTabStripRightHorizOffset = 30; | |
| 107 // A single pixel. | 110 // A single pixel. |
| 108 static const int kPixel = 1; | 111 static const int kPixel = 1; |
| 109 // The height of the sizing border. | 112 // The height of the sizing border. |
| 110 static const int kWindowSizingBorderSize = 8; | 113 static const int kWindowSizingBorderSize = 8; |
| 111 // The size (width/height) of the window icon. | 114 // The size (width/height) of the window icon. |
| 112 static const int kWindowIconSize = 16; | 115 static const int kWindowIconSize = 16; |
| 113 // The distance from the left of the window of the OTR avatar icon. | 116 // The distance from the left of the window of the OTR avatar icon. |
| 114 static const int kOTRAvatarIconMargin = 9; | 117 static const int kOTRAvatarIconMargin = 9; |
| 115 // The distance from the right edge of the OTR avatar icon to the left edge of | 118 // The distance from the right edge of the OTR avatar icon to the left edge of |
| 116 // the TabStrip. | 119 // the TabStrip. |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 129 BrowserView* browser_view) | 132 BrowserView* browser_view) |
| 130 : frame_(frame), | 133 : frame_(frame), |
| 131 browser_view_(browser_view) { | 134 browser_view_(browser_view) { |
| 132 InitClass(); | 135 InitClass(); |
| 133 } | 136 } |
| 134 | 137 |
| 135 AeroGlassNonClientView::~AeroGlassNonClientView() { | 138 AeroGlassNonClientView::~AeroGlassNonClientView() { |
| 136 } | 139 } |
| 137 | 140 |
| 138 gfx::Rect AeroGlassNonClientView::GetBoundsForTabStrip(TabStrip* tabstrip) { | 141 gfx::Rect AeroGlassNonClientView::GetBoundsForTabStrip(TabStrip* tabstrip) { |
| 139 // If we are maximized, the tab strip will be in line with the window | 142 int tabstrip_x = browser_view_->ShouldShowOffTheRecordAvatar() ? |
| 140 // controls, so we need to make sure they don't overlap. | 143 (otr_avatar_bounds_.right() + kOTRAvatarIconTabStripSpacing) : |
| 141 int tabstrip_width = browser_view_->width() - otr_avatar_bounds_.width() - | 144 kWindowHorizontalClientEdgeWidth; |
| 142 kOTRAvatarIconTabStripSpacing; | 145 int tabstrip_width = width() - tabstrip_x - kTabStripRightHorizOffset - |
| 143 if(frame_->IsMaximized()) { | 146 (frame_->IsMaximized() ? frame_->GetMinimizeButtonOffset() : 0); |
| 144 TITLEBARINFOEX titlebar_info; | 147 int tabstrip_y = |
| 145 titlebar_info.cbSize = sizeof(TITLEBARINFOEX); | 148 frame_->IsMaximized() ? (CalculateNonClientTopHeight() - 2) : kTabStripY; |
|
Glen Murphy
2009/02/03 01:30:01
Could you describe what the '2' is?
| |
| 146 SendMessage(frame_->GetHWND(), WM_GETTITLEBARINFOEX, 0, | 149 return gfx::Rect(tabstrip_x, tabstrip_y, std::max(0, tabstrip_width), |
| 147 reinterpret_cast<WPARAM>(&titlebar_info)); | 150 tabstrip->GetPreferredHeight()); |
| 148 tabstrip_width = titlebar_info.rgrect[2].left; // Edge of minimize button | |
| 149 } | |
| 150 int tabstrip_height = tabstrip->GetPreferredHeight(); | |
| 151 int tabstrip_x = otr_avatar_bounds_.width() + kOTRAvatarIconTabStripSpacing; | |
| 152 int tabstrip_y = frame_->IsMaximized() ? 0 : kTabStripY; | |
| 153 return gfx::Rect(tabstrip_x, tabstrip_y, tabstrip_width, tabstrip_height); | |
| 154 } | 151 } |
| 155 | 152 |
| 156 /////////////////////////////////////////////////////////////////////////////// | 153 /////////////////////////////////////////////////////////////////////////////// |
| 157 // AeroGlassNonClientView, views::NonClientView implementation: | 154 // AeroGlassNonClientView, views::NonClientView implementation: |
| 158 | 155 |
| 159 gfx::Rect AeroGlassNonClientView::CalculateClientAreaBounds(int win_width, | 156 gfx::Rect AeroGlassNonClientView::CalculateClientAreaBounds(int win_width, |
| 160 int win_height) cons t { | 157 int win_height) cons t { |
| 161 if (!browser_view_->IsToolbarVisible()) { | 158 if (!browser_view_->IsToolbarVisible()) { |
| 162 // App windows don't have a toolbar. | 159 // App windows don't have a toolbar. |
| 163 return gfx::Rect(0, 0, width(), height()); | 160 return gfx::Rect(0, 0, width(), height()); |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 423 resources_ = new AeroGlassWindowResources; | 420 resources_ = new AeroGlassWindowResources; |
| 424 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 421 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 425 #if defined(GOOGLE_CHROME_BUILD) | 422 #if defined(GOOGLE_CHROME_BUILD) |
| 426 distributor_logo_ = *rb.GetBitmapNamed(IDR_DISTRIBUTOR_LOGO); | 423 distributor_logo_ = *rb.GetBitmapNamed(IDR_DISTRIBUTOR_LOGO); |
| 427 #endif | 424 #endif |
| 428 | 425 |
| 429 initialized = true; | 426 initialized = true; |
| 430 } | 427 } |
| 431 } | 428 } |
| 432 | 429 |
| OLD | NEW |