| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/ui/views/frame/browser_frame.h" | 7 #include "chrome/browser/ui/views/frame/browser_frame.h" |
| 8 #include "chrome/browser/ui/views/frame/browser_view.h" | 8 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 9 #include "grit/generated_resources.h" // Accessibility names | 9 #include "grit/generated_resources.h" // Accessibility names |
| 10 #include "grit/ui_resources.h" | 10 #include "grit/ui_resources.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 namespace { | 28 namespace { |
| 29 // Our window is larger than it appears, as it includes space around the edges | 29 // Our window is larger than it appears, as it includes space around the edges |
| 30 // where resize handles can appear. | 30 // where resize handles can appear. |
| 31 const int kResizeBorderThickness = 8; | 31 const int kResizeBorderThickness = 8; |
| 32 // The top edge is a little thinner, as it is not draggable for resize. | 32 // The top edge is a little thinner, as it is not draggable for resize. |
| 33 const int kTopBorderThickness = 4; | 33 const int kTopBorderThickness = 4; |
| 34 // Offset between top of non-client frame and top edge of opaque frame | 34 // Offset between top of non-client frame and top edge of opaque frame |
| 35 // background at start of slide-in animation. | 35 // background at start of slide-in animation. |
| 36 const int kFrameBackgroundTopOffset = 25; | 36 const int kFrameBackgroundTopOffset = 25; |
| 37 | 37 |
| 38 // Width of a persistent border that we show around the window (using |
| 39 // FrameBackground), even when the resize border isn't visible. |
| 40 const int kPersistentBorderThickness = 2; |
| 41 |
| 38 // The color used to fill the frame. Opacity is handled in the layer. | 42 // The color used to fill the frame. Opacity is handled in the layer. |
| 39 const SkColor kFrameColor = SK_ColorBLACK; | 43 const SkColor kFrameColor = SK_ColorBLACK; |
| 40 // Radius of rounded rectangle corners. | 44 // Radius of rounded rectangle corners. |
| 41 const int kRoundedRectRadius = 3; | 45 const int kRoundedRectRadius = 3; |
| 42 // Frame border fades in over this range of opacity. | 46 // Frame border fades in over this range of opacity. |
| 43 const double kFrameBorderStartOpacity = 0.2; | 47 const double kFrameBorderStartOpacity = 0.2; |
| 44 const double kFrameBorderEndOpacity = 0.3; | 48 const double kFrameBorderEndOpacity = 0.3; |
| 45 // How long the hover animation takes if uninterrupted. | 49 // How long the hover animation takes if uninterrupted. |
| 46 const int kHoverFadeDurationMs = 250; | 50 const int kHoverFadeDurationMs = 250; |
| 47 | 51 |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 break; | 298 break; |
| 295 default: | 299 default: |
| 296 break; | 300 break; |
| 297 } | 301 } |
| 298 // Always show top edge for the active window so that you can tell which | 302 // Always show top edge for the active window so that you can tell which |
| 299 // window has focus. | 303 // window has focus. |
| 300 if (active_window) | 304 if (active_window) |
| 301 show_top = true; | 305 show_top = true; |
| 302 gfx::Rect target = bounds(); | 306 gfx::Rect target = bounds(); |
| 303 // Inset the sides that are not showing. | 307 // Inset the sides that are not showing. |
| 304 target.Inset((show_left ? 0 : kResizeBorderThickness), | 308 target.Inset( |
| 305 (show_top ? 0 : kTopBorderThickness + kFrameBackgroundTopOffset), | 309 (show_left ? 0 : kResizeBorderThickness - kPersistentBorderThickness), |
| 306 (show_right ? 0 : kResizeBorderThickness), | 310 (show_top ? 0 : kTopBorderThickness + kFrameBackgroundTopOffset), |
| 307 (show_bottom ? 0 : kResizeBorderThickness)); | 311 (show_right ? 0 : kResizeBorderThickness - kPersistentBorderThickness), |
| 312 (show_bottom ? 0 : kResizeBorderThickness - kPersistentBorderThickness)); |
| 308 return target; | 313 return target; |
| 309 } | 314 } |
| 310 | 315 |
| 311 void BrowserNonClientFrameViewAura::UpdateFrameBackground(bool active_window) { | 316 void BrowserNonClientFrameViewAura::UpdateFrameBackground(bool active_window) { |
| 312 gfx::Rect start_bounds = GetFrameBackgroundBounds(HTNOWHERE, active_window); | 317 gfx::Rect start_bounds = GetFrameBackgroundBounds(HTNOWHERE, active_window); |
| 313 gfx::Rect end_bounds = | 318 gfx::Rect end_bounds = |
| 314 GetFrameBackgroundBounds(last_hittest_code_, active_window); | 319 GetFrameBackgroundBounds(last_hittest_code_, active_window); |
| 315 frame_background_->Configure(start_bounds, end_bounds); | 320 frame_background_->Configure(start_bounds, end_bounds); |
| 316 } | 321 } |
| 317 | 322 |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 views::Widget* widget, bool active) { | 521 views::Widget* widget, bool active) { |
| 517 // Active windows have different background bounds. | 522 // Active windows have different background bounds. |
| 518 UpdateFrameBackground(active); | 523 UpdateFrameBackground(active); |
| 519 if (active) | 524 if (active) |
| 520 frame_background_->Show(); | 525 frame_background_->Show(); |
| 521 else | 526 else |
| 522 frame_background_->Hide(); | 527 frame_background_->Hide(); |
| 523 maximize_button_->SetVisible(active); | 528 maximize_button_->SetVisible(active); |
| 524 close_button_->SetVisible(active); | 529 close_button_->SetVisible(active); |
| 525 } | 530 } |
| OLD | NEW |