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/ash/browser_non_client_frame_view_ash.h" | 5 #include "chrome/browser/ui/views/ash/browser_non_client_frame_view_ash.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/avatar_menu_button.h" | 10 #include "chrome/browser/ui/views/avatar_menu_button.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 // to hit easily. | 51 // to hit easily. |
52 const int kTabShadowHeight = 4; | 52 const int kTabShadowHeight = 4; |
53 // Height of the shadow of the content area, at the top of the toolbar. | 53 // Height of the shadow of the content area, at the top of the toolbar. |
54 const int kContentShadowHeight = 1; | 54 const int kContentShadowHeight = 1; |
55 | 55 |
56 } // namespace | 56 } // namespace |
57 | 57 |
58 /////////////////////////////////////////////////////////////////////////////// | 58 /////////////////////////////////////////////////////////////////////////////// |
59 // BrowserNonClientFrameViewAsh, public: | 59 // BrowserNonClientFrameViewAsh, public: |
60 | 60 |
| 61 // static |
| 62 const char BrowserNonClientFrameViewAsh::kViewClassName[] = |
| 63 "BrowserNonClientFrameViewAsh"; |
| 64 |
61 BrowserNonClientFrameViewAsh::BrowserNonClientFrameViewAsh( | 65 BrowserNonClientFrameViewAsh::BrowserNonClientFrameViewAsh( |
62 BrowserFrame* frame, BrowserView* browser_view) | 66 BrowserFrame* frame, BrowserView* browser_view) |
63 : BrowserNonClientFrameView(frame, browser_view), | 67 : BrowserNonClientFrameView(frame, browser_view), |
64 size_button_(NULL), | 68 size_button_(NULL), |
65 close_button_(NULL), | 69 close_button_(NULL), |
66 window_icon_(NULL), | 70 window_icon_(NULL), |
67 frame_painter_(new ash::FramePainter), | 71 frame_painter_(new ash::FramePainter), |
68 size_button_minimizes_(false) { | 72 size_button_minimizes_(false) { |
69 } | 73 } |
70 | 74 |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 void BrowserNonClientFrameViewAsh::Layout() { | 212 void BrowserNonClientFrameViewAsh::Layout() { |
209 // Maximized windows and app/popup windows use shorter buttons. | 213 // Maximized windows and app/popup windows use shorter buttons. |
210 bool maximized_layout = | 214 bool maximized_layout = |
211 frame()->IsMaximized() || !browser_view()->IsBrowserTypeNormal(); | 215 frame()->IsMaximized() || !browser_view()->IsBrowserTypeNormal(); |
212 frame_painter_->LayoutHeader(this, maximized_layout); | 216 frame_painter_->LayoutHeader(this, maximized_layout); |
213 if (avatar_button()) | 217 if (avatar_button()) |
214 LayoutAvatar(); | 218 LayoutAvatar(); |
215 BrowserNonClientFrameView::Layout(); | 219 BrowserNonClientFrameView::Layout(); |
216 } | 220 } |
217 | 221 |
| 222 std::string BrowserNonClientFrameViewAsh::GetClassName() const { |
| 223 return kViewClassName; |
| 224 } |
| 225 |
218 bool BrowserNonClientFrameViewAsh::HitTest(const gfx::Point& l) const { | 226 bool BrowserNonClientFrameViewAsh::HitTest(const gfx::Point& l) const { |
219 // If the point is outside the bounds of the client area, claim it. | 227 // If the point is outside the bounds of the client area, claim it. |
220 if (NonClientFrameView::HitTest(l)) | 228 if (NonClientFrameView::HitTest(l)) |
221 return true; | 229 return true; |
222 | 230 |
223 // Otherwise claim it only if it's in a non-tab portion of the tabstrip. | 231 // Otherwise claim it only if it's in a non-tab portion of the tabstrip. |
224 if (!browser_view()->tabstrip()) | 232 if (!browser_view()->tabstrip()) |
225 return false; | 233 return false; |
226 gfx::Rect tabstrip_bounds(browser_view()->tabstrip()->bounds()); | 234 gfx::Rect tabstrip_bounds(browser_view()->tabstrip()->bounds()); |
227 gfx::Point tabstrip_origin(tabstrip_bounds.origin()); | 235 gfx::Point tabstrip_origin(tabstrip_bounds.origin()); |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 BrowserNonClientFrameViewAsh::GetThemeFrameOverlayBitmap() const { | 451 BrowserNonClientFrameViewAsh::GetThemeFrameOverlayBitmap() const { |
444 ui::ThemeProvider* tp = GetThemeProvider(); | 452 ui::ThemeProvider* tp = GetThemeProvider(); |
445 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) && | 453 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) && |
446 browser_view()->IsBrowserTypeNormal() && | 454 browser_view()->IsBrowserTypeNormal() && |
447 !browser_view()->IsOffTheRecord()) { | 455 !browser_view()->IsOffTheRecord()) { |
448 return tp->GetBitmapNamed(ShouldPaintAsActive() ? | 456 return tp->GetBitmapNamed(ShouldPaintAsActive() ? |
449 IDR_THEME_FRAME_OVERLAY : IDR_THEME_FRAME_OVERLAY_INACTIVE); | 457 IDR_THEME_FRAME_OVERLAY : IDR_THEME_FRAME_OVERLAY_INACTIVE); |
450 } | 458 } |
451 return NULL; | 459 return NULL; |
452 } | 460 } |
OLD | NEW |