Chromium Code Reviews| 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/browser_non_client_frame_view_aura.h" | 5 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view_aura.h" |
| 6 | 6 |
| 7 #include "ash/wm/frame_painter.h" | 7 #include "ash/wm/frame_painter.h" |
| 8 #include "ash/wm/workspace/frame_maximize_button.h" | 8 #include "ash/wm/workspace/frame_maximize_button.h" |
| 9 #include "chrome/browser/themes/theme_service.h" | 9 #include "chrome/browser/themes/theme_service.h" |
| 10 #include "chrome/browser/ui/views/frame/browser_frame.h" | 10 #include "chrome/browser/ui/views/frame/browser_frame.h" |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 | 25 |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 // Space between left edge of window and tabstrip. | 28 // Space between left edge of window and tabstrip. |
| 29 const int kTabstripLeftSpacing = 4; | 29 const int kTabstripLeftSpacing = 4; |
| 30 // Space between right edge of tabstrip and maximize button. | 30 // Space between right edge of tabstrip and maximize button. |
| 31 const int kTabstripRightSpacing = 10; | 31 const int kTabstripRightSpacing = 10; |
| 32 // Space between top of window and top of tabstrip for restored windows. | 32 // Space between top of window and top of tabstrip for restored windows. |
| 33 const int kTabstripTopSpacingRestored = 10; | 33 const int kTabstripTopSpacingRestored = 10; |
| 34 // Space between top of window and top of tabstrip for maximized windows. | 34 // Space between top of window and top of tabstrip for maximized windows. |
| 35 const int kTabstripTopSpacingMaximized = 1; | 35 // Place them flush to the top to make them clickable when the cursor is at |
| 36 // the screen edge. | |
| 37 const int kTabstripTopSpacingMaximized = 0; | |
| 36 | 38 |
| 37 } // namespace | 39 } // namespace |
| 38 | 40 |
| 39 /////////////////////////////////////////////////////////////////////////////// | 41 /////////////////////////////////////////////////////////////////////////////// |
| 40 // BrowserNonClientFrameViewAura, public: | 42 // BrowserNonClientFrameViewAura, public: |
| 41 | 43 |
| 42 BrowserNonClientFrameViewAura::BrowserNonClientFrameViewAura( | 44 BrowserNonClientFrameViewAura::BrowserNonClientFrameViewAura( |
| 43 BrowserFrame* frame, BrowserView* browser_view) | 45 BrowserFrame* frame, BrowserView* browser_view) |
| 44 : BrowserNonClientFrameView(frame, browser_view), | 46 : BrowserNonClientFrameView(frame, browser_view), |
| 45 maximize_button_(NULL), | 47 maximize_button_(NULL), |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 74 frame_painter_->Init(frame(), window_icon_, maximize_button_, close_button_); | 76 frame_painter_->Init(frame(), window_icon_, maximize_button_, close_button_); |
| 75 } | 77 } |
| 76 | 78 |
| 77 /////////////////////////////////////////////////////////////////////////////// | 79 /////////////////////////////////////////////////////////////////////////////// |
| 78 // BrowserNonClientFrameView overrides: | 80 // BrowserNonClientFrameView overrides: |
| 79 | 81 |
| 80 gfx::Rect BrowserNonClientFrameViewAura::GetBoundsForTabStrip( | 82 gfx::Rect BrowserNonClientFrameViewAura::GetBoundsForTabStrip( |
| 81 views::View* tabstrip) const { | 83 views::View* tabstrip) const { |
| 82 if (!tabstrip) | 84 if (!tabstrip) |
| 83 return gfx::Rect(); | 85 return gfx::Rect(); |
| 84 bool restored = !frame()->IsMaximized(); | |
| 85 return gfx::Rect(kTabstripLeftSpacing, | 86 return gfx::Rect(kTabstripLeftSpacing, |
| 86 GetHorizontalTabStripVerticalOffset(restored), | 87 GetHorizontalTabStripVerticalOffset(false), |
|
James Cook
2012/03/15 17:31:12
This function doesn't take the *current* restored
| |
| 87 std::max(0, maximize_button_->x() - kTabstripRightSpacing), | 88 std::max(0, maximize_button_->x() - kTabstripRightSpacing), |
| 88 tabstrip->GetPreferredSize().height()); | 89 tabstrip->GetPreferredSize().height()); |
| 89 } | 90 } |
| 90 | 91 |
| 91 int BrowserNonClientFrameViewAura::GetHorizontalTabStripVerticalOffset( | 92 int BrowserNonClientFrameViewAura::GetHorizontalTabStripVerticalOffset( |
| 92 bool force_restored) const { | 93 bool force_restored) const { |
| 93 return NonClientTopBorderHeight(force_restored); | 94 return NonClientTopBorderHeight(force_restored); |
| 94 } | 95 } |
| 95 | 96 |
| 96 void BrowserNonClientFrameViewAura::UpdateThrobber(bool running) { | 97 void BrowserNonClientFrameViewAura::UpdateThrobber(bool running) { |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 345 } | 346 } |
| 346 | 347 |
| 347 SkBitmap* BrowserNonClientFrameViewAura::GetCustomBitmap( | 348 SkBitmap* BrowserNonClientFrameViewAura::GetCustomBitmap( |
| 348 int bitmap_id, | 349 int bitmap_id, |
| 349 int fallback_bitmap_id) const { | 350 int fallback_bitmap_id) const { |
| 350 ui::ThemeProvider* tp = GetThemeProvider(); | 351 ui::ThemeProvider* tp = GetThemeProvider(); |
| 351 if (tp->HasCustomImage(bitmap_id)) | 352 if (tp->HasCustomImage(bitmap_id)) |
| 352 return tp->GetBitmapNamed(bitmap_id); | 353 return tp->GetBitmapNamed(bitmap_id); |
| 353 return tp->GetBitmapNamed(fallback_bitmap_id); | 354 return tp->GetBitmapNamed(fallback_bitmap_id); |
| 354 } | 355 } |
| OLD | NEW |