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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 : views::CustomButton(listener), | 66 : views::CustomButton(listener), |
67 color_(color), | 67 color_(color), |
68 icon_(icon) { | 68 icon_(icon) { |
69 SetPaintToLayer(true); | 69 SetPaintToLayer(true); |
70 layer()->SetFillsBoundsOpaquely(false); | 70 layer()->SetFillsBoundsOpaquely(false); |
71 } | 71 } |
72 virtual ~WindowControlButton() {} | 72 virtual ~WindowControlButton() {} |
73 | 73 |
74 // Overridden from views::View: | 74 // Overridden from views::View: |
75 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { | 75 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { |
76 canvas->FillRectInt(GetBackgroundColor(), 0, 0, width(), height()); | 76 canvas->FillRect(GetBackgroundColor(), GetLocalBounds()); |
77 canvas->DrawBitmapInt(icon_, 0, 0); | 77 canvas->DrawBitmapInt(icon_, 0, 0); |
78 } | 78 } |
79 virtual gfx::Size GetPreferredSize() OVERRIDE { | 79 virtual gfx::Size GetPreferredSize() OVERRIDE { |
80 return gfx::Size(icon_.width(), icon_.height()); | 80 return gfx::Size(icon_.width(), icon_.height()); |
81 } | 81 } |
82 | 82 |
83 private: | 83 private: |
84 SkColor GetBackgroundColor() { | 84 SkColor GetBackgroundColor() { |
85 // Only the background animates, so handle opacity manually. | 85 // Only the background animates, so handle opacity manually. |
86 return SkColorSetARGB(hover_animation_->CurrentValueBetween(0, 150), | 86 return SkColorSetARGB(hover_animation_->CurrentValueBetween(0, 150), |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 views::Widget* widget, bool active) { | 514 views::Widget* widget, bool active) { |
515 // Active windows have different background bounds. | 515 // Active windows have different background bounds. |
516 UpdateFrameBackground(active); | 516 UpdateFrameBackground(active); |
517 if (active) | 517 if (active) |
518 frame_background_->Show(); | 518 frame_background_->Show(); |
519 else | 519 else |
520 frame_background_->Hide(); | 520 frame_background_->Hide(); |
521 maximize_button_->SetVisible(active); | 521 maximize_button_->SetVisible(active); |
522 close_button_->SetVisible(active); | 522 close_button_->SetVisible(active); |
523 } | 523 } |
OLD | NEW |