| 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 "ash/wm/panel_frame_view.h" | 5 #include "ash/wm/panel_frame_view.h" |
| 6 #include "ash/wm/frame_painter.h" | 6 #include "ash/wm/frame_painter.h" |
| 7 #include "grit/ui_resources.h" | 7 #include "grit/ui_resources.h" |
| 8 #include "grit/ui_strings.h" // Accessibility names | 8 #include "grit/ui_strings.h" // Accessibility names |
| 9 #include "third_party/skia/include/core/SkPaint.h" | 9 #include "third_party/skia/include/core/SkPaint.h" |
| 10 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
| 11 #include "ui/aura/cursor.h" | 11 #include "ui/aura/cursor.h" |
| 12 #include "ui/base/animation/throb_animation.h" | 12 #include "ui/base/animation/throb_animation.h" |
| 13 #include "ui/base/hit_test.h" | 13 #include "ui/base/hit_test.h" |
| 14 #include "ui/base/resource/resource_bundle.h" | 14 #include "ui/base/resource/resource_bundle.h" |
| 15 #include "ui/gfx/canvas.h" | 15 #include "ui/gfx/canvas.h" |
| 16 #include "ui/gfx/font.h" | 16 #include "ui/gfx/font.h" |
| 17 #include "ui/gfx/image/image.h" | 17 #include "ui/gfx/image/image.h" |
| 18 #include "ui/views/controls/button/image_button.h" | 18 #include "ui/views/controls/button/image_button.h" |
| 19 #include "ui/views/widget/native_widget_aura.h" | 19 #include "ui/views/widget/native_widget_aura.h" |
| 20 #include "ui/views/widget/widget.h" | 20 #include "ui/views/widget/widget.h" |
| 21 #include "ui/views/widget/widget_delegate.h" | 21 #include "ui/views/widget/widget_delegate.h" |
| 22 | 22 |
| 23 namespace ash { | 23 namespace ash { |
| 24 | 24 |
| 25 PanelFrameView::PanelFrameView(views::Widget* frame) | 25 PanelFrameView::PanelFrameView(views::Widget* frame) |
| 26 : frame_painter_(new FramePainter) { | 26 : frame_painter_(new FramePainter) { |
| 27 close_button_ = new views::ImageButton(this); | 27 close_button_ = new views::ImageButton(this); |
| 28 close_button_->SetAccessibleName( | 28 close_button_->SetAccessibleName( |
| 29 l10n_util::GetStringUTF16(IDS_APP_ACCNAME_CLOSE)); | 29 l10n_util::GetStringUTF16(IDS_APP_ACCNAME_CLOSE)); |
| 30 AddChildView(close_button_); | 30 AddChildView(close_button_); |
| 31 | 31 |
| 32 minimize_button_ = new views::ImageButton(this); | 32 minimize_button_ = new views::ImageButton(this); |
| 33 minimize_button_->SetAccessibleName( | 33 minimize_button_->SetAccessibleName( |
| 34 l10n_util::GetStringUTF16(IDS_APP_ACCNAME_MINIMIZE)); | 34 l10n_util::GetStringUTF16(IDS_APP_ACCNAME_MINIMIZE)); |
| 35 AddChildView(minimize_button_); | 35 AddChildView(minimize_button_); |
| 36 | 36 |
| 37 frame_painter_->Init(frame, NULL, minimize_button_, close_button_); | 37 frame_painter_->Init(frame, NULL, minimize_button_, close_button_, |
| 38 FramePainter::SIZE_BUTTON_MINIMIZES); |
| 38 } | 39 } |
| 39 | 40 |
| 40 PanelFrameView::~PanelFrameView() { | 41 PanelFrameView::~PanelFrameView() { |
| 41 } | 42 } |
| 42 | 43 |
| 43 void PanelFrameView::Layout() { | 44 void PanelFrameView::Layout() { |
| 44 frame_painter_->LayoutHeader(this, true); | 45 frame_painter_->LayoutHeader(this, true); |
| 45 } | 46 } |
| 46 | 47 |
| 47 void PanelFrameView::ResetWindowControls() { | 48 void PanelFrameView::ResetWindowControls() { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 close_button_->bounds().bottom(), client_bounds); | 88 close_button_->bounds().bottom(), client_bounds); |
| 88 } | 89 } |
| 89 | 90 |
| 90 void PanelFrameView::ButtonPressed(views::Button* sender, | 91 void PanelFrameView::ButtonPressed(views::Button* sender, |
| 91 const views::Event& event) { | 92 const views::Event& event) { |
| 92 if (sender == close_button_) | 93 if (sender == close_button_) |
| 93 GetWidget()->Close(); | 94 GetWidget()->Close(); |
| 94 } | 95 } |
| 95 | 96 |
| 96 } // namespace ash | 97 } // namespace ash |
| OLD | NEW |