| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 SkColor color_; | 124 SkColor color_; |
| 125 SkBitmap icon_; | 125 SkBitmap icon_; |
| 126 scoped_ptr<ui::SlideAnimation> show_animation_; | 126 scoped_ptr<ui::SlideAnimation> show_animation_; |
| 127 | 127 |
| 128 DISALLOW_COPY_AND_ASSIGN(WindowControlButton); | 128 DISALLOW_COPY_AND_ASSIGN(WindowControlButton); |
| 129 }; | 129 }; |
| 130 | 130 |
| 131 // Layer that visually sits "behind" the window contents and expands out to | 131 // Layer that visually sits "behind" the window contents and expands out to |
| 132 // provide visual resize handles on the sides. Hit testing and resize handling | 132 // provide visual resize handles on the sides. Hit testing and resize handling |
| 133 // is in the parent NonClientFrameView. | 133 // is in the parent NonClientFrameView. |
| 134 class FrameBackground : public views::View, | 134 class FrameBackgroundView : public views::View, |
| 135 public ui::AnimationDelegate { | 135 public ui::AnimationDelegate { |
| 136 public: | 136 public: |
| 137 FrameBackground() | 137 FrameBackgroundView() |
| 138 : ALLOW_THIS_IN_INITIALIZER_LIST( | 138 : ALLOW_THIS_IN_INITIALIZER_LIST( |
| 139 size_animation_(new ui::SlideAnimation(this))), | 139 size_animation_(new ui::SlideAnimation(this))), |
| 140 ALLOW_THIS_IN_INITIALIZER_LIST( | 140 ALLOW_THIS_IN_INITIALIZER_LIST( |
| 141 color_animation_(new ui::SlideAnimation(this))) { | 141 color_animation_(new ui::SlideAnimation(this))) { |
| 142 size_animation_->SetSlideDuration(kHoverFadeDurationMs); | 142 size_animation_->SetSlideDuration(kHoverFadeDurationMs); |
| 143 color_animation_->SetSlideDuration(kHoverFadeDurationMs); | 143 color_animation_->SetSlideDuration(kHoverFadeDurationMs); |
| 144 SetPaintToLayer(true); | 144 SetPaintToLayer(true); |
| 145 UpdateOpacity(); | 145 UpdateOpacity(); |
| 146 } | 146 } |
| 147 virtual ~FrameBackground() { | 147 virtual ~FrameBackgroundView() { |
| 148 } | 148 } |
| 149 | 149 |
| 150 void Configure(const gfx::Rect& start_bounds, const gfx::Rect& end_bounds) { | 150 void Configure(const gfx::Rect& start_bounds, const gfx::Rect& end_bounds) { |
| 151 start_bounds_ = start_bounds; | 151 start_bounds_ = start_bounds; |
| 152 end_bounds_ = end_bounds; | 152 end_bounds_ = end_bounds; |
| 153 UpdateBounds(); | 153 UpdateBounds(); |
| 154 } | 154 } |
| 155 void SetEndBounds(const gfx::Rect& end_bounds) { | 155 void SetEndBounds(const gfx::Rect& end_bounds) { |
| 156 end_bounds_ = end_bounds; | 156 end_bounds_ = end_bounds; |
| 157 UpdateBounds(); | 157 UpdateBounds(); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 scoped_ptr<ui::SlideAnimation> size_animation_; | 204 scoped_ptr<ui::SlideAnimation> size_animation_; |
| 205 scoped_ptr<ui::SlideAnimation> color_animation_; | 205 scoped_ptr<ui::SlideAnimation> color_animation_; |
| 206 // Default "hidden" rectangle. | 206 // Default "hidden" rectangle. |
| 207 gfx::Rect default_bounds_; | 207 gfx::Rect default_bounds_; |
| 208 // When moving mouse from one target to another (e.g. from edge to corner) | 208 // When moving mouse from one target to another (e.g. from edge to corner) |
| 209 // the size animation start point may not be the default size. | 209 // the size animation start point may not be the default size. |
| 210 gfx::Rect start_bounds_; | 210 gfx::Rect start_bounds_; |
| 211 // Expanded bounds, with edges visible from behind the client area. | 211 // Expanded bounds, with edges visible from behind the client area. |
| 212 gfx::Rect end_bounds_; | 212 gfx::Rect end_bounds_; |
| 213 | 213 |
| 214 DISALLOW_COPY_AND_ASSIGN(FrameBackground); | 214 DISALLOW_COPY_AND_ASSIGN(FrameBackgroundView); |
| 215 }; | 215 }; |
| 216 | 216 |
| 217 /////////////////////////////////////////////////////////////////////////////// | 217 /////////////////////////////////////////////////////////////////////////////// |
| 218 // BrowserNonClientFrameViewAura, public: | 218 // BrowserNonClientFrameViewAura, public: |
| 219 | 219 |
| 220 BrowserNonClientFrameViewAura::BrowserNonClientFrameViewAura( | 220 BrowserNonClientFrameViewAura::BrowserNonClientFrameViewAura( |
| 221 BrowserFrame* frame, BrowserView* browser_view) | 221 BrowserFrame* frame, BrowserView* browser_view) |
| 222 : BrowserNonClientFrameView(frame, browser_view), | 222 : BrowserNonClientFrameView(frame, browser_view), |
| 223 last_hittest_code_(HTNOWHERE) { | 223 last_hittest_code_(HTNOWHERE) { |
| 224 frame_background_ = new FrameBackground(); | 224 frame_background_ = new FrameBackgroundView(); |
| 225 AddChildView(frame_background_); | 225 AddChildView(frame_background_); |
| 226 | 226 |
| 227 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 227 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 228 maximize_button_ = | 228 maximize_button_ = |
| 229 new WindowControlButton(this, | 229 new WindowControlButton(this, |
| 230 kMaximizeButtonBackgroundColor, | 230 kMaximizeButtonBackgroundColor, |
| 231 *rb.GetBitmapNamed(IDR_AURA_WINDOW_ZOOM_ICON)); | 231 *rb.GetBitmapNamed(IDR_AURA_WINDOW_ZOOM_ICON)); |
| 232 maximize_button_->SetAccessibleName( | 232 maximize_button_->SetAccessibleName( |
| 233 l10n_util::GetStringUTF16(IDS_ACCNAME_MAXIMIZE)); | 233 l10n_util::GetStringUTF16(IDS_ACCNAME_MAXIMIZE)); |
| 234 AddChildView(maximize_button_); | 234 AddChildView(maximize_button_); |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 | 573 |
| 574 void BrowserNonClientFrameViewAura::OnWindowHoverChanged(bool hovered) { | 574 void BrowserNonClientFrameViewAura::OnWindowHoverChanged(bool hovered) { |
| 575 if (hovered) { | 575 if (hovered) { |
| 576 maximize_button_->Show(); | 576 maximize_button_->Show(); |
| 577 close_button_->Show(); | 577 close_button_->Show(); |
| 578 } else { | 578 } else { |
| 579 maximize_button_->Hide(); | 579 maximize_button_->Hide(); |
| 580 close_button_->Hide(); | 580 close_button_->Hide(); |
| 581 } | 581 } |
| 582 } | 582 } |
| OLD | NEW |