| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/common/frame/caption_buttons/frame_caption_button_container_view.h
" | 5 #include "ash/common/frame/caption_buttons/frame_caption_button_container_view.h
" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "ash/common/frame/caption_buttons/frame_caption_button.h" | 10 #include "ash/common/frame/caption_buttons/frame_caption_button.h" |
| 11 #include "ash/common/frame/caption_buttons/frame_size_button.h" | 11 #include "ash/common/frame/caption_buttons/frame_size_button.h" |
| 12 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 12 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
| 13 #include "ash/common/wm_shell.h" | 13 #include "ash/common/wm_shell.h" |
| 14 #include "ash/shell.h" |
| 14 #include "ui/base/hit_test.h" | 15 #include "ui/base/hit_test.h" |
| 15 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
| 16 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 17 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
| 17 #include "ui/gfx/animation/slide_animation.h" | 18 #include "ui/gfx/animation/slide_animation.h" |
| 18 #include "ui/gfx/animation/tween.h" | 19 #include "ui/gfx/animation/tween.h" |
| 19 #include "ui/gfx/canvas.h" | 20 #include "ui/gfx/canvas.h" |
| 20 #include "ui/gfx/geometry/insets.h" | 21 #include "ui/gfx/geometry/insets.h" |
| 21 #include "ui/gfx/geometry/point.h" | 22 #include "ui/gfx/geometry/point.h" |
| 22 #include "ui/gfx/vector_icon_types.h" | 23 #include "ui/gfx/vector_icon_types.h" |
| 23 #include "ui/strings/grit/ui_strings.h" // Accessibility names | 24 #include "ui/strings/grit/ui_strings.h" // Accessibility names |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 | 300 |
| 300 FrameCaptionButton::Animate fcb_animate = | 301 FrameCaptionButton::Animate fcb_animate = |
| 301 (animate == ANIMATE_YES) ? FrameCaptionButton::ANIMATE_YES | 302 (animate == ANIMATE_YES) ? FrameCaptionButton::ANIMATE_YES |
| 302 : FrameCaptionButton::ANIMATE_NO; | 303 : FrameCaptionButton::ANIMATE_NO; |
| 303 auto it = button_icon_map_.find(icon); | 304 auto it = button_icon_map_.find(icon); |
| 304 if (it != button_icon_map_.end()) | 305 if (it != button_icon_map_.end()) |
| 305 button->SetImage(icon, fcb_animate, *it->second); | 306 button->SetImage(icon, fcb_animate, *it->second); |
| 306 } | 307 } |
| 307 | 308 |
| 308 bool FrameCaptionButtonContainerView::ShouldSizeButtonBeVisible() const { | 309 bool FrameCaptionButtonContainerView::ShouldSizeButtonBeVisible() const { |
| 309 return !WmShell::Get() | 310 return !Shell::Get() |
| 310 ->maximize_mode_controller() | 311 ->maximize_mode_controller() |
| 311 ->IsMaximizeModeWindowManagerEnabled() && | 312 ->IsMaximizeModeWindowManagerEnabled() && |
| 312 frame_->widget_delegate()->CanMaximize(); | 313 frame_->widget_delegate()->CanMaximize(); |
| 313 } | 314 } |
| 314 | 315 |
| 315 void FrameCaptionButtonContainerView::ButtonPressed(views::Button* sender, | 316 void FrameCaptionButtonContainerView::ButtonPressed(views::Button* sender, |
| 316 const ui::Event& event) { | 317 const ui::Event& event) { |
| 317 // Abort any animations of the button icons. | 318 // Abort any animations of the button icons. |
| 318 SetButtonsToNormal(ANIMATE_NO); | 319 SetButtonsToNormal(ANIMATE_NO); |
| 319 | 320 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 views::Button::ButtonState new_state = views::Button::STATE_NORMAL; | 404 views::Button::ButtonState new_state = views::Button::STATE_NORMAL; |
| 404 if (button == to_hover) | 405 if (button == to_hover) |
| 405 new_state = views::Button::STATE_HOVERED; | 406 new_state = views::Button::STATE_HOVERED; |
| 406 else if (button == to_press) | 407 else if (button == to_press) |
| 407 new_state = views::Button::STATE_PRESSED; | 408 new_state = views::Button::STATE_PRESSED; |
| 408 button->SetState(new_state); | 409 button->SetState(new_state); |
| 409 } | 410 } |
| 410 } | 411 } |
| 411 | 412 |
| 412 } // namespace ash | 413 } // namespace ash |
| OLD | NEW |