| 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/glass_browser_frame_view.h" | 5 #include "chrome/browser/ui/views/frame/glass_browser_frame_view.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "base/win/windows_version.h" | 9 #include "base/win/windows_version.h" |
| 10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #include "ui/views/win/hwnd_util.h" | 36 #include "ui/views/win/hwnd_util.h" |
| 37 #include "ui/views/window/client_view.h" | 37 #include "ui/views/window/client_view.h" |
| 38 | 38 |
| 39 HICON GlassBrowserFrameView::throbber_icons_[ | 39 HICON GlassBrowserFrameView::throbber_icons_[ |
| 40 GlassBrowserFrameView::kThrobberIconCount]; | 40 GlassBrowserFrameView::kThrobberIconCount]; |
| 41 | 41 |
| 42 namespace { | 42 namespace { |
| 43 // Size of client edge drawn inside the outer frame borders. | 43 // Size of client edge drawn inside the outer frame borders. |
| 44 const int kNonClientBorderThicknessPreWin10 = 3; | 44 const int kNonClientBorderThicknessPreWin10 = 3; |
| 45 const int kNonClientBorderThicknessWin10 = 1; | 45 const int kNonClientBorderThicknessWin10 = 1; |
| 46 // Besides the frame border, there's another 9 px of empty space atop the | 46 // Besides the frame border, there's empty space atop the window in restored |
| 47 // window in restored mode, to use to drag the window around. | 47 // mode, to use to drag the window around. |
| 48 const int kNonClientRestoredExtraThickness = 9; | 48 const int kNonClientRestoredExtraThickness = 11; |
| 49 // In the window corners, the resize areas don't actually expand bigger, but the | 49 // In the window corners, the resize areas don't actually expand bigger, but the |
| 50 // 16 px at the end of the top and bottom edges triggers diagonal resizing. | 50 // 16 px at the end of the top and bottom edges triggers diagonal resizing. |
| 51 const int kResizeCornerWidth = 16; | 51 const int kResizeCornerWidth = 16; |
| 52 // How far the new avatar button is from the left of the minimize button. | 52 // How far the new avatar button is from the left of the minimize button. |
| 53 const int kNewAvatarButtonOffset = 5; | 53 const int kNewAvatarButtonOffset = 5; |
| 54 // The content left/right images have a shadow built into them. | 54 // The content left/right images have a shadow built into them. |
| 55 const int kContentEdgeShadowThickness = 2; | 55 const int kContentEdgeShadowThickness = 2; |
| 56 // In restored mode, the New Tab button isn't at the same height as the caption | 56 // In restored mode, the New Tab button isn't at the same height as the caption |
| 57 // buttons, but the space will look cluttered if it actually slides under them, | 57 // buttons, but the space will look cluttered if it actually slides under them, |
| 58 // so we stop it when the gap between the two is down to 5 px. | 58 // so we stop it when the gap between the two is down to 5 px. |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 | 321 |
| 322 return (base::win::GetVersion() <= base::win::VERSION_WIN8_1) | 322 return (base::win::GetVersion() <= base::win::VERSION_WIN8_1) |
| 323 ? kNonClientBorderThicknessPreWin10 | 323 ? kNonClientBorderThicknessPreWin10 |
| 324 : kNonClientBorderThicknessWin10; | 324 : kNonClientBorderThicknessWin10; |
| 325 } | 325 } |
| 326 | 326 |
| 327 int GlassBrowserFrameView::NonClientTopBorderHeight() const { | 327 int GlassBrowserFrameView::NonClientTopBorderHeight() const { |
| 328 if (frame()->IsFullscreen()) | 328 if (frame()->IsFullscreen()) |
| 329 return 0; | 329 return 0; |
| 330 | 330 |
| 331 const int top = FrameTopBorderHeight(); |
| 331 // The tab top inset is equal to the height of any shadow region above the | 332 // The tab top inset is equal to the height of any shadow region above the |
| 332 // tabs, plus a 1 px top stroke. In maximized mode, we want to push the | 333 // tabs, plus a 1 px top stroke. In maximized mode, we want to push the |
| 333 // shadow region off the top of the screen. | 334 // shadow region off the top of the screen but leave the top stroke. |
| 334 const int tab_shadow_height = GetLayoutInsets(TAB).top() - 1; | 335 // Annoyingly, the pre-MD layout uses different heights for the hit-test |
| 335 return FrameTopBorderHeight() + | 336 // exclusion region (which we want here, since we're trying to size the border |
| 336 (frame()->IsMaximized() ? | 337 // so that the region above the tab's hit-test zone matches) versus the shadow |
| 337 -tab_shadow_height : kNonClientRestoredExtraThickness); | 338 // thickness. |
| 339 const int exclusion = GetLayoutConstant(TAB_TOP_EXCLUSION_HEIGHT); |
| 340 return frame()->IsMaximized() ? |
| 341 (top - GetLayoutInsets(TAB).top() + 1) : |
| 342 (top + kNonClientRestoredExtraThickness - exclusion); |
| 338 } | 343 } |
| 339 | 344 |
| 340 void GlassBrowserFrameView::PaintToolbarBackground(gfx::Canvas* canvas) { | 345 void GlassBrowserFrameView::PaintToolbarBackground(gfx::Canvas* canvas) { |
| 341 ui::ThemeProvider* tp = GetThemeProvider(); | 346 ui::ThemeProvider* tp = GetThemeProvider(); |
| 342 | 347 |
| 343 gfx::Rect toolbar_bounds(browser_view()->GetToolbarBounds()); | 348 gfx::Rect toolbar_bounds(browser_view()->GetToolbarBounds()); |
| 344 gfx::Point toolbar_origin(toolbar_bounds.origin()); | 349 gfx::Point toolbar_origin(toolbar_bounds.origin()); |
| 345 View::ConvertPointToTarget(browser_view(), this, &toolbar_origin); | 350 View::ConvertPointToTarget(browser_view(), this, &toolbar_origin); |
| 346 toolbar_bounds.set_origin(toolbar_origin); | 351 toolbar_bounds.set_origin(toolbar_origin); |
| 347 int x = toolbar_bounds.x(); | 352 int x = toolbar_bounds.x(); |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 static bool initialized = false; | 633 static bool initialized = false; |
| 629 if (!initialized) { | 634 if (!initialized) { |
| 630 for (int i = 0; i < kThrobberIconCount; ++i) { | 635 for (int i = 0; i < kThrobberIconCount; ++i) { |
| 631 throbber_icons_[i] = | 636 throbber_icons_[i] = |
| 632 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i); | 637 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i); |
| 633 DCHECK(throbber_icons_[i]); | 638 DCHECK(throbber_icons_[i]); |
| 634 } | 639 } |
| 635 initialized = true; | 640 initialized = true; |
| 636 } | 641 } |
| 637 } | 642 } |
| OLD | NEW |