| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/views/frame/opaque_browser_frame_view.h" | 5 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 // |delegate| may be NULL if called from callback of InputMethodChanged while | 203 // |delegate| may be NULL if called from callback of InputMethodChanged while |
| 204 // a window is being destroyed. | 204 // a window is being destroyed. |
| 205 // See more discussion at http://crosbug.com/8958 | 205 // See more discussion at http://crosbug.com/8958 |
| 206 if (delegate && delegate->ShouldShowWindowTitle()) { | 206 if (delegate && delegate->ShouldShowWindowTitle()) { |
| 207 return std::max(FrameBorderThickness(restored) + IconSize(), | 207 return std::max(FrameBorderThickness(restored) + IconSize(), |
| 208 CaptionButtonY(restored) + kCaptionButtonHeightWithPadding) + | 208 CaptionButtonY(restored) + kCaptionButtonHeightWithPadding) + |
| 209 TitlebarBottomThickness(restored); | 209 TitlebarBottomThickness(restored); |
| 210 } | 210 } |
| 211 | 211 |
| 212 return FrameBorderThickness(restored) - | 212 return FrameBorderThickness(restored) - |
| 213 ((browser_view()->IsTabStripVisible() && !restored && | 213 ((browser_view()->IsTabStripVisible() && |
| 214 frame()->IsMaximized()) ? kTabstripTopShadowThickness : 0); | 214 !restored && !frame()->ShouldLeaveOffsetNearTopBorder()) |
| 215 ? kTabstripTopShadowThickness : 0); |
| 215 } | 216 } |
| 216 | 217 |
| 217 /////////////////////////////////////////////////////////////////////////////// | 218 /////////////////////////////////////////////////////////////////////////////// |
| 218 // OpaqueBrowserFrameView, BrowserNonClientFrameView implementation: | 219 // OpaqueBrowserFrameView, BrowserNonClientFrameView implementation: |
| 219 | 220 |
| 220 gfx::Rect OpaqueBrowserFrameView::GetBoundsForTabStrip( | 221 gfx::Rect OpaqueBrowserFrameView::GetBoundsForTabStrip( |
| 221 views::View* tabstrip) const { | 222 views::View* tabstrip) const { |
| 222 if (!tabstrip) | 223 if (!tabstrip) |
| 223 return gfx::Rect(); | 224 return gfx::Rect(); |
| 224 | 225 |
| 225 gfx::Rect bounds = GetBoundsForTabStripAndAvatarArea(tabstrip); | 226 gfx::Rect bounds = GetBoundsForTabStripAndAvatarArea(tabstrip); |
| 226 const int space_left_of_tabstrip = browser_view()->ShouldShowAvatar() ? | 227 const int space_left_of_tabstrip = browser_view()->ShouldShowAvatar() ? |
| 227 (kAvatarLeftSpacing + avatar_bounds_.width() + kAvatarRightSpacing) : | 228 (kAvatarLeftSpacing + avatar_bounds_.width() + kAvatarRightSpacing) : |
| 228 kTabStripIndent; | 229 kTabStripIndent; |
| 229 bounds.Inset(space_left_of_tabstrip, 0, 0, 0); | 230 bounds.Inset(space_left_of_tabstrip, 0, 0, 0); |
| 230 return bounds; | 231 return bounds; |
| 231 } | 232 } |
| 232 | 233 |
| 233 BrowserNonClientFrameView::TabStripInsets | 234 BrowserNonClientFrameView::TabStripInsets |
| 234 OpaqueBrowserFrameView::GetTabStripInsets(bool restored) const { | 235 OpaqueBrowserFrameView::GetTabStripInsets(bool restored) const { |
| 235 int top = NonClientTopBorderHeight(restored) + ((!restored && | 236 int top = NonClientTopBorderHeight(restored) + ((!restored && |
| 236 (frame()->IsMaximized() || | 237 (!frame()->ShouldLeaveOffsetNearTopBorder() || |
| 237 frame()->IsFullscreen())) ? | 238 frame()->IsFullscreen())) ? |
| 238 0 : kNonClientRestoredExtraThickness); | 239 0 : kNonClientRestoredExtraThickness); |
| 239 // TODO: include OTR and caption. | 240 // TODO: include OTR and caption. |
| 240 return TabStripInsets(top, 0, 0); | 241 return TabStripInsets(top, 0, 0); |
| 241 } | 242 } |
| 242 | 243 |
| 243 int OpaqueBrowserFrameView::GetThemeBackgroundXInset() const { | 244 int OpaqueBrowserFrameView::GetThemeBackgroundXInset() const { |
| 244 return 0; | 245 return 0; |
| 245 } | 246 } |
| 246 | 247 |
| (...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1046 | 1047 |
| 1047 gfx::Rect OpaqueBrowserFrameView::CalculateClientAreaBounds(int width, | 1048 gfx::Rect OpaqueBrowserFrameView::CalculateClientAreaBounds(int width, |
| 1048 int height) const { | 1049 int height) const { |
| 1049 int top_height = NonClientTopBorderHeight(false); | 1050 int top_height = NonClientTopBorderHeight(false); |
| 1050 int border_thickness = NonClientBorderThickness(); | 1051 int border_thickness = NonClientBorderThickness(); |
| 1051 return gfx::Rect(border_thickness, top_height, | 1052 return gfx::Rect(border_thickness, top_height, |
| 1052 std::max(0, width - (2 * border_thickness)), | 1053 std::max(0, width - (2 * border_thickness)), |
| 1053 std::max(0, height - GetReservedHeight() - | 1054 std::max(0, height - GetReservedHeight() - |
| 1054 top_height - border_thickness)); | 1055 top_height - border_thickness)); |
| 1055 } | 1056 } |
| OLD | NEW |