| 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/custom_frame_view_ash.h" | 5 #include "ash/wm/custom_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 "ash/wm/workspace/workspace_event_filter.h" |
| 9 #include "grit/ui_resources.h" | 10 #include "grit/ui_resources.h" |
| 10 #include "grit/ui_strings.h" // Accessibility names | 11 #include "grit/ui_strings.h" // Accessibility names |
| 11 #include "ui/base/l10n/l10n_util.h" | 12 #include "ui/base/l10n/l10n_util.h" |
| 12 #include "ui/base/resource/resource_bundle.h" | 13 #include "ui/base/resource/resource_bundle.h" |
| 13 #include "ui/gfx/font.h" | 14 #include "ui/gfx/font.h" |
| 14 #include "ui/gfx/image/image.h" | 15 #include "ui/gfx/image/image.h" |
| 15 #include "ui/gfx/rect.h" | 16 #include "ui/gfx/rect.h" |
| 16 #include "ui/gfx/size.h" | 17 #include "ui/gfx/size.h" |
| 17 #include "ui/views/controls/button/image_button.h" | 18 #include "ui/views/controls/button/image_button.h" |
| 18 #include "ui/views/widget/native_widget_aura.h" | 19 #include "ui/views/widget/native_widget_aura.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 return frame_painter_->GetMinimumSize(this); | 142 return frame_painter_->GetMinimumSize(this); |
| 142 } | 143 } |
| 143 | 144 |
| 144 //////////////////////////////////////////////////////////////////////////////// | 145 //////////////////////////////////////////////////////////////////////////////// |
| 145 // views::ButtonListener overrides: | 146 // views::ButtonListener overrides: |
| 146 void CustomFrameViewAsh::ButtonPressed(views::Button* sender, | 147 void CustomFrameViewAsh::ButtonPressed(views::Button* sender, |
| 147 const ui::Event& event) { | 148 const ui::Event& event) { |
| 148 if (sender == maximize_button_) { | 149 if (sender == maximize_button_) { |
| 149 // The maximize button may move out from under the cursor. | 150 // The maximize button may move out from under the cursor. |
| 150 ResetWindowControls(); | 151 ResetWindowControls(); |
| 151 if (frame_->IsMaximized()) | 152 ash::ToggleMaximizedState(frame_->GetNativeWindow()); |
| 152 frame_->Restore(); | |
| 153 else | |
| 154 frame_->Maximize(); | |
| 155 // |this| may be deleted - some windows delete their frames on maximize. | 153 // |this| may be deleted - some windows delete their frames on maximize. |
| 156 } else if (sender == close_button_) { | 154 } else if (sender == close_button_) { |
| 157 frame_->Close(); | 155 frame_->Close(); |
| 158 } | 156 } |
| 159 } | 157 } |
| 160 | 158 |
| 161 //////////////////////////////////////////////////////////////////////////////// | 159 //////////////////////////////////////////////////////////////////////////////// |
| 162 // CustomFrameViewAsh, private: | 160 // CustomFrameViewAsh, private: |
| 163 | 161 |
| 164 int CustomFrameViewAsh::NonClientTopBorderHeight() const { | 162 int CustomFrameViewAsh::NonClientTopBorderHeight() const { |
| 165 // Reserve enough space to see the buttons, including any offset from top and | 163 // Reserve enough space to see the buttons, including any offset from top and |
| 166 // reserving space for the separator line. | 164 // reserving space for the separator line. |
| 167 return close_button_->bounds().bottom() + | 165 return close_button_->bounds().bottom() + |
| 168 frame_painter_->HeaderContentSeparatorSize(); | 166 frame_painter_->HeaderContentSeparatorSize(); |
| 169 } | 167 } |
| 170 | 168 |
| 171 } // namespace ash | 169 } // namespace ash |
| OLD | NEW |